|
datastructures | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.datastructures.HeapPriorityQueue
net.datastructures.HeapAdaptablePriorityQueue
Realization of an adaptable priority queue by means of a heap. Much functionality is inherited.
HeapPriorityQueue
Nested Class Summary | |
protected static class |
HeapAdaptablePriorityQueue.LocationAwareEntry
Inner class for a location-aware entry. |
Nested classes inherited from class net.datastructures.HeapPriorityQueue |
HeapPriorityQueue.DefaultComparator, HeapPriorityQueue.MyEntry |
Field Summary |
Fields inherited from class net.datastructures.HeapPriorityQueue |
comp, T |
Constructor Summary | |
HeapAdaptablePriorityQueue()
Creates an empty heap with a default comparator. |
|
HeapAdaptablePriorityQueue(Comparator comp)
Creates an empty heap with the given comparator. |
Method Summary | |
protected HeapAdaptablePriorityQueue.LocationAwareEntry |
checkEntry(Entry ent)
Check whether a given entry is valid. |
protected HeapAdaptablePriorityQueue.LocationAwareEntry |
getEntry(Position p)
Returns the entry stored at a heap node. |
Entry |
insert(Object k,
Object v)
Inserts a key-value pair and returns the entry created. |
Entry |
remove(Entry entry)
Removes and returns the given entry from the heap. |
protected Object |
replaceEntry(Position v,
HeapAdaptablePriorityQueue.LocationAwareEntry e)
Replaces the element of the given position with the given location-aware entry. |
Object |
replaceKey(Entry entry,
Object k)
Replaces the key of the given entry. |
Object |
replaceValue(Entry e,
Object value)
Replaces the value of the given entry. |
protected void |
swapElements(Position u,
Position v)
Swaps the elements of the two positions. |
Methods inherited from class net.datastructures.HeapPriorityQueue |
checkKey, downHeap, entry, isEmpty, key, min, removeMin, setComparator, size, toString, upHeap |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.datastructures.PriorityQueue |
isEmpty, min, removeMin, size |
Constructor Detail |
public HeapAdaptablePriorityQueue()
public HeapAdaptablePriorityQueue(Comparator comp)
Method Detail |
public Entry insert(Object k, Object v) throws InvalidKeyException
insert
in interface PriorityQueue
insert
in class HeapPriorityQueue
InvalidKeyException
public Entry remove(Entry entry) throws InvalidEntryException
remove
in interface AdaptablePriorityQueue
InvalidEntryException
public Object replaceKey(Entry entry, Object k) throws InvalidEntryException
replaceKey
in interface AdaptablePriorityQueue
InvalidEntryException
public Object replaceValue(Entry e, Object value) throws InvalidEntryException
replaceValue
in interface AdaptablePriorityQueue
InvalidEntryException
protected void swapElements(Position u, Position v)
swapElements
in class HeapPriorityQueue
protected Object replaceEntry(Position v, HeapAdaptablePriorityQueue.LocationAwareEntry e)
protected HeapAdaptablePriorityQueue.LocationAwareEntry getEntry(Position p)
protected HeapAdaptablePriorityQueue.LocationAwareEntry checkEntry(Entry ent) throws InvalidEntryException
InvalidEntryException
|
datastructures | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |