Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## mauda.plugin.fibheap
Class FibNode

    java.lang.Object
      mauda.plugin.fibheap.FibNode

    public class FibNode

extends java.lang.Object

Describes a node in a Fibonacci heap. On the logical side, each node has references to its parent, its left and right sibling, and one of its children. Thus, it is possible to use this node for trees with variable node rank, using the 'child-sibling' representation of trees. In addition, there are two `int`s reprenting the key and the rank (= number of children) of this node. A `boolean` indicates whether this node has lost one of its children since it (=this node) was last made a child of another node. Physically, a node is represented by a `FibNodeObj` and by a `LineObj` connecting it to its parent node. The physical `CompObj` representing a node includes the whole subtree rooted in this node. Thus, moving one `FibNode` will move the subtree along.

Version:
  2.01 (08/08/02)
Author:
  Tobias Lauer

Field Summary
`static int` | `CENTER`
`static int` | `LEFT`

Constructor Summary
`FibNode(int key)` Creates a new node with the specified key.

Method Summary
`void` | `addChild(FibNode newChild)` Links another node N to this one.
`void` | `addPointer(jedas.LineObj item)` Adds the minimum pointer object to this node.
`void` | `appear()` Node will appear in a smooth animation.
`java.lang.Object` | `clone()`
`java.lang.Object` | `copy()`
`void` | `cut(FibNode target)` Cuts this node off its parent and joins with target
`void` | `delete()` Deletes this node from the root list.
`void` | `disappear()` Node will disappear in a smooth animation.
`void` | `focus()` Sets the focus of attention to this node.
`jedas.DPair` | `getAbsPos(jedas.CompObj mainco)` Returns the absolute position of this node in the FibHeap object.
`FibNode` | `getChildNode()`
`boolean` | `getColorMode()`
`int` | `getDepth()`
`boolean` | `getHighlight()`
`int` | `getKey()`
`FibNode` | `getLeftSibling()`
`FibNode` | `getParentNode()` Returns the (logical) parent `FibNode` of this node.
`int` | `getRank()`
`FibNode` | `getRightSibling()`
`FibNode` | `getRoot()`
`jedas.DPair` | `getRootPos()`
`FibNode` | `getSibling()` Used for child-sibling format of trees.
`int` | `getTreeDepth()`
`int` | `getTreeSize()`
`int` | `getTreeWidth()`
`boolean` | `hasChildren()`
`boolean` | `isLeftOf(FibNode other)`
`boolean` | `isMarked()`
`boolean` | `isRoot()`
`void` | `join(FibNode other, boolean spaceNeeded)` Joins another node list to the sibling list of this one.
`void` | `makeRoomFor(FibNode inserted)` Makes room for another subtree to be inserted to the right of this node
`void` | `mark()` Marks this node.
`static void` | `setColorMode(boolean b)` Sets the 'key color' feature of this class.
`void` | `setHighlight(boolean on)` Highlights this node with the current highlight color.
`static void` | `setHighlightColor(java.awt.Color color)` Sets the highlight color of FibNodes.
`void` | `setKey(int k)` Sets the key of this node to the specified value.
`void` | `unmark()` Un-marks (removes mark from) this node.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### CENTER

    public static final int CENTER

See Also:
  Constant Field Values

### LEFT

    public static final int LEFT

See Also:
  Constant Field Values

Constructor Detail

### FibNode

    public FibNode(int key)

  Creates a new node with the specified key. The node has no parent or child and is the only node in its list of siblings.

  Parameters:
    `key` - the key for this node

Method Detail

### getParentNode

    public FibNode getParentNode()

  Returns the (logical) parent `FibNode` of this node. Might differ from `getParent()`, which returns the (physical) parent `Composite`.

  Returns:
    the parent of this node (or null, if this node is a root).

### getChildNode

    public FibNode getChildNode()

  Returns:
    the leftmost child of this node (or `null`, if there is no child).

### getSibling

    public FibNode getSibling()

  Used for child-sibling format of trees.

  Returns:
    this node's (right) sibling (=`null` if there is no sibling!)

### getRightSibling

    public FibNode getRightSibling()

  Returns:
    this node's right sibling (=this node if there is no sibling)

