|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJTP.TimeStore
public class TimeStore
Class storing timing information (used by GameTimer
).
Constructor Summary | |
---|---|
TimeStore()
|
Method Summary | |
---|---|
long |
getAccumulatedTime()
Returns time added up by using incrementAccumulatedTime()
method. |
long |
getAccumulatedTimeSeconds()
Returns time added up by using incrementAccumulatedTime()
method, in seconds. |
long |
getTimeLimit()
Returns time time limit set. |
boolean |
hasStarted()
Returns whether start point has been set. |
void |
incrementAccumulatedTime()
Adds the currently leftover time to the total. |
void |
reset()
Resets start and stop times. |
void |
resetAccumulatedTime()
Resets the time added up by using incrementAccumulatedTime()
method back to zero for active timer. |
void |
resume()
Adjust start time to take into account pause period caused by call to stop() . |
void |
setTimeLimit(int timeLimit)
Sets time limit to use. |
void |
start()
Sets start time to current timestamp. |
void |
stop()
Sets stop time to current timestamp assuming start() has been
called before. |
long |
timeLeft()
Returns time remaining for given time limit. |
String |
toString()
Returns time remaining in mm:ss format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TimeStore()
Method Detail |
---|
public void setTimeLimit(int timeLimit) throws IllegalArgumentException
timeLimit
- time in seconds.
IllegalArgumentException
- if timeLimit < 0
.public long getTimeLimit()
public void start()
public boolean hasStarted()
true
if start()
has been called
since construction or last reset()
call.public void resume()
stop()
.
public void stop()
start()
has been
called before. A second call to this method without calls to either
start()
or resume()
will have no effect.
public long getAccumulatedTime()
incrementAccumulatedTime()
method.
public long getAccumulatedTimeSeconds()
incrementAccumulatedTime()
method, in seconds. Note: The returned value will have been rounded up
to the nearest second.
public void incrementAccumulatedTime()
public long timeLeft()
public void reset()
public void resetAccumulatedTime()
incrementAccumulatedTime()
method back to zero for active timer.
public String toString()
mm:ss
format.
toString
in class Object
String
representation.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |