| java.lang.Object EDU.oswego.cs.dl.util.concurrent.Heap
Heap | public class Heap (Code) | | A heap-based priority queue, without any concurrency control
(i.e., no blocking on empty/full states).
This class provides the data structure mechanics for BoundedPriorityQueue.
The class currently uses a standard array-based heap, as described
in, for example, Sedgewick's Algorithms text. All methods
are fully synchronized. In the future,
it may instead use structures permitting finer-grained locking.
[ Introduction to this package. ]
|
Constructor Summary | |
public | Heap(int capacity, Comparator cmp) | public | Heap(int capacity) Create a Heap with the given capacity,
and relying on natural ordering. |
count_ | protected int count_(Code) | | |
Heap | public Heap(int capacity)(Code) | | Create a Heap with the given capacity,
and relying on natural ordering.
|
clear | public synchronized void clear()(Code) | | remove all elements *
|
compare | protected int compare(Object a, Object b)(Code) | | perform element comaprisons using comparator or natural ordering *
|
extract | public synchronized Object extract()(Code) | | Return and remove least element, or null if empty
|
insert | public synchronized void insert(Object x)(Code) | | insert an element, resize if necessary
|
left | final protected int left(int k)(Code) | | |
parent | final protected int parent(int k)(Code) | | |
peek | public synchronized Object peek()(Code) | | Return least element without removing it, or null if empty *
|
right | final protected int right(int k)(Code) | | |
size | public synchronized int size()(Code) | | Return number of elements *
|
|
|