simtools.util
Class AbstractCyclicCallerRunnable

java.lang.Object
  extended by simtools.util.AbstractCyclicCallerRunnable
All Implemented Interfaces:
java.lang.Runnable

public abstract class AbstractCyclicCallerRunnable
extends java.lang.Object
implements java.lang.Runnable

Class AbstractCyclicCallerRunnable This class permit to create a Runnable object that call cyclically to a method. It permits to be paused, resumed, and stopped. The refreshRate is configurable, as the beginning state of the cyclic caller, wether running or paused.


Field Summary
static int STATE_PAUSED
          (int) STATE_PAUSED: The paused state.
static int STATE_RUNNING
          (int) STATE_RUNNING: The running state.
static int STATE_STOPPED
          (int) STATE_STOPPED: The stopped state.
 
Constructor Summary
AbstractCyclicCallerRunnable()
          Contructor AbstractCyclicCallerRunnable
Summary:
The constructor of the class AbstractCyclicCallerRunnable.
AbstractCyclicCallerRunnable(boolean runningAtLaunch)
          Contructor AbstractCyclicCallerRunnable
Summary:
The constructor of the class AbstractCyclicCallerRunnable.
AbstractCyclicCallerRunnable(int refreshRate)
          Contructor AbstractCyclicCallerRunnable
Summary:
The constructor of the class AbstractCyclicCallerRunnable.
AbstractCyclicCallerRunnable(int refreshRate, boolean runningAtLaunch)
          Contructor AbstractCyclicCallerRunnable
Summary:
Construct an AbstractCyclicCallerRunnable, with given refreshRate.
 
Method Summary
 int getStatus()
          Method getStatus
Summary:
Return the current status of the CyclicCaller.
 void pause()
          Method pause
Summary:
This method pause the runnable.
abstract  void process()
          Method process
Summary:
The method that will be called cyclically by the Runnbale.
 void resume()
          Method resume
Summary:
This method resume the runnable that is in STATE_PAUSED.
 void run()
           
 void stop()
          Method stop
Summary:
This method permits to stop the Runnable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_RUNNING

public static final int STATE_RUNNING
(int) STATE_RUNNING: The running state.

See Also:
Constant Field Values

STATE_PAUSED

public static final int STATE_PAUSED
(int) STATE_PAUSED: The paused state.

See Also:
Constant Field Values

STATE_STOPPED

public static final int STATE_STOPPED
(int) STATE_STOPPED: The stopped state.

See Also:
Constant Field Values
Constructor Detail

AbstractCyclicCallerRunnable

public AbstractCyclicCallerRunnable()
Contructor AbstractCyclicCallerRunnable
Summary:
The constructor of the class AbstractCyclicCallerRunnable. Uses DEFAULT_REFRESH_RATE, and put in running state.


AbstractCyclicCallerRunnable

public AbstractCyclicCallerRunnable(int refreshRate)
Contructor AbstractCyclicCallerRunnable
Summary:
The constructor of the class AbstractCyclicCallerRunnable. Will launch a cyclic caller using given refresh rate and put it in running state.

Parameters:
refreshRate - The refresh rate to use in the cyclic caller.

AbstractCyclicCallerRunnable

public AbstractCyclicCallerRunnable(boolean runningAtLaunch)
Contructor AbstractCyclicCallerRunnable
Summary:
The constructor of the class AbstractCyclicCallerRunnable. Uses DEFAULT_REFRESH_RATE and put cyclic caller in given status.

Parameters:
runningAtLaunch - True to launch the cyclic caller in RUNNING state, false to launch in paused state.

AbstractCyclicCallerRunnable

public AbstractCyclicCallerRunnable(int refreshRate,
                                    boolean runningAtLaunch)
Contructor AbstractCyclicCallerRunnable
Summary:
Construct an AbstractCyclicCallerRunnable, with given refreshRate. If runningAtLaunch is set to true, runnable will be in RUNNING state at launch else Will be in PAUSED STATE.

Parameters:
refreshRate - The refreshRate of the CyclicCaller, in milliseconds
runningAtLaunch - True to launch the cyclic caller in RUNNING state, false to launch in paused state.
Method Detail

run

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

process

public abstract void process()
Method process
Summary:
The method that will be called cyclically by the Runnbale. Calls can be paused, or stopped.


resume

public void resume()
Method resume
Summary:
This method resume the runnable that is in STATE_PAUSED.


pause

public void pause()
Method pause
Summary:
This method pause the runnable.


stop

public void stop()
Method stop
Summary:
This method permits to stop the Runnable.


getStatus

public int getStatus()
Method getStatus
Summary:
Return the current status of the CyclicCaller. Wether: AbstractCyclicCallerRunnable.STATE_RUNNING , AbstractCyclicCallerRunnable.STATE_PAUSED or AbstractCyclicCallerRunnable.STATE_STOPPED.

Returns:
(int) the current status of the CyclicCaller.