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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTimeKeeper(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 TypeMethodDescriptionvoidvoidchangeState(String newState, long ms) Adds time to the last state while updating the status of other parameters.booleanlonggetState()longgetTimes()longgetTotal()inthashCode()voidrenameState(String state, String renameTo) protected voidresetState(String state) protected voidresetState(String state, long time) voidsetLastStateChange(long lastStateChange) voidvoidSets a specific time for a state.voidtoString()
-
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
-