org.sapia.ubik.util
Class Queue

java.lang.Object
  extended by org.sapia.ubik.util.Queue

public class Queue
extends java.lang.Object

A basic FIFO datastructure.

Author:
Yanick Duchesne
Copyright:
Copyright © 2002-2005 Sapia Open Source Software. All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site

Field Summary
protected  java.util.LinkedList _items
           
 
Constructor Summary
Queue()
          Creates an instance of this class with no maximum size.
 
Method Summary
 void add(java.lang.Object o, boolean notifyAll)
           
 java.lang.Object remove()
          This method retrusn the first object in this queue, or blocks until an object is added.
protected  void resetAddedFlag()
           
 int size()
           
 boolean wasItemAdded()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_items

protected java.util.LinkedList _items
Constructor Detail

Queue

public Queue()
Creates an instance of this class with no maximum size.

Method Detail

add

public void add(java.lang.Object o,
                boolean notifyAll)
Parameters:
o - the Object to add to this queue.
notifyAll - if true, all threads waiting on this queue will be internally notified.

remove

public java.lang.Object remove()
                        throws java.lang.InterruptedException
This method retrusn the first object in this queue, or blocks until an object is added.

Returns:
the first Object in the queue - which is internally removed.
Throws:
java.lang.InterruptedException

size

public int size()
Returns:
the number of items in this queue.

wasItemAdded

public boolean wasItemAdded()
Returns:
true if an item was just added to this instance.

resetAddedFlag

protected void resetAddedFlag()


Copyright © 2010 Sapia OSS. All Rights Reserved.