net.cscott.jutil
public abstract class AbstractHeap<K,V> extends Object implements Heap<K,V>
AbstractHeap
provides a skeletal implementation of
the Heap
interface, to minimize the effort required
to implement this interface.
Version: $Id: AbstractHeap.java,v 1.3 2004/01/13 21:40:19 cananian Exp $
Constructor Summary | |
---|---|
protected | AbstractHeap(Comparator<K> c) Sole constructor, for invocation by subclass constructors. |
Method Summary | |
---|---|
abstract void | clear() |
Comparator<K> | comparator() Returns the comparator used to compare keys in this Heap ,
or null if the keys' natural ordering is used. |
abstract void | decreaseKey(Entry<K,V> me, K newkey) |
abstract void | delete(Entry<K,V> me) |
abstract Collection<Entry<K,V>> | entries() |
protected Comparator<Entry<K,V>> | entryComparator() Returns a comparator which can be used to compare
Map.Entry s. |
boolean | equals(Object o) |
Entry<K,V> | extractMinimum() |
int | hashCode() |
abstract Entry<K,V> | insert(K key, V value) |
protected void | insert(Entry<K,V> me) This method should insert the specified Map.Entry ,
which is not currently in the Heap , into the
Heap . |
boolean | isEmpty() |
protected Comparator<K> | keyComparator() Returns the comparator used to compare keys in this Heap .
|
abstract Entry<K,V> | minimum() |
protected K | setKey(Entry<K,V> me, K newkey) This method should set the key for the specified
Map.Entry to the given newkey .
|
abstract int | size() |
String | toString() |
void | union(Heap<? extends K,? extends V> h) |
void | updateKey(Entry<K,V> me, K newkey) |
Heap
,
or null
if the keys' natural ordering is used.Map.Entry
s. Will never return null
.Map.Entry
,
which is not currently in the Heap
, into the
Heap
. Implementation is optional, but it is required
if you use the default implementation of updateKey()
.Heap
.
Will never return null
.Map.Entry
to the given newkey
.
Implementation is optional, but it is required if you use the
default implementation of updateKey()
.