public class RASCircularQueue extends java.lang.Object implements RASIQueue
RASCircularQueue
is a circular queue for RAS events.
When the queue fills, the next RAS event replaces the oldest event
already in the queue.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_QUEUE_SIZE
Deprecated.
The default queue size (10,000).
|
Constructor and Description |
---|
RASCircularQueue()
Deprecated.
Creates a
RASCircularQueue , whose size is defined by
DEFAULT_QUEUE_SIZE . |
RASCircularQueue(int size)
Deprecated.
Creates a
RASCircularQueue . |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
dequeue()
Deprecated.
Removes an object from the beginning of the queue.
|
void |
enqueue(java.lang.Object object)
Deprecated.
Adds an object to the end of the queue.
|
java.lang.Object |
firstObject()
Deprecated.
Returns the first object on the queue, but does not remove it from
the queue.
|
int |
getMaximumQueueSize()
Deprecated.
Gets the maximum number of objects which this queue will hold.
|
int |
getQueueSize()
Deprecated.
Gets the current number of objects in this queue.
|
boolean |
isCircular()
Deprecated.
Determines if the queue is circular.
|
boolean |
isEmpty()
Deprecated.
Determines if the queue is empty.
|
boolean |
isFull()
Deprecated.
Determines if the queue is full.
|
void |
requeue(java.lang.Object object)
Deprecated.
Returns an object to the front of the queue.
|
public static final int DEFAULT_QUEUE_SIZE
public RASCircularQueue()
RASCircularQueue
, whose size is defined by
DEFAULT_QUEUE_SIZE
.public RASCircularQueue(int size) throws java.lang.IllegalArgumentException
RASCircularQueue
.size
- The number of objects that this queue can hold. If the
size is zero, the queue size is set to
DEFAULT_QUEUE_SIZE
.java.lang.IllegalArgumentException
- This exception is thrown if the size parameter is less than zero.public int getQueueSize()
getQueueSize
in interface RASIQueue
public int getMaximumQueueSize()
getMaximumQueueSize
in interface RASIQueue
public boolean isEmpty()
public boolean isFull()
public boolean isCircular()
isCircular
in interface RASIQueue
true
if this queue is circular, or false
otherwise. (This queue always returns true
.)public void enqueue(java.lang.Object object) throws RASQueueFullException
null
, nothing is enqueued.enqueue
in interface RASIQueue
object
- The object to be placed on the queue.RASQueueFullException
- This exception is thrown if the queue is full.public java.lang.Object dequeue() throws RASQueueEmptyException
dequeue
in interface RASIQueue
RASQueueEmptyException
- This exception is thrown if the queue is empty.public void requeue(java.lang.Object object) throws java.lang.IllegalStateException
null
, nothing is enqueued.requeue
in interface RASIQueue
object
- The object to be placed on the queue.java.lang.IllegalStateException
- This exception is always thrown because there is no way to reliably
add an object to the beginning of a circular queue if objects
are added and removed via enqueue
and dequeue
.
See RASQueue.requeue
.public java.lang.Object firstObject() throws RASQueueEmptyException
firstObject
in interface RASIQueue
RASQueueEmptyException
- This exception is thrown if the queue is empty.