### getLeftSibling

    public FibNode getLeftSibling()

  Returns:
    this node's right sibling (= this node if there is no sibling)

### getRank

    public int getRank()

  Returns:
    the rank (= number of children) of this node.

### getKey

    public int getKey()

  Returns:
    the key of this node

### setKey

    public void setKey(int k)

  Sets the key of this node to the specified value.

  Parameters:
    `k` - the new key

### getColorMode

    public boolean getColorMode()

  Returns:
    TRUE iff 'key color' feature is turned on

### setColorMode

    public static void setColorMode(boolean b)

  Sets the 'key color' feature of this class. If turned on, the brightness of the node's fill color reflects its key value.

  Parameters:
    `b` - TRUE iff color is to reflect the key value

### isRoot

    public boolean isRoot()

  Returns:
    `TRUE` iff this node is part of the rootlist

### hasChildren

    public boolean hasChildren()

  Returns:
    `TRUE` iff this node has at least one child

### isMarked

    public boolean isMarked()

  Returns:
    `TRUE` iff this node is marked (=has lost a child since last linked to another node)

### mark

    public void mark()

  Marks this node.

### unmark

    public void unmark()

  Un-marks (removes mark from) this node.

### focus

    public void focus()

  Sets the focus of attention to this node. Various implementations thinkable.

### setHighlight

    public void setHighlight(boolean on)

  Highlights this node with the current highlight color. Can be used, e.g., to signal that a user has selected this node with the mouse etc.

  Parameters:
    `on` - highlight status.

### getHighlight

    public boolean getHighlight()

  Returns:
    true iff this node is highlighted.

### setHighlightColor

    public static void setHighlightColor(java.awt.Color color)

  Sets the highlight color of FibNodes.

  Parameters:
    `color` - the desired highlight color

### appear

    public void appear()

  Node will appear in a smooth animation.

### disappear

    public void disappear()

  Node will disappear in a smooth animation.

### addChild

    public void addChild(FibNode newChild)

  Links another node N to this one. Inserts N as the rightmost child of this node.

  Parameters:
    `newChild` - the node to be added

### cut

    public void cut(FibNode target)

  Cuts this node off its parent and joins with target

  Parameters:
    `target` - the node where this one is attached

### join

    public void join(FibNode other,
                     boolean spaceNeeded)

  Joins another node list to the sibling list of this one. Inserts the other node and its siblings right next to this node. All parents and children remain.

  Parameters:
    `other` - node of the list to join
    `spaceNeeded` - true if additional space is needed

### delete

    public void delete()

  Deletes this node from the root list.

### getRootPos

    public jedas.DPair getRootPos()

  Returns:
    this node's current root position relative to its parent

### addPointer

    public void addPointer(jedas.LineObj item)

  Adds the minimum pointer object to this node.

  Parameters:
    `item` - the arrow to be added

### getTreeWidth

    public int getTreeWidth()

  Returns:
    width of the (sub)tree rooted in this node

### getTreeDepth

    public int getTreeDepth()

  Returns:
    the depth of this (sub)tree (from this node to bottom)

### getTreeSize

    public int getTreeSize()

  Returns:
    the size (=number of nodes) in this (sub)tree

### getDepth

    public int getDepth()

  Returns:
    the depth of this node in its tree (=distance from root to this node)

### getRoot

    public FibNode getRoot()

  Returns:
    the root of the tree this node is part of

### makeRoomFor

    public void makeRoomFor(FibNode inserted)

  Makes room for another subtree to be inserted to the right of this node

  Parameters:
    `inserted` - the node to be inserted

### getAbsPos

    public jedas.DPair getAbsPos(jedas.CompObj mainco)

  Returns the absolute position of this node in the FibHeap object.

  Returns:
    absolute position

### isLeftOf

    public boolean isLeftOf(FibNode other)

  Parameters:
    `other` - the node to compare
  Returns:
    `TRUE` iff this node is further left than other

### clone

    public java.lang.Object clone()

  Overrides:
    `clone` in class `java.lang.Object`

### copy

    public java.lang.Object copy()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD