All Packages Class Hierarchy This Package Previous Next Index
Class eduni.simjava.Evqueue
java.lang.Object
|
+----java.util.Vector
|
+----eduni.simjava.Evqueue
- public class Evqueue
- extends Vector
This class implements an event queue used internally by the Sim_system to
manage
the list of future and deferred Sim_events. It should not be needed in
a user simulation. 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.
- See Also:
- Sim_system
-
Evqueue()
- Allocates a new Evqueue object.
-
Evqueue(int)
- Allocates a new Evqueue object, with an initial capacity.
-
add(Sim_event)
- Add a new event to the queue, preserving the temporal order of the
events in the queue.
-
pop()
- Remove and return the event at the top of the queue.
-
top()
- Return the event at the top of the queue, without removing it.
Evqueue
public Evqueue()
- Allocates a new Evqueue object.
Evqueue
public Evqueue(int initialCapacity)
- Allocates a new Evqueue object, with an initial capacity.
- Parameters:
- initialCapacity - The initial capacity of the queue.
pop
public Sim_event pop()
- Remove and return the event at the top of the queue.
- Returns:
- The next event.
top
public Sim_event top()
- Return the event at the top of the queue, without removing it.
- Returns:
- The next event.
add
public void add(Sim_event new_event)
- Add a new event to the queue, preserving the temporal order of the
events in the queue.
- Parameters:
- new_event - The event to be put on the queue.
All Packages Class Hierarchy This Package Previous Next Index