Modifier and Type | Field and Description |
---|---|
protected long |
lastStateChange
Relates to Playtime Milliseconds.
|
protected String |
state
Last State seen in
|
protected Map<String,Long> |
times
Keeps time of states.
|
Constructor and Description |
---|
TimeKeeper() |
TimeKeeper(Map<String,Long> times) |
TimeKeeper(Map<String,Long> times,
String lastState,
long lastStateChange) |
TimeKeeper(String lastState) |
TimeKeeper(String lastState,
long lastStateChange) |
Modifier and Type | Method and Description |
---|---|
void |
changeState(String newState,
long playTime)
Adds time to the last state while updating the status of other parameters.
|
boolean |
equals(Object o) |
long |
getLastStateChange() |
String |
getState() |
long |
getTime(String state) |
Map<String,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 |
setState(String state) |
void |
setTime(String state,
long time)
Sets a specific time for a state.
|
void |
setTimes(Map<String,Long> times) |
String |
toString() |
protected String state
protected long lastStateChange
public TimeKeeper(String lastState, long lastStateChange)
public TimeKeeper(String lastState)
public TimeKeeper()
public void setTime(String state, long time)
state
- State to settime
- Time in ms the state has been active forIllegalArgumentException
- If given state is nullpublic void changeState(String newState, long playTime)
newState
- New State seen in.playTime
- Current Playtime.IllegalArgumentException
- If newState is null.protected void resetState(String state)
protected void resetState(String state, long time)
public long getTime(String state)
public long getTotal()
public String getState()
public void setState(String state)
public long getLastStateChange()
public void setLastStateChange(long lastStateChange)
Copyright © 2017. All rights reserved.