Package org.xj3d.impl.core.eventmodel
Class VirtualTimeSensorManager
java.lang.Object
org.xj3d.impl.core.eventmodel.VirtualTimeSensorManager
- All Implemented Interfaces:
VRMLClock,TimeSensorManager
A manager for time sensor nodes that allows application control
of the clock.
- Version:
- $Revision: 1.2 $
- Author:
- Rex Melton
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a time listener to this clock.voidclear()Force clearing all state from this manager now.voidclockTick(long time) Process the event that builds the current time.intReturn the increment for each virtual clock tick in milliseconds.doublegetTime()Request the current time from the system clock.longRequest the time in wall-clock coordinates.voidRemove a time listener to this clock.voidReset the clock to the current time as time zero.voidsetErrorReporter(org.j3d.util.ErrorReporter reporter) Register an error reporter with the engine so that any errors generated by the loading of script code can be reported in a nice, pretty fashion.voidsetTickIncrement(int tickIncrement) Set the increment for each virtual clock tick in milliseconds.voidtick()Adjust the clock by a tick increment
-
Constructor Details
-
VirtualTimeSensorManager
public VirtualTimeSensorManager()Create a new time scheduler behaviour
-
-
Method Details
-
getTime
-
getWallTime
public long getWallTime()Request the time in wall-clock coordinates. This is standard Unix epoch time.- Specified by:
getWallTimein interfaceVRMLClock- Returns:
- The current wall-clock time
-
resetTimeZero
public void resetTimeZero()Reset the clock to the current time as time zero. This can only be called when the timer is not enabled. The last wall clock time is set to now so that fraction information will be correctly oriented for the next time it is enabled called to issue a clock tick.- Specified by:
resetTimeZeroin interfaceVRMLClock
-
addTimeListener
Add a time listener to this clock. Only one instance of each listener will be registered and null references are ignored.- Specified by:
addTimeListenerin interfaceVRMLClock- Parameters:
l- The listener instance to add
-
removeTimeListener
Remove a time listener to this clock. If the listener is not known to this implementation, it is silently ignored.- Specified by:
removeTimeListenerin interfaceVRMLClock- Parameters:
l- The listener instance to add
-
setErrorReporter
public void setErrorReporter(org.j3d.util.ErrorReporter reporter) Register an error reporter with the engine so that any errors generated by the loading of script code can be reported in a nice, pretty fashion. Setting a value of null will clear the currently set reporter. If one is already set, the new value replaces the old.- Specified by:
setErrorReporterin interfaceTimeSensorManager- Parameters:
reporter- The instance to use or null
-
clockTick
public void clockTick(long time) Process the event that builds the current time.- Specified by:
clockTickin interfaceTimeSensorManager- Parameters:
time- The current clock cycle time in milliseconds
-
clear
public void clear()Force clearing all state from this manager now. This is used to indicate that a new world is about to be loaded and everything should be cleaned out now.- Specified by:
clearin interfaceTimeSensorManager
-
tick
public void tick()Adjust the clock by a tick increment -
setTickIncrement
public void setTickIncrement(int tickIncrement) Set the increment for each virtual clock tick in milliseconds.- Parameters:
tickIncrement- The increment for each virtual clock tick.
-
getTickIncrement
public int getTickIncrement()Return the increment for each virtual clock tick in milliseconds.- Returns:
- The increment for each virtual clock tick.
-