com.ibm.ras
Class RASQueue

java.lang.Object
  |
  +--com.ibm.ras.RASQueue
All Implemented Interfaces:
RASIQueue

public class RASQueue
extends java.lang.Object
implements RASIQueue

RASQueue is a buffer for RAS events. If the size of the queue is set to zero, the queue is not limited in capacity (except by the amount of memory installed in the computer). If the size is greater than zero, the queue will hold the specified number of objects.

See Also:
RASIQueue, RASCircularQueue

Constructor Summary
RASQueue()
          Creates a RASQueue, whose size is unbounded.
RASQueue(int size)
          Creates a RASQueue.
 
Method Summary
 java.lang.Object dequeue()
          Removes an object from the beginning of the queue.
 void enqueue(java.lang.Object object)
          Adds an object to the end of the queue.
 java.lang.Object firstObject()
          Returns the first object on the queue, but does not remove it from the queue.
 int getMaximumQueueSize()
          Gets the maximum number of objects which this queue will hold.
 int getQueueSize()
          Gets the current number of objects in this queue.
 boolean isCircular()
          Determines if the queue is circular.
 boolean isEmpty()
          Determines if the queue is empty.
 boolean isFull()
          Determines if the queue is full.
 void requeue(java.lang.Object object)
          Returns an object to the front of the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RASQueue

public RASQueue()
Creates a RASQueue, whose size is unbounded.

RASQueue

public RASQueue(int size)
         throws java.lang.IllegalArgumentException
Creates a RASQueue.
Parameters:
size - The number of objects that can be held in this queue.
Throws:
java.lang.IllegalArgumentException - This exception is thrown if the size parameter is less than zero.
Method Detail

getQueueSize

public int getQueueSize()
Gets the current number of objects in this queue.
Specified by:
getQueueSize in interface RASIQueue
Returns:
The current queue size.

getMaximumQueueSize

public int getMaximumQueueSize()
Gets the maximum number of objects which this queue will hold.
Specified by:
getMaximumQueueSize in interface RASIQueue
Returns:
The maximum queue size.

isEmpty

public boolean isEmpty()
Determines if the queue is empty.
Specified by:
isEmpty in interface RASIQueue
Returns:
true if the queue is empty or false otherwise.

isFull

public boolean isFull()
Determines if the queue is full.
Specified by:
isFull in interface RASIQueue
Returns:
true if the queue is full or false otherwise.

isCircular

public boolean isCircular()
Determines if the queue is circular. A circular queue always accepts new objects. If all slots are full, a new object replaces the oldest object in the queue.
Specified by:
isCircular in interface RASIQueue
Returns:
true if this queue is circular, or false otherwise. This queue always returns false.

enqueue

public void enqueue(java.lang.Object object)
             throws RASQueueFullException
Adds an object to the end of the queue. If the object is null, nothing is enqueued.
Specified by:
enqueue in interface RASIQueue
Parameters:
object - The object to be placed on the queue.
Throws:
RASQueueFullException - This exception is thrown if the queue is full.

dequeue

public java.lang.Object dequeue()
                         throws RASQueueEmptyException
Removes an object from the beginning of the queue.
Specified by:
dequeue in interface RASIQueue
Returns:
The first object in the queue.
Throws:
RASQueueEmptyException - This exception is thrown if the queue is empty.

requeue

public void requeue(java.lang.Object object)
Returns an object to the front of the queue. If the object is null, nothing is enqueued.
Specified by:
requeue in interface RASIQueue
Parameters:
object - The object to be placed on the queue.

firstObject

public java.lang.Object firstObject()
                             throws RASQueueEmptyException
Returns the first object on the queue, but does not remove it from the queue.
Specified by:
firstObject in interface RASIQueue
Returns:
The first object in the queue.
Throws:
RASQueueEmptyException - This exception is thrown if the queue is empty.