|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmoka.lang.Object
moka.event.Interrupt
moka.util.Timer
A facility to schedule tasks for future execution in a background loop. This class proposes also a static method to pause the execution of the program.
Field Summary | |
boolean |
active
Is the timer activated ? Should be only read. |
int |
delay
The delay of the timer (in 1/20th of second). |
EventListener |
listen
The listener binded to this timer. |
short |
no
Deprecated. From MDK2.1. Removed from MDK2.21. |
int |
time
The time stamp value when this timer will expire. |
static int |
timeStamp
The current time stamp (in 1/20th of second). |
Fields inherited from class moka.event.Interrupt |
busy |
Constructor Summary | |
Timer()
Creates a new Timer using the timer ID number 6 and a 20 1/20th of second delay (1 second). |
|
Timer(int delay)
Creates a new Timer specifying the the delay. |
|
Timer(short no,
int delay)
Deprecated. As of MDK2.1, use Timer(int delay) instead. Removed from MDK2.21. |
Method Summary | |
boolean |
check()
Used to verify if this timer should trigger an event. |
void |
run()
Handles the code to execute when this object interrupts. |
void |
setActive(boolean b)
Sets if this timer is activated. |
void |
wait()
Pauses the execution of the program until this timer's delay expires according that this timer is activated. |
static void |
wait(int delay)
Pauses the execution of the program until the specified delay expires. |
Methods inherited from class moka.event.Interrupt |
finalize, register, unregister |
Methods inherited from class moka.lang.Object |
equals, getClassName, toString |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait |
Field Detail |
public short no
public boolean active
public int delay
public int time
public EventListener listen
public static volatile int timeStamp
Constructor Detail |
public Timer()
public Timer(int delay)
delay
- The delay of the timer (in 1/20th of second).public Timer(short no, int delay)
no
- The id number of the timer (1 to 6).delay
- The delay of the timer (in 1/20th of second).Method Detail |
public boolean check()
check
in class Interrupt
public void run()
run
in class Interrupt
public void setActive(boolean b)
b
- a flag indicating whether this timer is activated. If this flag is set to true and
this timer is already activated, the timer is reseted.public void wait()
public static void wait(int delay)
delay
- The the timer (in 1/20th of second).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |