rp1.simulator
Class SimTaskQueue

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

public class SimTaskQueue
extends java.lang.Thread

Provides queue of objects of type SimTask; this class is extended by SimScheduler to provide the backbone of the RP1 simulation. When tasks are added to the queue, they are inserted in order of the values of the time and priority fields and insertion sequence. The waitForNextTask method provides a way of getting the next task for processing or waiting until a new task is added. The SimScheduler extends this method by adding a clock-based delay to create an execution schedule for tasks.


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
SimTaskQueue()
           
 
Method Summary
 void add(SimTask newTask)
           
 boolean isTaskOnQueue(SimTask task)
           
 boolean remove(SimTask targetTask)
           
 void removeTasksForOriginator(java.lang.Object originator)
           
 void run()
           
 SimTask waitForNextTask()
           
 
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

SimTaskQueue

public SimTaskQueue()
Method Detail

isTaskOnQueue

public boolean isTaskOnQueue(SimTask task)

add

public void add(SimTask newTask)

waitForNextTask

public SimTask waitForNextTask()

remove

public boolean remove(SimTask targetTask)

removeTasksForOriginator

public void removeTasksForOriginator(java.lang.Object originator)

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread