magi.toolkit.util.queue
Interface Queue

All Known Implementing Classes:
FIFOQueue, LIFOQueue, Stack

public interface Queue

An interface contract for a Queue object.

Author:
Paul Atkinson, Magi Systems Pty Ltd.
See Also:
FIFOQueue

Method Summary
 boolean isEmpty()
          Returns true if the queue currently contains no elements.
 java.lang.Object peek()
          Peek at the next Object available in the queue.
 java.lang.Object[] peekAll()
          Peek at all Objects available in the queue, in the correct queueing order.
 java.lang.Object pop()
          Pops an Object off the queue.
 java.lang.Object[] popAll()
          Pops all Objects off the queue, in the correct queueing order.
 void push(java.lang.Object object)
          Pushes an Object into the queue.
 void pushAll(java.lang.Object[] object)
          Pushes an array of Objects into the queue.
 void remove(java.lang.Object object)
          Removes an Object directly from this queue, regardless of its current position in the queue.
 int size()
          Returns the number of Objects currently in the queue.
 

Method Detail

push

public void push(java.lang.Object object)
Pushes an Object into the queue.

Parameters:
object - the Object to insert.

pushAll

public void pushAll(java.lang.Object[] object)
Pushes an array of Objects into the queue. The elements are queued from left to right, where element 0 is queued first, element 1 is queued next, and so on.

Parameters:
object - the Object array to queue up.

pop

public java.lang.Object pop()
Pops an Object off the queue.

Returns:
the Object removed from the queue.

popAll

public java.lang.Object[] popAll()
Pops all Objects off the queue, in the correct queueing order. This means that the next object due to be popped is element 0, and the next is element 1, and so on.

Returns:
the Object array removed from the queue.

peek

public java.lang.Object peek()
Peek at the next Object available in the queue. This method does NOT remove the Object from the queue.

Returns:
the Object that is next in the queue.

peekAll

public java.lang.Object[] peekAll()
Peek at all Objects available in the queue, in the correct queueing order. This means that the next object due to be popped is element 0, and the next is element 1, and so on. This method does NOT remove any Objects from the queue.

Returns:
the Object array in the queue.

size

public int size()
Returns the number of Objects currently in the queue.

Returns:
the int size of the queue collection.

isEmpty

public boolean isEmpty()
Returns true if the queue currently contains no elements.

Returns:
true if empty, false if not.

remove

public void remove(java.lang.Object object)
Removes an Object directly from this queue, regardless of its current position in the queue.

Parameters:
object - the Object to remove.