|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmauda.plugin.fibheap.FibHeap
public class FibHeap
Implements and animates the data structure 'Fibonacci heap' (F-heap)
and the operations defined to manipulate the structure.
F-heaps are one way of implementing priority queues. They consist
of nodes ('tasks') with given keys ('priorities'). At any time,
a new node may be added, the node with minimum key can be accessed
or removed from the queue, the key value of a given node may be
decreased, or a given node may be deleted.
Calling the constructor with an instance of jedas.Scheduler
and adding the FibHeap to a jedas.CompPanel will
animate all the operations manipulating the F-heap structure.
In addition, this class offers a simple way to analyze the
actual time complexity of the individual heap operations.
In order to analyze a heap manipulation, call getCount()
after executing the respective operation.
The analysis is idealized in the following sense:
| Field Summary | |
|---|---|
static int |
DETAIL
|
static int |
MORE
|
static int |
NONE
Detail levels of accompanying text. |
static int |
NORMAL
|
static SubOperationQueue |
subOperations
|
| Constructor Summary | |
|---|---|
FibHeap()
Creates a new, empty FibHeap. |
|
| Method Summary | |
|---|---|
int |
accessmin()
Returns the minimum key in this Fibonacci heap. |
void |
add(SubOperation so)
|
void |
clearSubOperationQueue()
|
java.lang.Object |
copy()
|
java.lang.Object |
copyDS()
|
void |
decreasekey(FibNode N,
int k)
Decreases the key of the specified node to the specified value. |
java.lang.Object |
deepCopy()
Performs a deep copy of the implemented data-structure |
int |
delete(FibNode node)
Deletes the specified node from this Fibonacci heap. |
int |
deletemin()
Deletes the node with minimum key in this Fibonacci heap. |
int |
getCount()
Call this method to analyze a just completed heap operation. |
int |
getHeapSize()
|
static boolean |
getKeyColorMode()
|
jedas.CompObj |
getMainCompObj()
Returns the main CompObj which to visualize in the JEDAS animation-area. |
SubOperationQueue |
getSubOperationQueue()
|
FibNode |
insert(int k)
Inserts a new node to this Fibonacci heap. |
boolean |
isEmpty()
|
int |
maxRank()
Returns the maximum possible rank of a node in this FibHeap. |
void |
meld(FibHeap other)
Melds another FibHeap into this one. |
void |
resetCount()
Resets the step counter to 0. |
static void |
setKeyColorMode(boolean b)
Sets the 'key color' mode. |
static void |
setTextMode(int mode)
Sets the 'text mode' to accompany operations by text. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static SubOperationQueue subOperations
public static final int NONE
public static final int NORMAL
public static final int MORE
public static final int DETAIL
| Constructor Detail |
|---|
public FibHeap()
| Method Detail |
|---|
public boolean isEmpty()
public void meld(FibHeap other)
other - the FibHeap to be joined with this onepublic FibNode insert(int k)
k - key of new FibNode
public int accessmin()
public int deletemin()
public void decreasekey(FibNode N,
int k)
N - node whose key is to be decreasedk - new key valuepublic int delete(FibNode node)
node - node to be deleted
public int getHeapSize()
public int getCount()
public void resetCount()
public static boolean getKeyColorMode()
public static void setKeyColorMode(boolean b)
b - TRUE iff 'key color' is onpublic static void setTextMode(int mode)
mode - the text modepublic int maxRank()
public jedas.CompObj getMainCompObj()
JedasMainCompObj
getMainCompObj in interface JedasMainCompObjpublic SubOperationQueue getSubOperationQueue()
public void add(SubOperation so)
public void clearSubOperationQueue()
public java.lang.Object deepCopy()
Copyable
deepCopy in interface Copyablepublic java.lang.Object copy()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.Object copyDS()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||