net.kwfgrid.gwes.util
Class Queue

java.lang.Object
  extended by net.kwfgrid.gwes.util.Queue

public class Queue
extends Object

Code modified from Data Structures & Problem Solving Using Java by Mark Allen Weiss, 1998.

Version:
$Id: Queue.java 1433 2010-11-29 18:06:07Z hoheisel $
Author:
Andreas Hoheisel (www.andreas-hoheisel.de)

Field Summary
 Object enqueueSync
           
 Object isEmptySync
           
 
Constructor Summary
Queue()
          Construct the queue.
 
Method Summary
 Object dequeue()
          Return and remove the least recently inserted item from the queue.
 void enqueue(Object x)
          Insert a new item into the queue.
 int getCurrentSize()
          Get the current size of the queue
 Object getFront()
          Get the least recently inserted item in the queue.
 boolean isEmpty()
          Test if the queue is logically empty.
 void makeEmpty()
          Make the queue logically empty.
 void waitForEnqueue()
          Wait for queue to be filled
 void waitUntilEmpty()
          Wait for queue to be empty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enqueueSync

public final Object enqueueSync

isEmptySync

public final Object isEmptySync
Constructor Detail

Queue

public Queue()
Construct the queue.

Method Detail

isEmpty

public boolean isEmpty()
Test if the queue is logically empty.

Returns:
true if empty, false otherwise.

getFront

public Object getFront()
Get the least recently inserted item in the queue. Does not alter the queue.

Returns:
the least recently inserted item in the queue.

dequeue

public Object dequeue()
Return and remove the least recently inserted item from the queue.

Returns:
the least recently inserted item in the queue.

enqueue

public void enqueue(Object x)
Insert a new item into the queue.

Parameters:
x - the item to insert.

makeEmpty

public void makeEmpty()
Make the queue logically empty.


getCurrentSize

public int getCurrentSize()
Get the current size of the queue


waitUntilEmpty

public void waitUntilEmpty()
                    throws InterruptedException
Wait for queue to be empty

Throws:
InterruptedException

waitForEnqueue

public void waitForEnqueue()
                    throws InterruptedException
Wait for queue to be filled

Throws:
InterruptedException


Copyright © 2005-2011 Fraunhofer FIRST. All Rights Reserved.