org.vrspace.util
Class Queue

java.lang.Object
  extended byorg.vrspace.util.Queue

public class Queue
extends java.lang.Object

Synchronized FIFO Queue


Nested Class Summary
 class Queue.QueueIterator
           
 
Constructor Summary
Queue()
           
 
Method Summary
 void add(java.lang.Object o)
          add new object to the queue
 java.lang.Object elementAt(int pos)
          Returns element at specified position in the queue
 boolean isEmpty()
          queue empty?
 Queue.QueueIterator iterator()
           
static void main(java.lang.String[] args)
           
 java.lang.Object peek()
          returns the next object from the queue, null if queue has no elements
 java.lang.Object remove()
          returns the next object and removes it from the queue, null for empty queue
 void removeElement(java.lang.Object o)
          removes object from the queue
 java.lang.Object removeElementAt(int pos)
          Removes element at specified position in the queue
 int size()
          returns queue size
 java.lang.Object[] toArray()
          Returns array containing queue elements
 java.lang.Object[] toArray(java.lang.Object[] array)
          Stores queue elements to the array.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Queue

public Queue()
Method Detail

toArray

public java.lang.Object[] toArray()
Returns array containing queue elements


toArray

public java.lang.Object[] toArray(java.lang.Object[] array)
Stores queue elements to the array.

Returns:
the same array
Throws:
java.lang.ArrayIndexOutOfBoundsException - if array has wrong size.

add

public void add(java.lang.Object o)
add new object to the queue


peek

public java.lang.Object peek()
returns the next object from the queue, null if queue has no elements


remove

public java.lang.Object remove()
returns the next object and removes it from the queue, null for empty queue


elementAt

public java.lang.Object elementAt(int pos)
Returns element at specified position in the queue


removeElementAt

public java.lang.Object removeElementAt(int pos)
Removes element at specified position in the queue

Returns:
removed element

removeElement

public void removeElement(java.lang.Object o)
removes object from the queue


isEmpty

public boolean isEmpty()
queue empty?


size

public int size()
returns queue size


toString

public java.lang.String toString()

iterator

public Queue.QueueIterator iterator()

main

public static void main(java.lang.String[] args)