|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object EventQueue
public class EventQueue
EventQueue It's called an event "queue," but it's not really. Instead, it's a list (could be an array, could be a linked list) that always keeps its elements in time sorted order. When you get the nextEvent, you KNOW that it's the one with the lowest time in the EventQueue
Constructor Summary | |
---|---|
EventQueue()
No argument constructor |
Method Summary | |
---|---|
void |
add(SimEvent myEvent)
Add the event. |
boolean |
empty()
Check if the queue is empty |
void |
insertInOrder(SimEvent thisEvent)
Add the new element into the linked list of elements, assuming that it's already in order. |
SimEvent |
peek()
see the first element but don't remove it |
SimEvent |
pop()
remove the top element from the queue and return it. |
int |
size()
Return the number of elements in the queue |
void |
sort()
Sort the events in the linked list using an insertion sort |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EventQueue()
Method Detail |
---|
public void add(SimEvent myEvent)
myEvent
- the event to addpublic SimEvent peek()
public SimEvent pop()
public int size()
public boolean empty()
public void insertInOrder(SimEvent thisEvent)
thisEvent
- the one to addpublic void sort()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |