net.cscott.jutil
Class AbstractHeap<K,V>
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.6 2006-10-30 20:14:40 cananian Exp $
Author: C. Scott Ananian
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
java.util.Map.Entrys. |
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 java.util.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
java.util.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) |
protected AbstractHeap(Comparator<
K> c)
Sole constructor, for invocation by subclass constructors.
public abstract void clear()
public Comparator<
K> comparator()
Returns the comparator used to compare keys in this
Heap,
or
null
if the keys' natural ordering is used.
public abstract void decreaseKey(Entry<
K,
V> me,
K newkey)
public abstract void delete(Entry<
K,
V> me)
public abstract Collection<Entry<
K,
V>> entries()
protected Comparator<Entry<
K,
V>> entryComparator()
Returns a comparator which can be used to compare
java.util.Map.Entrys. Will never return null
.
public boolean equals(Object o)
public Entry<
K,
V> extractMinimum()
public int hashCode()
public abstract Entry<
K,
V> insert(
K key,
V value)
protected void insert(Entry<
K,
V> me)
This method should insert the specified java.util.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 {@code updateKey()}.
public boolean isEmpty()
protected Comparator<
K> keyComparator()
Returns the comparator used to compare keys in this
Heap.
Will never return null
.
public abstract Entry<
K,
V> minimum()
protected
K setKey(Entry<
K,
V> me,
K newkey)
This method should set the key for the specified
java.util.Map.Entry to the given newkey
.
Implementation is optional, but it is required if you use the
default implementation of {@code updateKey()}.
public abstract int size()
public String toString()
public void union(
Heap<? extends
K,? extends
V> h)
public void updateKey(Entry<
K,
V> me,
K newkey)
Copyright (c) 2006 C. Scott Ananian