bamboo.lss
Class PriorityQueue
java.lang.Object
bamboo.lss.PriorityQueue
public class PriorityQueue
- extends Object
A non-blocking priority queue.
- Version:
- $Id: PriorityQueue.java,v 1.7 2004/05/14 10:03:42 harlanyu Exp $
- Author:
- Westley Weimer
|
Constructor Summary |
PriorityQueue(int initial_capacity)
Creates a new priority queue with the give initial capacity. |
heap
protected Object[] heap
prio
protected long[] prio
capacity
protected int capacity
heap_size
protected int heap_size
PriorityQueue
public PriorityQueue(int initial_capacity)
- Creates a new priority queue with the give initial capacity.
size
public final int size()
isEmpty
public final boolean isEmpty()
add
public final boolean add(Object o,
long p)
- Adds an object with the given priority.
getFirstPriority
public final long getFirstPriority()
getFirst
public final Object getFirst()
getIndexPriority
public final long getIndexPriority(int i)
getIndex
public final Object getIndex(int i)
contains
public final boolean contains(Object o)
removeFirst
public final Object removeFirst()
toString
public String toString()
- Overrides:
toString in class Object