devutil
Class QueueWaiter

java.lang.Object
  extended bydevutil.QueueWaiter

public class QueueWaiter
extends java.lang.Object


Field Summary
private  Queue[] queues
           
 
Constructor Summary
QueueWaiter(Queue[] queues)
          Creates the array of queues managed by this class.
 
Method Summary
 void add(java.lang.Object item, int index)
          Adds the item to the specified queue.
 boolean areAllEmpty()
          Return true if all queues are empty, false otherwise.
 java.util.Enumeration elements(int index)
           
 Queue[] getQueues()
          Gets back the array of queues.
 boolean isEmpty(int index)
           
 java.lang.Object remove(int index)
          Blocks if the queue is empty.
 int size(int index)
           
 int waitOnElement()
          Blocks until an element shows up in any of the queues.
 void waitUntilEmpty(int index)
          It blocks until the queue is empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

queues

private Queue[] queues
Constructor Detail

QueueWaiter

public QueueWaiter(Queue[] queues)
Creates the array of queues managed by this class.

Method Detail

getQueues

public Queue[] getQueues()
Gets back the array of queues.


remove

public java.lang.Object remove(int index)
Blocks if the queue is empty.


add

public void add(java.lang.Object item,
                int index)
Adds the item to the specified queue.


waitOnElement

public int waitOnElement()
Blocks until an element shows up in any of the queues. Returns the index of the queue where the element showed up, or -1

Returns:
a value of type 'int'

areAllEmpty

public boolean areAllEmpty()
Return true if all queues are empty, false otherwise.


waitUntilEmpty

public void waitUntilEmpty(int index)
It blocks until the queue is empty.


elements

public java.util.Enumeration elements(int index)

isEmpty

public boolean isEmpty(int index)

size

public int size(int index)