public abstract class TimeKeeper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected long |
lastStateChange |
protected java.lang.String |
state |
protected java.util.Map<java.lang.String,java.lang.Long> |
times |
Constructor and Description |
---|
TimeKeeper() |
TimeKeeper(java.util.Map<java.lang.String,java.lang.Long> times) |
TimeKeeper(java.util.Map<java.lang.String,java.lang.Long> times,
java.lang.String lastState,
long lastStateChange) |
TimeKeeper(java.lang.String lastState) |
TimeKeeper(java.lang.String lastState,
long lastStateChange) |
Modifier and Type | Method and Description |
---|---|
void |
addTime(java.lang.String state,
long time) |
void |
changeState(java.lang.String newState,
long ms)
Adds time to the last state while updating the status of other parameters.
|
boolean |
equals(java.lang.Object o) |
long |
getLastStateChange() |
java.lang.String |
getState() |
long |
getTime(java.lang.String state) |
java.util.Map<java.lang.String,java.lang.Long> |
getTimes() |
long |
getTotal() |
int |
hashCode() |
void |
renameState(java.lang.String state,
java.lang.String renameTo) |
protected void |
resetState(java.lang.String state) |
protected void |
resetState(java.lang.String state,
long time) |
void |
setLastStateChange(long lastStateChange) |
void |
setState(java.lang.String state) |
void |
setTime(java.lang.String state,
long time)
Sets a specific time for a state.
|
void |
setTimes(java.util.Map<java.lang.String,java.lang.Long> times) |
java.lang.String |
toString() |
protected java.util.Map<java.lang.String,java.lang.Long> times
protected java.lang.String state
protected long lastStateChange
public TimeKeeper(java.util.Map<java.lang.String,java.lang.Long> times, java.lang.String lastState, long lastStateChange)
public TimeKeeper(java.lang.String lastState, long lastStateChange)
public TimeKeeper(java.lang.String lastState)
public TimeKeeper(java.util.Map<java.lang.String,java.lang.Long> times)
public TimeKeeper()
public void setTime(java.lang.String state, long time)
state
- State to settime
- Time in ms the state has been active forjava.lang.IllegalArgumentException
- If given state is nullpublic void renameState(java.lang.String state, java.lang.String renameTo)
public void changeState(java.lang.String newState, long ms)
newState
- New State seen in.ms
- Epoch ms the change occurred.java.lang.IllegalArgumentException
- If newState is null.protected void resetState(java.lang.String state)
protected void resetState(java.lang.String state, long time)
public long getTime(java.lang.String state)
public void addTime(java.lang.String state, long time)
public long getTotal()
public java.util.Map<java.lang.String,java.lang.Long> getTimes()
public void setTimes(java.util.Map<java.lang.String,java.lang.Long> times)
public java.lang.String getState()
public void setState(java.lang.String state)
public long getLastStateChange()
public void setLastStateChange(long lastStateChange)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object