public class DECQEventQueue extends java.lang.Object implements DEEventQueue
DEEventQueue
for more explanation of the order of DE events.
Its complexity is theoretically O(1) for both enqueue and dequeue
operations, assuming a reasonable distribution of timestamps. See
CalendarQueue
.
Green (hyzheng) |
Green (hyzheng) |
Constructor and Description |
---|
DECQEventQueue()
Construct an empty event queue.
|
DECQEventQueue(int minBinCount,
int binCountFactor,
boolean isAdaptive)
Construct an empty event queue with the specified parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
addDebugListener(DebugListener listener)
Append a listener to the current set of debug listeners.
|
void |
clear()
Empty the event queue.
|
DEEvent |
get()
Return the earliest DE event in the queue without removing it
from the queue.
|
boolean |
isEmpty()
Return true if this event queue is empty.
|
void |
put(DEEvent event)
Put an 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.
|
void |
removeDebugListener(DebugListener listener)
Unregister a debug listener.
|
int |
size()
Return the size of the event queue.
|
DEEvent |
take()
Dequeue the earliest DE event in this event queue.
|
java.lang.Object[] |
toArray()
Return the events currently in the queue as an array.
|
java.lang.String |
toString()
Describe the Contents of the queue as a string.
|
public DECQEventQueue()
public DECQEventQueue(int minBinCount, int binCountFactor, boolean isAdaptive)
minBinCount
- The minimum number of bins.binCountFactor
- The factor when changing the bin count.isAdaptive
- If the queue changes its number of bins at run time.public void addDebugListener(DebugListener listener)
addDebugListener
in interface Debuggable
listener
- A listener to which to send debug messages.removeDebugListener(DebugListener)
public void clear()
clear
in interface DEEventQueue
public final DEEvent get()
get
in interface DEEventQueue
InvalidStateException
- If the queue is empty.public final boolean isEmpty()
isEmpty
in interface DEEventQueue
public final void put(DEEvent event)
put
in interface DEEventQueue
event
- The event to enqueue.public final boolean remove(DEEvent event)
remove
in interface DEEventQueue
event
- The event to enqueue.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(DebugListener)
public final int size()
size
in interface DEEventQueue
public final DEEvent take()
take
in interface DEEventQueue
InvalidStateException
- If the queue is empty.public final java.lang.Object[] toArray()
toArray
in interface DEEventQueue
public java.lang.String toString()
toString
in class java.lang.Object