gov.nasa.arc.brahms.vm.api.components
Interface IClock


public interface IClock

The IClock interface is the interface to the simulation clock maintaining the base date and time of the simulation used relative to the event times. The event times start at the start of the simulation at 0, this is the simulated time. The simulated time is increased by the virtual machine's scheduler. The simulated time is 0 based and is not corrected for the time unit. To get the actual time of the event you need to get the base time and add the event time times the time unit. The time unit specifies how many seconds each simulated unit represents. If for an activity in a model is specified that the duration is 5 simulation units and the time unit is 1 second (default), then the actual duration of the activity is 5 seconds. If the time unit is 20 seconds then the actual duration of the activity would be 100 seconds.

Version:
12 September 2000
Author:
Ron van Hoof

Method Summary
 void addClockListener(IClockListener listener)
          Adds the specified clock listener as a listener for value changes in the clock.
 long getActualTime()
          Returns the actual simulated date and time.
 java.util.Calendar getBase()
          Returns the base date and time of the clock.
 long getSimulatedTime()
          Returns the current simulated time.
 long getTimeUnit()
          Returns the time unit in seconds set for the virtual machine.
 void removeClockListener(IClockListener listener)
          Removes the specified clock listener as a listener for value changes in the clock.
 

Method Detail

getBase

java.util.Calendar getBase()
Returns the base date and time of the clock. This is the date and time representing the actual start of the simulation. All events generated in the virtual machine are relative to this base time.

Returns:
Calendar the start date and time of the simulation

getTimeUnit

long getTimeUnit()
Returns the time unit in seconds set for the virtual machine. The time unit is the time in seconds represented by each unit of simulated time.

Returns:
long time unit in seconds

getSimulatedTime

long getSimulatedTime()
Returns the current simulated time. The simulated time is zero based relative to the base date and time. The simulated time returns simulation units and does not represent actual time in seconds. To get the simulated time in seconds the simulated time must be multiplied by the time unit.

Returns:
long the simulated time in simulation units
See Also:
getTimeUnit()

getActualTime

long getActualTime()
Returns the actual simulated date and time. The actual date and time is the base date and time plus the simulated time multiplied with the time-unit.

Returns:
long the actual date and time in milliseconds
See Also:
getSimulatedTime(), getTimeUnit()

addClockListener

void addClockListener(IClockListener listener)
Adds the specified clock listener as a listener for value changes in the clock.

Parameters:
listener - the IClockListener to be registered.

removeClockListener

void removeClockListener(IClockListener listener)
Removes the specified clock listener as a listener for value changes in the clock.

Parameters:
listener - the IClockListener to be unregistered.


Copyright © 1997-2012 All Rights Reserved.