Class prominence.util.Queue
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class prominence.util.Queue

java.lang.Object
   |
   +----prominence.util.Queue

public class Queue
extends Object
A FIFO (first in, first out) data-structure; the opposite of a Stack. Objects are added to the front of the Queue and removed from the back.

This implementation blocks the caller who attempts to remove an object from an empty queue until the queue is non-empty again.


Variable Index

 o queue
A Vector of the queue elements.

Constructor Index

 o Queue()
Creates a new, empty Queue.

Method Index

 o add(Object)
Adds an item to the front of the queue, wakes a caller who is waiting for the queue to become non-empty.
 o isEmpty()
Returns whether the queue is empty.
 o remove()
Attempts to remove an object from the queue; blocks if there are no objects in the queue.

Variables

 o queue
  protected Vector queue
A Vector of the queue elements.

Constructors

 o Queue
  public Queue()
Creates a new, empty Queue.

Methods

 o remove
  public Object remove()
Attempts to remove an object from the queue; blocks if there are no objects in the queue. This call will therefore always return an object.
Returns:
s The least-recently-added object from the queue
 o add
  public void add(Object item)
Adds an item to the front of the queue, wakes a caller who is waiting for the queue to become non-empty.
Parameters:
item - The object to be added
 o isEmpty
  public boolean isEmpty()
Returns whether the queue is empty.
Returns:
s Whether the queue is empty

All Packages  Class Hierarchy  This Package  Previous  Next  Index