|
SmartFrog 3.10.000 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.smartfrog.sfcore.common.Timer
public class Timer
Implements a simple timer. Useful classes subclass from this and override
the timerTick() method to provide functional behaviour on every tick.
| Field Summary | |
|---|---|
protected java.lang.String |
name
Thread name. |
protected boolean |
stopped
Flag indicating whether this timer has been stopped. |
protected long |
tickDelay
Delay between ticks in milliseconds. |
protected java.lang.Thread |
timerThread
Holder for thread. |
protected boolean |
waiting
Flag indicating that thread is currently waiting. |
| Constructor Summary | |
|---|---|
Timer(long delay)
Constructor. |
|
| Method Summary | |
|---|---|
protected java.lang.Thread |
createThread(java.lang.Runnable run)
Creates a thread on given runnable interface. |
protected void |
doTick()
Does the tick. |
boolean |
getStopped()
Returns the stopped flag. |
long |
getTickDelay()
Gets the tick delay for this timer. |
boolean |
getWaiting()
Returns the waiting flag. |
void |
reschedule()
Reschedules the timer thread. |
void |
run()
Thread entry point. |
void |
setName(java.lang.String name)
Sets the name |
void |
setTickDelay(long delay)
Sets the tick delay, reschedules the thread if currently waiting. |
void |
start()
Starts the timer off (ie starts the timer thread). |
void |
stop()
Stops the thread indirectly by setting the stopped flag. |
protected void |
timerTick()
Subclasses should implement this message. |
protected void |
timerWait()
Does the actual wait. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected long tickDelay
protected java.lang.Thread timerThread
protected boolean stopped
protected boolean waiting
protected java.lang.String name
| Constructor Detail |
|---|
public Timer(long delay)
delay - delay between ticks| Method Detail |
|---|
public void start()
public void stop()
public void reschedule()
public boolean getStopped()
public boolean getWaiting()
public long getTickDelay()
setTickDelay(long)public void setTickDelay(long delay)
delay - new tick delaygetTickDelay()protected void timerWait()
protected void doTick()
protected java.lang.Thread createThread(java.lang.Runnable run)
run - runnable object
protected void timerTick()
public void run()
run in interface java.lang.Runnablepublic void setName(java.lang.String name)
name - String name
|
SmartFrog CORE 3.10.000 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||