|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectm865.simulation.Clock
public class Clock
The Clock maintains a priority queue of Events. It also keeps track of the times and can be queried for the current time.
Field Summary | |
---|---|
static int |
IMMEDIATE
The time for any event which must occur immediately. |
protected PriorityQueueAL |
pq
The prority queue for keeping track of the events |
protected int |
time
The current time. |
Constructor Summary | |
---|---|
Clock()
Constructor for the clock. |
Method Summary | |
---|---|
void |
dumpSchedule()
Dumps the schedule. |
boolean |
hasEvent()
Determine if there are more events to be processed. |
Event |
nextEvent()
Gets the next event. |
int |
now()
Gets the current time. |
void |
remove(Event event)
Removes the specified event from the priority queue. |
void |
schedule(Event event)
Place the specified event into the schedule. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int IMMEDIATE
protected PriorityQueueAL pq
protected int time
Constructor Detail |
---|
public Clock()
Method Detail |
---|
public void schedule(Event event)
event
- the Event to be scheduled.public boolean hasEvent()
public Event nextEvent()
public void remove(Event event)
event
- the Event to be removed.public int now()
public void dumpSchedule()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |