|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ix.isim.ISimTimer
public abstract class ISimTimer
An ISimTimer is a device for keeping track of simualted time. There are two sub-classes here that can be used:
The sole constructor of this class is protected and the static method getISimTimer(...) should be used to obtain the right kind of ISimTimer for the given agent type.
Nested Class Summary | |
---|---|
(package private) class |
ISimTimer.UpdateTimeDisplayThread
This Thread is used to update the displayed time on a regular basis. |
Field Summary | |
---|---|
protected java.lang.String |
ACCELERATE
|
protected IXAgent |
owner
the IXAgent to which this timer belongs |
protected java.lang.String |
PAUSE
|
protected java.lang.String |
REGISTER
|
protected java.lang.String |
RESUME
|
protected ISimTimeFrame |
simTimeDisplay
the frame displaying the simuation time |
protected boolean |
simulationActive
indicates whether simulation time is currently passing |
protected java.lang.String |
START
|
protected java.lang.String |
STOP
|
protected Symbol |
SYNCHRONIZE_LABEL
some command strings used for the synchronization of multiple ISimTimers |
protected ISimTimer.UpdateTimeDisplayThread |
tUpdater
the Thread used for updating the display |
Constructor Summary | |
---|---|
protected |
ISimTimer(IXAgent agent)
Protected constructor for use by sub-classes. |
Method Summary | |
---|---|
long |
changeAccelerationFactor(double acceleration)
This function changes the time acceleration factor to the given value. |
double |
getAccelerationFactor()
Returns the currently used time acceleration factor |
static ISimTimer |
getISimTimer(IXAgent agent)
Factory for getting the right kind of timer for this agent. |
long |
getSimTimeInMillis()
This function returns the current time in the simulation. |
abstract void |
handleSynchronizeActivity(Activity synchActivity)
This function needs to be implemented by the inheriting class. |
long |
pause()
This function pauses this simulation timer, be it a Server or Client. |
long |
resume()
This function re-starts the simulation timer after it had been paused. |
protected void |
setCurrentSimTime(long time)
|
boolean |
simulationStarted()
Returns whether the start function has been called. |
void |
start(long simTime,
double factor)
This function starts the simulation clock. |
void |
terminateTimer()
This function should be called terminate this Timer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Symbol SYNCHRONIZE_LABEL
protected final java.lang.String START
protected final java.lang.String PAUSE
protected final java.lang.String RESUME
protected final java.lang.String ACCELERATE
protected final java.lang.String STOP
protected final java.lang.String REGISTER
protected IXAgent owner
protected boolean simulationActive
protected ISimTimeFrame simTimeDisplay
protected ISimTimer.UpdateTimeDisplayThread tUpdater
Constructor Detail |
---|
protected ISimTimer(IXAgent agent)
agent
- IXAgent owner of this timerMethod Detail |
---|
public abstract void handleSynchronizeActivity(Activity synchActivity)
synchActivity
- a synchronization Activity (see final Strings in
this class for possible activities)public boolean simulationStarted()
public long getSimTimeInMillis()
public double getAccelerationFactor()
public void start(long simTime, double factor) throws ISimTimerException
simTime
- initial value of the simulated timefactor
- acceleration factor for simulated time
ISimTimerException
- if this function has been called beforepublic long pause()
public long resume()
public long changeAccelerationFactor(double acceleration)
acceleration
- double the new acceleration factor
public void terminateTimer()
protected void setCurrentSimTime(long time)
public static ISimTimer getISimTimer(IXAgent agent)
agent
- IXAgent owner of this timer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |