public abstract class AbstractPriorityQueue<K,V> extends Object implements PriorityQueue<K,V>
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractPriorityQueue.PQEntry<K,V>
A concrete implementation of the Entry interface to be used within
a PriorityQueue implementation.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractPriorityQueue()
Creates an empty priority queue based on the natural ordering of its keys.
|
protected |
AbstractPriorityQueue(Comparator<K> c)
Creates an empty priority queue using the given comparator to order keys.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkKey(K key)
Determines whether a key is valid.
|
protected int |
compare(Entry<K,V> a,
Entry<K,V> b)
Method for comparing two entries according to key
|
boolean |
isEmpty()
Tests whether the priority queue is empty.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
insert, min, removeMin, size
protected AbstractPriorityQueue(Comparator<K> c)
c
- comparator defining the order of keys in the priority queueprotected AbstractPriorityQueue()
protected int compare(Entry<K,V> a, Entry<K,V> b)
protected boolean checkKey(K key) throws IllegalArgumentException
IllegalArgumentException
public boolean isEmpty()
isEmpty
in interface PriorityQueue<K,V>