ix.isim
Class ISimTimerServer

java.lang.Object
  extended by ix.isim.ISimTimer
      extended by ix.isim.ISimTimerServer

public class ISimTimerServer
extends ISimTimer


Nested Class Summary
 
Nested classes/interfaces inherited from class ix.isim.ISimTimer
ISimTimer.UpdateTimeDisplayThread
 
Field Summary
 
Fields inherited from class ix.isim.ISimTimer
ACCELERATE, owner, PAUSE, REGISTER, RESUME, simTimeDisplay, simulationActive, START, STOP, SYNCHRONIZE_LABEL, tUpdater
 
Constructor Summary
protected ISimTimerServer(IXAgent agent)
           
 
Method Summary
 long changeAccelerationFactor(double acceleration)
          This function changes the time acceleration factor to the given value.
 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.
 void registerAgent(java.lang.String agentName)
           
 long resume()
          This function re-starts the simulation timer after it had been paused.
 void sendAccelerateActivity(double factor)
           
 void sendPauseActivity(long simTime)
           
 void sendResumeActivity(long simTime)
           
 void sendStartActivity(long simTime, double factor)
           
 void sendStopActivity()
           
 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 ix.isim.ISimTimer
getAccelerationFactor, getISimTimer, getSimTimeInMillis, setCurrentSimTime, simulationStarted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ISimTimerServer

protected ISimTimerServer(IXAgent agent)
Method Detail

start

public void start(long simTime,
                  double factor)
           throws ISimTimerException
Description copied from class: ISimTimer
This function starts the simulation clock. The simulation time will be set to the given time and simulated time will progress with the given acceleration factor. It also shows the frame displaying current sim-time if it isn't already showing.

Overrides:
start in class ISimTimer
Parameters:
simTime - initial value of the simulated time
factor - acceleration factor for simulated time
Throws:
ISimTimerException - if this function has been called before

pause

public long pause()
Description copied from class: ISimTimer
This function pauses this simulation timer, be it a Server or Client. As a result simulationActive will be false and the display will show it is paused. However, the time update thread will continue to run.

Overrides:
pause in class ISimTimer
Returns:
long the simulation time when the simulation was paused

resume

public long resume()
Description copied from class: ISimTimer
This function re-starts the simulation timer after it had been paused. As a result simulationActive will be true and the display will show that it is running.

Overrides:
resume in class ISimTimer
Returns:
long the simulation time when the simulation was resumed

changeAccelerationFactor

public long changeAccelerationFactor(double acceleration)
Description copied from class: ISimTimer
This function changes the time acceleration factor to the given value.

Overrides:
changeAccelerationFactor in class ISimTimer
Parameters:
acceleration - double the new acceleration factor
Returns:
long the simulation time when the acceleration factor was changed

terminateTimer

public void terminateTimer()
Description copied from class: ISimTimer
This function should be called terminate this Timer. It will gracefully terminate the update thread for the display.

Overrides:
terminateTimer in class ISimTimer

handleSynchronizeActivity

public void handleSynchronizeActivity(Activity synchActivity)
Description copied from class: ISimTimer
This function needs to be implemented by the inheriting class. This is because the two types of ISimTimer, ISimTimerClient and ISimTimerServer, behave differently with respect to synchronization. Having it abstract ensures that no ISimTimer can ever be constructed.

Specified by:
handleSynchronizeActivity in class ISimTimer
Parameters:
synchActivity - a synchronization Activity (see final Strings in this class for possible activities)

registerAgent

public void registerAgent(java.lang.String agentName)

sendStartActivity

public void sendStartActivity(long simTime,
                              double factor)

sendPauseActivity

public void sendPauseActivity(long simTime)

sendResumeActivity

public void sendResumeActivity(long simTime)

sendAccelerateActivity

public void sendAccelerateActivity(double factor)

sendStopActivity

public void sendStopActivity()