Jeospace API

org.jeospace.simulation
Class ChronManager

java.lang.Object
  extended byorg.jeospace.simulation.ChronManager
All Implemented Interfaces:
ChronAlarmFactory, java.util.EventListener, java.lang.Runnable, SimListener, TaskScheduler

public class ChronManager
extends java.lang.Object
implements TaskScheduler, java.lang.Runnable, SimListener, ChronAlarmFactory

Maintains the current active Chronometer, provides a synchronous scheduler for executing tasks on the simulation frame clock and collects performance data on the execution of simulation functions.

Version:
$Revision: 1.1.1.1 $
Author:
Rex Melton
See Also:
Profile, Chronometer, TaskScheduler

Constructor Summary
ChronManager(Chronometer chronometer)
          Constructor
 
Method Summary
 boolean addTask(java.lang.Runnable task)
          Add a new task to the run list
 ChronAlarm createChronAlarm(ChronAlarmListener listener, java.lang.Object listenerID, ChronPeriod interval, boolean repeat)
          Create a new ChronAlarm.
 void enableLogging(boolean enable)
          Set the state of performance data logging
 Chronometer getChronometer()
          Return the current active Chronometer
 long getClockPeriod()
          Return the frame clock period in milliseconds.
 void getFramePeriodData(int[] data)
          Return the frame period data.
 void getUpdatePeriodData(int[] data)
          Return the frame cycle execution time data.
 boolean isLoggingEnabled()
          Return the enable state of performance data logging
 boolean removeTask(java.lang.Runnable task)
          Remove a task from the run list
 void resetLoggingData()
          Reset the performance data to their initial values
 void run()
          The periodic processing routine.
 void setClockPeriod(long milliseconds)
          Set the frame clock period in milliseconds
 void setSimManager(SimManager simManager)
          Set the SimManager.
 void simAction(SimEvent se)
          Invoked when an simulation manager event occurs.
 void start()
          Start the ChronManager's task scheduling
 void stop()
          Stop the ChronManager's task scheduling
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChronManager

public ChronManager(Chronometer chronometer)
Constructor

Parameters:
chronometer - the Chronometer.
Method Detail

run

public void run()
The periodic processing routine.

Specified by:
run in interface java.lang.Runnable

simAction

public void simAction(SimEvent se)
Description copied from interface: SimListener
Invoked when an simulation manager event occurs.

Specified by:
simAction in interface SimListener

start

public void start()
Start the ChronManager's task scheduling

Specified by:
start in interface TaskScheduler

stop

public void stop()
Stop the ChronManager's task scheduling

Specified by:
stop in interface TaskScheduler

addTask

public boolean addTask(java.lang.Runnable task)
Add a new task to the run list

Specified by:
addTask in interface TaskScheduler
Parameters:
task - the new task to add
Returns:
a success flag true if the task was added to the run list, false if otherwise.

removeTask

public boolean removeTask(java.lang.Runnable task)
Remove a task from the run list

Specified by:
removeTask in interface TaskScheduler
Parameters:
task - the task to remove
Returns:
a success flag true if the task was removed from the run list, false if otherwise.

getClockPeriod

public long getClockPeriod()
Return the frame clock period in milliseconds.

Specified by:
getClockPeriod in interface TaskScheduler
Returns:
the frame clock period in milliseconds.

setClockPeriod

public void setClockPeriod(long milliseconds)
Set the frame clock period in milliseconds

Specified by:
setClockPeriod in interface TaskScheduler
Parameters:
milliseconds - the frame clock period

createChronAlarm

public ChronAlarm createChronAlarm(ChronAlarmListener listener,
                                   java.lang.Object listenerID,
                                   ChronPeriod interval,
                                   boolean repeat)
Create a new ChronAlarm.

Specified by:
createChronAlarm in interface ChronAlarmFactory
Parameters:
listener - the ChronAlarmListener that will respond to alarm events
listenerID - an identifying Object to be returned in the ChronAlarmEvent
interval - the ChronPeriod that defines the interval of the alarm. An alarm event will be generated when the active Chronometer reaches or exceeds the interval period in either the forward or backward direction.
repeat - flag indicating that this alarm repeats true or is a one shot false.

setSimManager

public void setSimManager(SimManager simManager)
Set the SimManager. If the SimManager is set, the ChronManager will synchronize it's periodic processing with the SimManager's frame ready event.

Parameters:
simManager - the active SimManager.

getChronometer

public Chronometer getChronometer()
Return the current active Chronometer

Returns:
the current active Chronometer

enableLogging

public void enableLogging(boolean enable)
Set the state of performance data logging

Parameters:
enable - the new state

isLoggingEnabled

public boolean isLoggingEnabled()
Return the enable state of performance data logging

Returns:
the enable state of performance data logging

getUpdatePeriodData

public void getUpdatePeriodData(int[] data)
Return the frame cycle execution time data. (i.e. the time spent executing tasks on the run list for each frame cycle.

Parameters:
data - the int array to initialize with the data values.

getFramePeriodData

public void getFramePeriodData(int[] data)
Return the frame period data.

Parameters:
data - the int array to initialize with the data values.

resetLoggingData

public void resetLoggingData()
Reset the performance data to their initial values


Jeospace API

Copyright © 2006 - jeospace.org