com.jpeterson.x10.embedded
Class X10Queue

java.lang.Object
  |
  +--com.jpeterson.x10.embedded.X10Queue

public class X10Queue
extends java.lang.Object

Implements a simple FIFO queue. If no queue elements when get is called, method will wait till a put is performed.


Constructor Summary
X10Queue()
          Create a new queue with an initial capacity of 20.
X10Queue(int initCapacity)
          Create a new queue with the specified initial capacity.
 
Method Summary
 java.lang.Object get()
          Get an element from the beginning of the queue.
 void put(java.lang.Object obj)
          Put an element on the end of the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

X10Queue

public X10Queue()
Create a new queue with an initial capacity of 20.

X10Queue

public X10Queue(int initCapacity)
Create a new queue with the specified initial capacity.
Parameters:
initCapactiy - Initial number of free slots in the queue. Will grow to support more elements as needed.
Method Detail

put

public void put(java.lang.Object obj)
Put an element on the end of the queue.
Parameters:
obj - Object to put end of the queue.

get

public java.lang.Object get()
Get an element from the beginning of the queue. If there are no available elements, the method will block for an available element.
Returns:
Returns the element at the beginning of the queue.