public class MetroIIPtidesListEventQueue extends java.lang.Object implements DEEventQueue
This is identical to PtidesListEventQueue except receivers are mapped to MetroIIPtidesReceiver.
Constructor and Description |
---|
MetroIIPtidesListEventQueue()
Constructs an empty event queue.
|
Modifier and Type | Method and Description |
---|---|
void |
addDebugListener(DebugListener listener)
Adds a debugger listen for this event queue.
|
void |
clear()
Clears the event queue.
|
PtidesEvent |
get()
Gets the smallest event from the event queue.
|
PtidesEvent |
get(int index)
Gets the event from the event queue that is pointed by the index.
|
boolean |
isEmpty()
Checks if the event queue is empty.
|
void |
put(DEEvent event)
Puts the event queue into the event queue, and then sort it by timestamp
order.
|
boolean |
remove(DEEvent event)
Throw an exception to indicate that this method is not supported.
|
void |
removeDebugListener(DebugListener listener)
Removes the debugger listen for this event queue.
|
int |
size()
Returns the size of this event queue.
|
PtidesEvent |
take()
Take this event and remove it from the event queue.
|
PtidesEvent |
take(int index)
Takes this event and remove it from the event queue.
|
java.lang.Object[] |
toArray()
Returns an array representation of this event queue.
|
public MetroIIPtidesListEventQueue()
public void clear()
clear
in interface DEEventQueue
public PtidesEvent get() throws InvalidStateException
get
in interface DEEventQueue
InvalidStateException
- if the getFirst() method of the queue throws it.public PtidesEvent get(int index) throws InvalidStateException
index
- an int specifying the index.InvalidStateException
- if get() method of the queue throws it.public boolean isEmpty()
isEmpty
in interface DEEventQueue
public void put(DEEvent event) throws IllegalActionException
put
in interface DEEventQueue
event
- a DEEvent object.IllegalActionException
- if the addFirst() method of the queue throws it.public boolean remove(DEEvent event) throws IllegalActionException
remove
in interface DEEventQueue
event
- The event to enqueue.IllegalActionException
- Always thrown.public int size()
size
in interface DEEventQueue
public PtidesEvent take() throws InvalidStateException
NOTE: this method should only be called once for each event in the event queue, unless the event is not a DEEvent. Because each time this method is called, the token associated with this event is transferred to the receiver. Also, the same event should not be taken out of the event queue and then put into the event queue multiple times.
take
in interface DEEventQueue
InvalidStateException
public PtidesEvent take(int index) throws InvalidStateException
NOTE: this method should only be called once for each event in the event queue, unless the event is not a DEEvent. Because each time this method is called, the token associated with this event is transferred to the receiver. Also, the same event should not be taken out of the event queue and then put into the event queue multiple times.
index
- The index of this event in the event queue.InvalidStateException
public java.lang.Object[] toArray()
toArray
in interface DEEventQueue
public void addDebugListener(DebugListener listener)
addDebugListener
in interface Debuggable
listener
- The listener to which to send debug messages.removeDebugListener(ptolemy.kernel.util.DebugListener)
public void removeDebugListener(DebugListener listener)
removeDebugListener
in interface Debuggable
listener
- The listener to remove from the list of listeners
to which debug messages are sent.addDebugListener(ptolemy.kernel.util.DebugListener)