uk.ac.man.cs.rainbow.simulator
Class Simulator.Timer
java.lang.Object
|
+--uk.ac.man.cs.rainbow.simulator.Simulator.Timer
- All Implemented Interfaces:
- Serializable
- Enclosing class:
- Simulator
- protected static final class Simulator.Timer
- extends Object
- implements Serializable
Queue of thread sets ordered by time.
- See Also:
- Serialized Form
Method Summary |
protected void |
add(RainbowThread thread,
long wakeuptime)
Add a thread to the bucket with the given wakeup time. |
protected ThreadSet |
getThreads()
Get the set of threads that are waiting at the earliest time in
the queue. |
protected long |
getTime()
Get the time that the threads at the head of the chain are
waiting until. |
protected boolean |
isEmpty()
Test if there are no sets of threads at any time. |
protected boolean |
isPresent(RainbowThread thread)
Test if the given thread is present in any of the sets in the
queue. |
protected long |
remove(RainbowThread thread)
Remove the given thread from whichever set it was stored in,
and return the time it was waiting at. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Simulator.Timer
protected Simulator.Timer()
add
protected void add(RainbowThread thread,
long wakeuptime)
- Add a thread to the bucket with the given wakeup time. Will
create a new bucket if needed.
isEmpty
protected boolean isEmpty()
- Test if there are no sets of threads at any time.
getTime
protected long getTime()
- Get the time that the threads at the head of the chain are
waiting until.
getThreads
protected ThreadSet getThreads()
- Get the set of threads that are waiting at the earliest time in
the queue.
isPresent
protected boolean isPresent(RainbowThread thread)
- Test if the given thread is present in any of the sets in the
queue.
remove
protected long remove(RainbowThread thread)
- Remove the given thread from whichever set it was stored in,
and return the time it was waiting at.
- Returns:
- The time the thread was waiting at, or Long.MIN_VALUE if it
was not present anywhere in the list.