public interface DEEventQueue extends Debuggable
DE events are sorted according to their timestamps, microsteps, and then the depths of the destination actors. One DE event is said to be earlier than another, if it has a smaller timestamp, or when the timestamps are identical, it has a smaller microstep, or when both time stamps and microsteps are identical, it has a smaller depth. If all three entries are identical, then these two DE events are called identical.
This interface defines a few methods to manage the event queue, including adding a new event into the queue, getting the earliest event of the queue. A correct implementation of this interface should not allow identical events. In particular, when adding a new event, the event is not added if the event is already in the queue. Also note that calling the get() method does not delete events from event queue but calling the take() method does.
DEEvent
Modifier and Type | Method and Description |
---|---|
void |
clear()
Empty this event queue.
|
DEEvent |
get()
Return the earliest DE event in this event queue.
|
boolean |
isEmpty()
Return true if this event queue is empty.
|
void |
put(DEEvent event)
Enqueue a DE event into the event queue.
|
boolean |
remove(DEEvent event)
Remove an event from the event queue and return true if
it was removed, and false if it was not in the queue.
|
int |
size()
Return the size of the event queue.
|
DEEvent |
take()
Return the earliest DE event in this event queue.
|
java.lang.Object[] |
toArray()
Return the events currently in the queue as an array.
|
addDebugListener, removeDebugListener
void clear()
DEEvent get() throws InvalidStateException
InvalidStateException
- If the event queue is empty.boolean isEmpty()
void put(DEEvent event) throws IllegalActionException
event
- The DE event to be put into the queue.IllegalActionException
- If the event cannot be enqueued.boolean remove(DEEvent event) throws IllegalActionException
event
- The event to enqueue.IllegalActionException
- If the method is not supported.int size()
DEEvent take() throws InvalidStateException
InvalidStateException
- If the queue is empty.java.lang.Object[] toArray()