public class TimerInfo
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private long |
start
Stores the start time of the timer (in milliseconds).
|
private TimerState |
state
Stores the current state of the timer.
|
private long |
value
Stores the (incrementally aggreagted) value of the timer.
|
| Constructor and Description |
|---|
TimerInfo(long start)
Creates a new timer info and initializes it as if the timer was
started at the given point of time.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getValue()
Returns the current (incrementally aggregated) value.
|
boolean |
handleState(TimerState state,
long now)
Handles a state change to the given
state at the given
point of time now. |
boolean |
isActive()
Returns if the timer is active (started or resumed).
|
boolean |
isStopped()
Returns if the timer is stopped.
|
private void |
start(long start)
Initializes the timer as if it was started at the given point of time.
|
private long start
private long value
private TimerState state
public TimerInfo(long start)
start - the start point of time (in milliseconds)private void start(long start)
start - the start point of time (in milliseconds)public long getValue()
0 if not finished
and not stopped so farpublic boolean handleState(TimerState state, long now)
state at the given
point of time now.state - the new statenow - the current time in millisecondstrue if the timer is finished and observers should
be notified, false elsepublic final boolean isActive()
true if the timer is active, false
if the timer is in another statepublic final boolean isStopped()
true if the timer is stopped, false
if the timer is in another state