|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectariba.util.core.Timer
public class Timer
Object subclass that causes an action to occur at a predefined rate. For example, an animation object can use a Timer as the trigger for drawing its next frame. Each Timer has a Target that receives a performCommand() message; the command the Timer sends to its Target; and a delay (the time between performCommand() calls). When delay milliseconds have passed, a Timer sends the performCommand() message to its Target, passing as parameters the command and the object set using the Timer's setData() method. This cycle repeats until stop() is called, or halts immediately if the Timer is configured to send its message just once.
Using a Timer involves first creating it, then starting it using the start() method.
Target
Constructor Summary | |
---|---|
Timer(EventLoop eventLoop,
Target target,
java.lang.String command,
int delay)
Constructs a Timer associated with the EventLoop eventLoop that sends performCommand() to target every delay milliseconds. |
Method Summary | |
---|---|
java.lang.String |
getCommand()
Returns the command the Timer sends to its target in the performCommand() message. |
java.lang.Object |
getData()
Returns the Timer's data. |
int |
getDelay()
Returns the Timer's delay. |
EventLoop |
getEventLoop()
Returns the EventLoop associated with this Timer. |
int |
getInitialDelay()
Returns the Timer's initial delay. |
boolean |
getRepeats()
Returns true if the Timer will send a performCommand() message to its target multiple times. |
Target |
getTarget()
Returns the Target that will receive performCommand() messages from the Timer. |
boolean |
isRunning()
Returns true if the Timer is running. |
void |
processEvent()
EventProcessor interface method implemented to perform the Timer's event processing behavior, which is to send the performCommand() message to its Target. |
void |
setCommand(java.lang.String command)
Sets the command the Timer sends to its target in the performCommand() method. |
void |
setData(java.lang.Object data)
Sets the Timer's data. |
void |
setDelay(int delay)
Sets the Timer's delay, the number of milliseconds between successive performCommand() messages to its Target. |
void |
setInitialDelay(int initialDelay)
Sets the Timer's initial delay. |
void |
setRepeats(boolean flag)
If flag is false, instructs the Timer to send a performCommand() message to its Target only once, and then stop. |
void |
setTarget(Target target)
Sets the Target that will receive performCommand() messages from the Timer. |
void |
start()
Starts the Timer, causing it to send performCommand() messages to its Target. |
void |
stop()
Stops a Timer, causing it to stop sending performCommand() messages to its Target. |
java.lang.String |
toString()
Returns the Timer's string representation. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Timer(EventLoop eventLoop, Target target, java.lang.String command, int delay)
Method Detail |
---|
public EventLoop getEventLoop()
public void setTarget(Target target)
public Target getTarget()
setTarget(ariba.util.core.Target)
public void setCommand(java.lang.String command)
setTarget(ariba.util.core.Target)
public java.lang.String getCommand()
setCommand(java.lang.String)
public void setDelay(int delay)
setTarget(ariba.util.core.Target)
,
setInitialDelay(int)
public int getDelay()
setDelay(int)
public void setData(java.lang.Object data)
public java.lang.Object getData()
public void setInitialDelay(int initialDelay)
setTarget(ariba.util.core.Target)
,
setDelay(int)
public int getInitialDelay()
setDelay(int)
public void setRepeats(boolean flag)
public boolean getRepeats()
setRepeats(boolean)
public void start()
stop()
public boolean isRunning()
start()
public void stop()
start()
public void processEvent()
processEvent
in interface EventProcessor
EventProcessor
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |