org.xwt.util
Class Queue

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

public class Queue
extends java.lang.Object

A simple synchronized queue, implemented as an array


Constructor Summary
Queue(int initiallength)
           
 
Method Summary
 void append(java.lang.Object o)
          Add an element to the back of the queue
 void flush()
          Empties the queue
 java.lang.Object peek()
          Returns the top element in the queue without removing it
 void prepend(java.lang.Object o)
          Add an element to the front of the queue
 java.lang.Object remove()
          Remove and return and element from the queue, blocking if empty.
 java.lang.Object remove(boolean block)
          Remove and return an element from the queue, blocking if block is true and the queue is empty.
 int size()
          The number of elements in the queue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Queue

public Queue(int initiallength)
Method Detail

size

public int size()
The number of elements in the queue


flush

public void flush()
Empties the queue


prepend

public void prepend(java.lang.Object o)
Add an element to the front of the queue


append

public void append(java.lang.Object o)
Add an element to the back of the queue


remove

public java.lang.Object remove()
Remove and return and element from the queue, blocking if empty.


remove

public java.lang.Object remove(boolean block)
Remove and return an element from the queue, blocking if block is true and the queue is empty.


peek

public java.lang.Object peek()
Returns the top element in the queue without removing it