|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.AbstractCollection | +--java.util.AbstractList | +--java.util.Vector | +--neosim.implementation.EventListImpl
This class implements an event queue used internally to manage the list of future and deferred Events. It works like a normal FIFO queue, but during insertion events are kept in order from the smallest time stamp to the largest. This means the next event to occur will be at the top of the queue.
The current implementation is uses a Vector to store the queue and is inefficient for popping and inserting elements because the rest of the array has to be moved down one space. A better method would be to use a circular array.
Fields inherited from class java.util.Vector |
capacityIncrement,
elementCount,
elementData |
Fields inherited from class java.util.AbstractList |
modCount |
Constructor Summary | |
EventListImpl()
Allocates a new EventListImpl object. |
|
EventListImpl(int initialCapacity)
Allocates a new EventList object, with an initial capacity. |
Method Summary | |
void |
add(Event new_event)
Add a new event to the queue, preserving the temporal order of the events in the queue. |
java.util.Vector |
getEvents()
Return the vector of events |
boolean |
hasMoreElements()
Returns true if there are any more events in the list |
Event |
pop()
Remove and return the event at the top of the queue. |
Event |
top()
Return the event at the top of the queue, without removing it. |
Methods inherited from class java.util.Vector |
add,
add,
addAll,
addAll,
addElement,
capacity,
clear,
clone,
contains,
containsAll,
copyInto,
elementAt,
elements,
ensureCapacity,
equals,
firstElement,
get,
hashCode,
indexOf,
indexOf,
insertElementAt,
isEmpty,
lastElement,
lastIndexOf,
lastIndexOf,
remove,
remove,
removeAll,
removeAllElements,
removeElement,
removeElementAt,
removeRange,
retainAll,
set,
setElementAt,
setSize,
size,
subList,
toArray,
toArray,
toString,
trimToSize |
Methods inherited from class java.util.AbstractList |
iterator,
listIterator,
listIterator |
Methods inherited from class java.lang.Object |
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public EventListImpl()
public EventListImpl(int initialCapacity)
initialCapacity
- The initial capacity of the queue.Method Detail |
public Event pop()
public Event top()
public void add(Event new_event)
new_event
- The event to be put on the queue.public boolean hasMoreElements()
public java.util.Vector getEvents()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |