ciips.animation.tree
Class MultiNode

java.lang.Object
  |
  +--ciips.animation.tree.BasicNode
        |
        +--ciips.animation.tree.MultiNode
Direct Known Subclasses:
MultiwayTree

public class MultiNode
extends BasicNode


Field Summary
protected  java.awt.Color active
           
protected  MultiNode[] child
           
protected  java.awt.Dimension diameter
           
protected  java.awt.Color inactive
           
protected  java.awt.Color labelColor
           
protected  int max_children
           
 
Fields inherited from class ciips.animation.tree.BasicNode
depth, diff_x, diff_y, highlight, highlightNode, label, node_dim, nodeColor, weight, x, y
 
Constructor Summary
MultiNode()
          Create a new leaf node with multiple children.
MultiNode(java.lang.Object weight, int max_children)
          Create a new leaf node with multiple children with the weight and number of children as specified by the parameter
 
Method Summary
 void append(MultiNode b)
          Adds a new node
 void displace(int dx, int dy)
          Move the tree starting with node dx pixels to the right and dy pixels down.
 void draw(java.awt.Graphics g, MultiNode sentinel)
          Draws the corresponding node and the edge to the child nodes
 void drawEdge(java.awt.Graphics g, MultiNode child)
          Draw the edge from node to children
 void drawSubTree(java.awt.Graphics g)
          Draw a node and its subtree
 int getChildCount()
           
 MultiNode getTreeNode(int index)
          Get a specific node ..
 boolean isLeaf()
          Check if this node is a leaf node.
 void move(int x, int y)
          Move the node and all its branches based on the parameters.
 void setChildCount()
           
 void setPosition(int x, int y, int width, int height)
          Start at a node and set the positions for the sub-tree elements dx is the distance between two child nodes in x direction dy is the distance between the parent and the child node in y direction
 void setTreeNode(MultiNode node, int index)
          Substitute the setLeft and setRight method
 
Methods inherited from class ciips.animation.tree.BasicNode
draw, getData, getDepth, getHighlight, getLabel, getX, getY, initColors, initFonts, setColour, setDepth, setHighlight, setLabel, setLabelColour, setWeight, setX, setXY, setY, unHighlight
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

child

protected MultiNode[] child

max_children

protected int max_children

active

protected java.awt.Color active

inactive

protected java.awt.Color inactive

labelColor

protected java.awt.Color labelColor

diameter

protected java.awt.Dimension diameter
Constructor Detail

MultiNode

public MultiNode()
Create a new leaf node with multiple children.

MultiNode

public MultiNode(java.lang.Object weight,
                 int max_children)
Create a new leaf node with multiple children with the weight and number of children as specified by the parameter
Method Detail

append

public void append(MultiNode b)
            throws OverflowException
Adds a new node

getChildCount

public int getChildCount()

setChildCount

public void setChildCount()

setPosition

public void setPosition(int x,
                        int y,
                        int width,
                        int height)
Start at a node and set the positions for the sub-tree elements dx is the distance between two child nodes in x direction dy is the distance between the parent and the child node in y direction
Overrides:
setPosition in class BasicNode

drawEdge

public void drawEdge(java.awt.Graphics g,
                     MultiNode child)
Draw the edge from node to children

draw

public void draw(java.awt.Graphics g,
                 MultiNode sentinel)
Draws the corresponding node and the edge to the child nodes

move

public void move(int x,
                 int y)
Move the node and all its branches based on the parameters.
Overrides:
move in class BasicNode
Parameters:
x - The horizontal destination position of this node.
y - The vertical destination position of this node.

displace

public void displace(int dx,
                     int dy)
Move the tree starting with node dx pixels to the right and dy pixels down.
Overrides:
displace in class BasicNode
Parameters:
node - The root node of the tree to be moved.
dx - The change in x direction.
dy - The change in y direction.

drawSubTree

public void drawSubTree(java.awt.Graphics g)
Draw a node and its subtree

setTreeNode

public void setTreeNode(MultiNode node,
                        int index)
                 throws OverflowException
Substitute the setLeft and setRight method

getTreeNode

public MultiNode getTreeNode(int index)
Get a specific node .. returns null if index is illegal or the node does not exist

isLeaf

public boolean isLeaf()
Check if this node is a leaf node.
Overrides:
isLeaf in class BasicNode
Returns:
true if the node is a leaf node; false otherwise.