|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--Opus5.AbstractObject
|
+--Opus5.AbstractContainer
|
+--Opus5.BinomialQueue
A mergeable priority queue implemented as a forest of binomial trees.
| Inner Class Summary | |
protected static class |
BinomialQueue.BinomialTree
A node in a binomial tree. |
| Field Summary | |
protected LinkedList |
treeList
A linked list of binomial trees---the forest. |
| Fields inherited from class Opus5.AbstractContainer |
count |
| Fields inherited from interface Opus5.MergeablePriorityQueue |
copyright |
| Constructor Summary | |
BinomialQueue()
Constructs an empty BinomialQueue. |
|
| Method Summary | |
void |
accept(Visitor visitor)
Accepts the specified visitor and makes it visit all the objects contained in this binomial queue. |
protected void |
addTree(BinomialQueue.BinomialTree tree)
Adds the specified binomial tree to this binomial queue. |
protected BinomialQueue.BinomialTree |
carry(BinomialQueue.BinomialTree a,
BinomialQueue.BinomialTree b,
BinomialQueue.BinomialTree c)
Returns the "carry" which results when three binomial trees are "added". |
protected int |
compareTo(Comparable arg)
Compares this binomial queue with the specified comparable object. |
Comparable |
dequeueMin()
Dequeues and returns the "smallest" object in this binomial queue. |
void |
enqueue(Comparable object)
Enqueues the specified object in this binomial queue. |
Comparable |
findMin()
Returns the "smallest" object in this binomial queue. |
protected BinomialQueue.BinomialTree |
findMinTree()
Returns the binomial tree in this binomial queue that has the "smallest" root. |
Enumeration |
getEnumeration()
Returns an enumeration that enumerates the objects contained in this binomial queue. |
void |
merge(MergeablePriorityQueue queue)
Merges the specified mergeable priority queue with this binomial queue. |
void |
purge()
Purges this binomial queue, making it empty. |
protected void |
removeTree(BinomialQueue.BinomialTree tree)
Removes the specified binomial tree from this binomial queue. |
protected BinomialQueue.BinomialTree |
sum(BinomialQueue.BinomialTree a,
BinomialQueue.BinomialTree b,
BinomialQueue.BinomialTree c)
Returns the "sum" which results when three binomial trees are "added". |
java.lang.String |
toString()
Returns a string representation of this binomial queue. |
| Methods inherited from class Opus5.AbstractContainer |
getCount, hashCode, isEmpty, isFull |
| Methods inherited from class Opus5.AbstractObject |
compare, equals, isEQ, isGE, isGT, isLE, isLT, isNE |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface Opus5.Container |
getCount, isEmpty, isFull |
| Methods inherited from interface Opus5.Comparable |
compare, isEQ, isGE, isGT, isLE, isLT, isNE |
| Field Detail |
protected LinkedList treeList
| Constructor Detail |
public BinomialQueue()
BinomialQueue.| Method Detail |
protected void addTree(BinomialQueue.BinomialTree tree)
tree - The binomial tree to add.protected void removeTree(BinomialQueue.BinomialTree tree)
tree - The binomial tree to remove.public void purge()
purge in interface Containerpublic void accept(Visitor visitor)
accept in interface Containeraccept in class AbstractContainervisitor - The visitor to accept.protected BinomialQueue.BinomialTree findMinTree()
public Comparable findMin()
findMin in interface PriorityQueueContainerEmptyException - If this binomial queue is empty.public void merge(MergeablePriorityQueue queue)
BinomialQueue instance.
After merging, the specified queue is empty.merge in interface MergeablePriorityQueuequeue - The mergeable priority queue to merge
with this binomial queue.
protected BinomialQueue.BinomialTree sum(BinomialQueue.BinomialTree a,
BinomialQueue.BinomialTree b,
BinomialQueue.BinomialTree c)
null.
All three trees are assumed to have the same order.a - A binomial tree.b - A binomial tree.c - A binomial tree.carry(Opus5.BinomialQueue.BinomialTree, Opus5.BinomialQueue.BinomialTree, Opus5.BinomialQueue.BinomialTree)
protected BinomialQueue.BinomialTree carry(BinomialQueue.BinomialTree a,
BinomialQueue.BinomialTree b,
BinomialQueue.BinomialTree c)
null.
All three trees are assumed to have the same order.a - A binomial tree.b - A binomial tree.c - A binomial tree.sum(Opus5.BinomialQueue.BinomialTree, Opus5.BinomialQueue.BinomialTree, Opus5.BinomialQueue.BinomialTree)public void enqueue(Comparable object)
enqueue in interface PriorityQueueobject - The object to enqueue.public Comparable dequeueMin()
dequeueMin in interface PriorityQueueContainerEmptyException - If this binomial queue is empty.public java.lang.String toString()
toString in class AbstractContainerpublic Enumeration getEnumeration()
getEnumeration in interface ContainerMethodNotImplemented - Always.protected int compareTo(Comparable arg)
compareTo in class AbstractObjectarg - The comparable object with which to compare
this binomial queue.MethodNotImplemented - Always.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||