|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.lang.Thread
|
+--amber.utility.Timer
This class is a timer thread used by other classes to get time information.
TimerInterface, Serialized Form| Field Summary | |
protected TimerInterface |
callback
The object to call when the timer expires. |
protected long |
expirationTime
The time at which the timer expires. |
protected boolean |
fireOnce
Set if the timer is to be single shot. |
protected long |
ticks
The number of milliseconds to wait. |
protected boolean |
timerActive
Set while the timer is active. |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
Timer(long ticks,
TimerInterface callback)
|
|
Timer(long ticks,
TimerInterface callback,
boolean fireOnce)
|
|
| Method Summary | |
long |
getExpirationTime()
Returns the time at which the timer will terminate. |
long |
getTimerDuration()
The amount of time the timer is running for. |
long |
getTimeRemaining()
Returns the time left before the timer expires. |
boolean |
isTimerActive()
Returns if the timer is running. |
void |
resetTimer()
This function resets the timer. |
void |
resetTimer(long amount)
This function resets the timer. |
void |
run()
This function loops forever, processing timeouts every once in a while. |
void |
start()
This function causes the timer to start operating. |
void |
startTimer()
This function causes the timer to start operating. |
void |
stopTimer()
This function causes the timer to terminate. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected long ticks
protected long expirationTime
protected TimerInterface callback
protected boolean fireOnce
protected boolean timerActive
| Constructor Detail |
public Timer(long ticks,
TimerInterface callback,
boolean fireOnce)
throws java.lang.IllegalArgumentException
public Timer(long ticks,
TimerInterface callback)
throws java.lang.IllegalArgumentException
| Method Detail |
public void start()
start in class java.lang.Threadpublic void startTimer()
public void stopTimer()
public boolean isTimerActive()
public void resetTimer()
throws java.lang.IllegalStateException
java.lang.IllegalStateException - if the timer has stopped.
public void resetTimer(long amount)
throws java.lang.IllegalStateException
amount - long containing the new number of milliseconds to delay for.java.lang.IllegalStateException - if the timer has stopped.public long getTimerDuration()
public long getExpirationTime()
public long getTimeRemaining()
public void run()
run in class java.lang.ThreadstartTimer(),
stopTimer()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||