com.ibm.wbi.util
Class Queue

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.Vector
                    |
                    +--com.ibm.wbi.util.Queue
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.io.Serializable

public class Queue
extends java.util.Vector
implements java.io.Serializable

A simple queuing structure class.

See Also:
Serialized Form

Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Queue()
          Constructs a new empty queue.
 
Method Summary
 boolean empty()
          Determine if the queue is empty.
 java.lang.Object peekFirst()
          Peek at the first object on the queue.
 java.lang.Object peekLast()
          Peek at the last object on the queue.
 java.lang.Object pull()
          "Pull" or remove the first object from the queue.
 void push(java.lang.Object element)
          Push an object on the queue.
 java.lang.Object removeFirst()
          Remove the first object from the queue.
 java.lang.Object removeLast()
          Remove the last object on the queue.
 int search(java.lang.Object element)
          Search for an object on the queue.
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

Queue

public Queue()
Constructs a new empty queue.
Method Detail

empty

public boolean empty()
Determine if the queue is empty.
Returns:
true if empty; false otherwise.

pull

public java.lang.Object pull()
"Pull" or remove the first object from the queue.
Returns:
The first object which was removed.

removeFirst

public java.lang.Object removeFirst()
Remove the first object from the queue.
Returns:
The first object which was removed.

removeLast

public java.lang.Object removeLast()
Remove the last object on the queue.
Returns:
The last object which was removed.

peekFirst

public java.lang.Object peekFirst()
Peek at the first object on the queue.
Returns:
The first object on the queue.

peekLast

public java.lang.Object peekLast()
Peek at the last object on the queue.
Returns:
The last object on the queue.

push

public void push(java.lang.Object element)
Push an object on the queue.
Parameters:
element - The object to push on the front of the queue.

search

public int search(java.lang.Object element)
Search for an object on the queue.
Parameters:
element - The object to search for.
Returns:
The index of the object in the queue or -1 if does not exist.