|
Jeospace API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jeospace.simulation.Chronometer
A virtual clock used to control the setting and passage of time independent of the system clock. There are four primary properties that are managed by the Chronometer.
ChronPeriod
for each chronometer tick( )The are two primary modes in which the Chronometer functions.
RUN,
STOP, STEP), direction (FORWARD,
BACKWARD) and rate (ChronPeriod). If the rate is
set to null, the Chronometer will pass time at a rate
equivalent to the passage of time by the system clock.
The Chronometer's time is updated in response to it's tick( )
method being called. Typically a manager thread running on a periodic
timer will call the Chronometer's tick( ) method and then
schedule the execution of application threads that are dependant upon the
Chronometer's virtual time.
Date,
Calendar,
ChronDirection,
ChronPeriod,
ChronState,
TimeUnit| Constructor Summary | |
Chronometer()
Constructor for a Chronometer that tracks system time. |
|
Chronometer(java.util.Calendar calendar)
Constructor for a Chronometer that is set to the specified time. |
|
Chronometer(java.util.Date date)
Constructor for a Chronometer that is set to the specified time. |
|
Chronometer(double julianDay)
Constructor for a Chronometer that is set to the specified time. |
|
Chronometer(long millisFromTheEpoch)
Constructor for a Chronometer that is set to the specified time. |
|
| Method Summary | |
void |
addChronListener(ChronListener csl)
Add a listener for ChronEvents |
protected void |
fireChronEvent(int id)
Send a ChronEvent to all registered listeners |
java.util.Calendar |
getCalendar()
Return the Chronometer's time in a Calendar object |
void |
getCalendar(java.util.Calendar c)
Return the Chronometer's time in a Calendar object |
ChronPeriod |
getChronRate()
Return the aggregate chron rate. |
java.util.Date |
getDate()
Return the Chronometer's time in a Date object |
void |
getDate(java.util.Date d)
Return the Chronometer's time in a Date object |
ChronDirection |
getDirection()
Return the value indicating the direction of time flow of the Chronometer. |
double |
getJulianDay()
Return the Chronometer's time as a Julian Day. |
ChronState |
getState()
Return the value indicating the run state of the Chronometer. |
long |
getTimeInMillis()
Return the Chronometer's time in milliseconds from the epoch. |
boolean |
isTrackingSystemTime()
Return the flag indicating whether the Chronometer is reflecting system time. |
void |
removeChronListener(ChronListener csl)
Remove a listener for ChronEvents |
void |
set(java.util.Calendar calendar)
Set the Chronometer's time to mirror the argument Calendar. |
void |
set(java.util.Date date)
Set the Chronometer's time to mirror the argument Date. |
void |
set(double julianDay)
Set the Chronometer's time to mirror the argument Julian Day. |
void |
set(long millisFromTheEpoch)
Set the Chronometer's time to mirror the argument. |
void |
setChronRate(ChronPeriod rate)
Set the aggregate chron rate. |
void |
setDirection(ChronDirection directionValue)
Set the direction of time flow of the Chronometer. |
void |
setState(ChronState stateValue)
Set the run state of the Chronometer. |
void |
setStateAndDirection(ChronState stateValue,
ChronDirection directionValue)
Set the run state and direction of time flow of the Chronometer. |
void |
setToTrackSystemTime()
Set the Chronometer to reflect system time. |
void |
tick()
Perform the processing to update the Chronometer to it's next time and state. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Chronometer()
Chronometer that tracks system time.
public Chronometer(long millisFromTheEpoch)
Chronometer that is set to the specified time.
millisFromTheEpoch - the long number of milliseconds
that have elapsed since the system epoch.public Chronometer(java.util.Date date)
Chronometer that is set to the specified time.
date - the Date object specifying the chronometer time.public Chronometer(java.util.Calendar calendar)
Chronometer that is set to the specified time.
calendar - the Calendar object specifying the chronometer time.public Chronometer(double julianDay)
Chronometer that is set to the specified time.
julianDay - the Julian Day specifying the chronometer time.| Method Detail |
public long getTimeInMillis()
long representation of the Chronometer's time
in milliseconds from the epoch.public double getJulianDay()
double representation of the Chronometer's time
as a Julian Day.public java.util.Date getDate()
Date object
Date object initialized with the Chronometer's time.public void getDate(java.util.Date d)
Date object
d - the Date object to initialize.public java.util.Calendar getCalendar()
Calendar object
Calendar object initialized with the Chronometer's time.public void getCalendar(java.util.Calendar c)
Calendar object
c - the Calendar object to initialize.public void addChronListener(ChronListener csl)
ChronEvents
csl - the listenerpublic void removeChronListener(ChronListener csl)
ChronEvents
csl - the listenerprotected void fireChronEvent(int id)
ChronEvent to all registered listeners
id - the ChronEvent id to sendpublic boolean isTrackingSystemTime()
true if the Chronometer is reflecting system time,
false if not.public void setToTrackSystemTime()
public void set(long millisFromTheEpoch)
millisFromTheEpoch - the long representation of the time
in milliseconds from the system epoch to set.public void set(java.util.Date date)
Date.
date - the Date representation of the time to set.public void set(java.util.Calendar calendar)
Calendar.
calendar - the Calendar representation of the time to set.public void set(double julianDay)
julianDay - the Julian Day representation of the time to set.public ChronState getState()
ChronState.RUN, ChronState.STOP or ChronState.STEP.
public void setState(ChronState stateValue)
stateValue - the value for the state parameter. Legal values are:
ChronState.RUN, ChronState.STOP or ChronState.STEP
IllegalArgumentException - for any non-legal argument value.public ChronDirection getDirection()
ChronDirection.FORWARD or ChronDirection.BACKWARD.
public void setDirection(ChronDirection directionValue)
directionValue - the value for the direction parameter. Legal values are:
ChronDirection.FORWARD or ChronDirection.BACKWARD
IllegalArgumentException - for any non-legal (null)
argument value.
public void setStateAndDirection(ChronState stateValue,
ChronDirection directionValue)
stateValue - the value for the state parameter. Legal values are:
ChronState.RUN, ChronState.STOP or ChronState.STEPdirectionValue - the value for the direction parameter. Legal values are:
ChronDirection.FORWARD or ChronDirection.BACKWARD
IllegalArgumentException - for any non-legal argument value.public ChronPeriod getChronRate()
public void setChronRate(ChronPeriod rate)
rate - the aggregate chron rate.public void tick()
|
Jeospace API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||