All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.beans.util.PriorityQueue

java.lang.Object
   |
   +----com.ibm.beans.util.PriorityQueue

public class PriorityQueue
extends Object
implements Cloneable, Serializable
A PriorityQueue is a collection class that keeps the objects ordered. Ordering is based on the methods supplied by the Comparable object supplied during construction. The java.lang.Object.equals() method is not used in the ordering of the priority queue.

Priority queues can be implemented in different ways. This implementation assumes that enumeration over the queue occurs more frequently than additions or deletions from the queue. This priority queue orders its contents during insertion and deletion, making enumeration faster.

The PriorityQueue has the highest priority elements at the top of the queue and the lowest priority elements at the bottom. This is purely a numerical comparison: a priority of 10 is greater than a priority of 1. In this case, a priority of 1 is at end of the priority queue.


Constructor Index

 o PriorityQueue(Comparable)
Constructs a PriorityQueue instance.

Method Index

 o clone()
Clones this priority queue.
 o contains(Object)
Determines if an element is a member of this priority queue.
 o elements()
Gets an enumeration of the elements in this priority queue.
 o isEmpty()
Checks to see if this priority queue is empty.
 o pop()
Removes the top object in this priority queue.
 o push(Object)
Adds the specified object to this priority queue.
 o removeElement(Object)
Removes the first occurrence of the specified element from this priority queue.
 o seeBottom()
Determines the last element in this priority queue.
 o seeTop()
Determines the first element in this priority queue.
 o size()
Gets the number of elements in this priority queue.
 o toString()
Converts this priority queue to a String.

Constructors

 o PriorityQueue
 public PriorityQueue(Comparable x)
Constructs a PriorityQueue instance.

Parameters:
x - The Comparable to be used to order the elements in this priority queue.

Methods

 o isEmpty
 public final boolean isEmpty()
Checks to see if this priority queue is empty.

Returns:
true if this priority queue is empty; false otherwise.
 o size
 public final int size()
Gets the number of elements in this priority queue.

Returns:
The number of elements in this priority queue.
 o seeTop
 public final synchronized Object seeTop()
Determines the first element in this priority queue.

Returns:
The first element in this priority queue, if this priority queue is not empty. Otherwise it returns null.
 o seeBottom
 public final synchronized Object seeBottom()
Determines the last element in this priority queue.

Returns:
The last element in this priority queue, if this priority queue is not empty. Otherwise it returns null.
 o push
 public final synchronized void push(Object x)
Adds the specified object to this priority queue.

Parameters:
x - The object to be added to this priority queue.
 o pop
 public final synchronized Object pop()
Removes the top object in this priority queue.

Returns:
The object removed from this priority queue.
 o removeElement
 public final synchronized boolean removeElement(Object obj)
Removes the first occurrence of the specified element from this priority queue.

Parameters:
obj - The object to be removed.
Returns:
true if the element was actually removed; false otherwise.
 o contains
 public final boolean contains(Object x)
Determines if an element is a member of this priority queue.

Parameters:
x - The element to try to find in this priority queue.
Returns:
true if the element is a member of this priority queue; false otherwise.
 o elements
 public final synchronized Enumeration elements()
Gets an enumeration of the elements in this priority queue. Use the Enumeration methods on the returned object to fetch the elements sequentially.

Returns:
An enumeration of the components of this priority queue.
 o toString
 public final synchronized String toString()
Converts this priority queue to a String. This method is useful for debugging.

Returns:
A String representation of this priority queue.
Overrides:
toString in class Object
 o clone
 public synchronized Object clone()
Clones this priority queue. The elements contained in this priority queue are not cloned.

Overrides:
clone in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index