public class State
extends java.lang.Object
Constructor and Description |
---|
State(State state)
Copy constructor for creating a duplicate a state
|
State(java.lang.String state,
double time)
Constructor for creating an initial state and time.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(boolean state) |
boolean |
equals(int state) |
boolean |
equals(long state) |
boolean |
equals(State state)
Returns true if the current state equals the specified state object.
|
boolean |
equals(java.lang.String state)
Returns true if the current state equals the specified state.
|
boolean |
equalsPrevious(State state)
Returns true if the previous state equals the specified state object.
|
boolean |
equalsPrevious(java.lang.String state)
Returns true if the previous state equals the specified state.
|
double |
getPrevStartingTime()
Returns the starting time of the current state.
|
double |
getPrevStartingTime(java.lang.String state)
Returns the starting time of the specified state.
|
java.lang.String |
getPrevState()
Returns the previous state.
|
double |
getPrevTime()
Returns the amount of time you were in the previous state.
|
double |
getStartingTime()
Returns the starting time of the current state.
|
double |
getStartingTime(java.lang.String state)
Returns the starting time of the specified state.
|
java.lang.String |
getState()
Returns the current state.
|
double |
getTime(double current)
Returns the amount of time you have been in the current state.
|
double |
getTime(java.lang.String state,
double current)
Returns the amount of time you were in the specified state.
|
void |
setState(boolean state,
double time) |
void |
setState(int state,
double time) |
void |
setState(long state,
double time) |
void |
setState(State state)
Changes to the specified state using the starting time of the last time the state was started.
|
void |
setState(java.lang.String state,
double time)
Changes to the specified state.
|
java.lang.String |
toString()
Returns a printable string of the current and previous states.
|
public State(java.lang.String state, double time)
state
- The initial state.time
- The time to track this state against.public State(State state)
state
- The state to duplicatepublic java.lang.String getState()
public double getTime(double current)
current
- The current time.public double getStartingTime()
public double getStartingTime(java.lang.String state)
state
- The state to lookup.public double getTime(java.lang.String state, double current)
state
- The state to lookup.current
- The current time.public void setState(java.lang.String state, double time)
NOTE: If called subsequently with the same state, the starting time is only recorded the first time.
state
- The state to change to.time
- The time to record as the starting time you changed to this statepublic void setState(int state, double time)
public void setState(long state, double time)
public void setState(boolean state, double time)
public void setState(State state)
state
- The state to change to.public boolean equals(java.lang.String state)
state
- The state to compare to.public boolean equals(State state)
state
- The state to compare to.public boolean equals(int state)
public boolean equals(long state)
public boolean equals(boolean state)
public java.lang.String getPrevState()
public double getPrevStartingTime(java.lang.String state)
state
- The state to lookup.public double getPrevStartingTime()
public double getPrevTime()
public boolean equalsPrevious(java.lang.String state)
state
- The state to compare to.public boolean equalsPrevious(State state)
state
- The state to compare to.public java.lang.String toString()
toString
in class java.lang.Object