com.monica.javacom.util
Class MJCThreadTimer

java.lang.Object
  |
  +--com.monica.javacom.util.MJCThreadTimer
All Implemented Interfaces:
MJCTimer, java.lang.Runnable

public class MJCThreadTimer
extends java.lang.Object
implements MJCTimer, java.lang.Runnable

Class for providing MJCTimer functionality by using Thread.sleep to measure the passed time.


Constructor Summary
MJCThreadTimer(MJCTimerHandler tH)
          Default constructor.
 
Method Summary
 boolean killTimer(int timerID)
          Kills the timer with the specified timerID.
 void run()
           
 boolean setTimer(int timerID, int interval)
          Starts the timer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MJCThreadTimer

public MJCThreadTimer(MJCTimerHandler tH)
Default constructor.
Parameters:
MJCTimerHandler - tH: the timerHandler that has to be notified at timer events
Method Detail

setTimer

public boolean setTimer(int timerID,
                        int interval)
Description copied from interface: MJCTimer
Starts the timer. The timer will call the callback method each passed interval milliseconds supplying the provided timerID as well until the timer is explicitly killed with the killTimer method.
Specified by:
setTimer in interface MJCTimer
Following copied from interface: com.monica.javacom.interfaces.MJCTimer
Parameters:
int - timerID: the Id that will be supplied to the callback method
Returns:
boolean: wether the timer could be started or not

killTimer

public boolean killTimer(int timerID)
Description copied from interface: MJCTimer
Kills the timer with the specified timerID.
Specified by:
killTimer in interface MJCTimer
Following copied from interface: com.monica.javacom.interfaces.MJCTimer
Parameters:
int - timerID: the timerID of the to be killed timer
Returns:
boolean: wether the timer could be killed or not

run

public void run()
Specified by:
run in interface java.lang.Runnable