netcom.util
Class SQueue

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.Vector
              extended bynetcom.util.SQueue
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.util.RandomAccess, java.io.Serializable

public class SQueue
extends java.util.Vector

implements a FIFO queue of Objects

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
SQueue()
          Creates new Queue
SQueue(int preload)
           
 
Method Summary
 java.lang.Object dequeue()
          Remove object from the head of the queue
 java.lang.Object dequeueOrWait(long timeout)
          Remove object from the head of the queue.
 void enqueue(java.lang.Object obj)
          Add object to the tail of the queue
 boolean isQueueEmpty()
          test if queue has elements
 java.lang.Object peek()
          Get object reference from the head of the queue without dequeueing it
 void scan(netcom.util.SQueue.Scanner scanner)
          lock and scan 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

SQueue

public SQueue()
Creates new Queue


SQueue

public SQueue(int preload)
Method Detail

enqueue

public void enqueue(java.lang.Object obj)
Add object to the tail of the queue

Parameters:
obj - object being added

dequeue

public java.lang.Object dequeue()
Remove object from the head of the queue

Returns:
removed object

peek

public java.lang.Object peek()
Get object reference from the head of the queue without dequeueing it

Returns:
object or null

dequeueOrWait

public java.lang.Object dequeueOrWait(long timeout)
Remove object from the head of the queue. If there are no objects in the queue, then wait until notified or until the timeout expires

Parameters:
timeout - the timeout in milliseconds
Returns:
removed object

isQueueEmpty

public boolean isQueueEmpty()
test if queue has elements

Returns:
true if queue is empty

scan

public void scan(netcom.util.SQueue.Scanner scanner)
lock and scan queue. If scanner returns true, the element is deleted