Class TimeKeeper
java.lang.Object
com.djrapitops.plan.gathering.domain.TimeKeeper
- Direct Known Subclasses:
GMTimes
Keeps track of time spent in each state.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTimeKeeper(String lastState)
TimeKeeper(String lastState, long lastStateChange)
TimeKeeper(Map<String,Long> times)
TimeKeeper(Map<String,Long> times, String lastState, long lastStateChange)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
changeState(String newState, long ms)
Adds time to the last state while updating the status of other parameters.boolean
long
getState()
long
getTimes()
long
getTotal()
int
hashCode()
void
renameState(String state, String renameTo)
protected void
resetState(String state)
protected void
resetState(String state, long time)
void
setLastStateChange(long lastStateChange)
void
void
Sets a specific time for a state.void
toString()
-
Field Details
-
times
-
state
-
lastStateChange
protected long lastStateChange
-
-
Constructor Details
-
TimeKeeper
-
TimeKeeper
-
TimeKeeper
-
TimeKeeper
-
TimeKeeper
public TimeKeeper()
-
-
Method Details
-
setTime
Sets a specific time for a state.- Parameters:
state
- State to settime
- Time in ms the state has been active for- Throws:
IllegalArgumentException
- If given state is null
-
renameState
-
changeState
Adds time to the last state while updating the status of other parameters.- Parameters:
newState
- New State seen in.ms
- Epoch ms the change occurred.- Throws:
IllegalArgumentException
- If newState is null.
-
resetState
-
resetState
-
getTime
-
addTime
-
getTotal
public long getTotal() -
getTimes
-
setTimes
-
getState
-
setState
-
getLastStateChange
public long getLastStateChange() -
setLastStateChange
public void setLastStateChange(long lastStateChange) -
equals
-
hashCode
public int hashCode() -
toString
-