rp1.simulator
Class SimScheduler

java.lang.Object
  extended by java.lang.Thread
      extended by rp1.simulator.SimTaskQueue
          extended by rp1.simulator.SimScheduler
All Implemented Interfaces:
java.lang.Runnable

public class SimScheduler
extends SimTaskQueue

A time-driven task queue that provides the backbone of the RP1 simulator; this class extends SimTaskQueue by adding clock-driven delays between sunsequent tasks so that they are executed according to a time sequence. It does this by overloading the waitForNextTask from SimTaskQueue. In SimTaskQueue, waitForNextTask returns a task as soon as one is available. In SimScheduler, it waits until the next task in the queue is scheduled for processing. Note that sometimes tasks with a startTime value of zero meaning "for immediate execution." Such tasks will cause the waitForNextTask method to return control to the calling application without delay.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SimScheduler()
           
 
Method Summary
 void addTaskAtUpdatedSimTime(double offset, SimTask task)
           
 void addTaskAtUpdatedSimTime(SimTask task)
           
 void addTaskForImmediateProcessing(SimTask task)
           
 double getSimSpeed()
           
 double getSimTime()
           
 double getUpdatedSimTime()
           
 void setSimSpeed(double newSpeed)
           
 void startClock()
           
 void stopClock()
           
 SimTask waitForNextTask()
           
 
Methods inherited from class rp1.simulator.SimTaskQueue
add, isTaskOnQueue, remove, removeTasksForOriginator, run
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimScheduler

public SimScheduler()
Method Detail

setSimSpeed

public void setSimSpeed(double newSpeed)

startClock

public void startClock()

stopClock

public void stopClock()

getSimSpeed

public double getSimSpeed()

getSimTime

public double getSimTime()

getUpdatedSimTime

public double getUpdatedSimTime()

waitForNextTask

public SimTask waitForNextTask()
Overrides:
waitForNextTask in class SimTaskQueue

addTaskAtUpdatedSimTime

public void addTaskAtUpdatedSimTime(SimTask task)

addTaskAtUpdatedSimTime

public void addTaskAtUpdatedSimTime(double offset,
                                    SimTask task)

addTaskForImmediateProcessing

public void addTaskForImmediateProcessing(SimTask task)