planet.util.timer
Class SimulationTimerImpl

java.lang.Object
  extended byplanet.util.timer.SimulationTimerImpl
All Implemented Interfaces:
java.io.Serializable, SimulationTimer, Timer

public class SimulationTimerImpl
extends java.lang.Object
implements SimulationTimer

Implements the contract that is specified by the SimulationTimer interface. This permits schedule differents task for only one node.

Is important to know that is in a simulation environment. For that reason, all time is measured in steps.

Author:
Jordi Pujol Date: 05/05/2004
See Also:
Serialized Form

Constructor Summary
SimulationTimerImpl()
          Initialize a Vector to contain all scheduled TimerTask.
 
Method Summary
 void cancel()
          Cancels all scheduled tasks.
 void currentStep(int step)
          Informs to the Timer that the actual step is step and permits to advise to differents taks for their timeouts.
 void setTimerTask(TimerTask task, long delay)
          Permits add a task for only one execution after delay steps.
 void setTimerTask(TimerTask task, long delay, long period)
          Permits add a task for repeatly execution, the first time after delay steps, and others after period steps.
 java.lang.String toString()
          Shows in String format the representation of this Timer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimulationTimerImpl

public SimulationTimerImpl()
Initialize a Vector to contain all scheduled TimerTask.

Method Detail

currentStep

public void currentStep(int step)
Informs to the Timer that the actual step is step and permits to advise to differents taks for their timeouts.

Specified by:
currentStep in interface SimulationTimer
Parameters:
step -
See Also:
SimulationTimer.currentStep(int)

setTimerTask

public void setTimerTask(TimerTask task,
                         long delay)
Permits add a task for only one execution after delay steps.

Specified by:
setTimerTask in interface Timer
Parameters:
task - TimerTask with action to do after delay steps.
delay - Number of steps to wait for to schedule the task.
See Also:
Timer.setTimerTask(planet.util.timer.TimerTask, long)

setTimerTask

public void setTimerTask(TimerTask task,
                         long delay,
                         long period)
Permits add a task for repeatly execution, the first time after delay steps, and others after period steps.

Specified by:
setTimerTask in interface Timer
Parameters:
task - TimerTask with action to do after delay steps, and after period steps.
delay - Number of steps to wait for to schedule the task.
period - Number of steps to wait for others scheduling of the task.
See Also:
Timer.setTimerTask(planet.util.timer.TimerTask, long, long)

cancel

public void cancel()
Cancels all scheduled tasks. After this, this Timer is ready for new TimerTask schedulings.

Specified by:
cancel in interface Timer
See Also:
Timer.cancel()

toString

public java.lang.String toString()
Shows in String format the representation of this Timer.

Returns:
A representation of this Timer in String format.
See Also:
Object.toString()


/FONT>