Class Node

java.lang.Object
  |
  +--Node

public class Node
extends java.lang.Object

This class keeps track of all the information associated with each node.


Constructor Summary
Node(int inCount, java.lang.String inName, int inIndex, double inHeight, double inLength, boolean inLive)
          Constructs the node object with the specified values.
Node(java.lang.String inName, int inIndex, int inNumOfLeaves, double inLength, Node inLeftNode, Node inRightNode, java.lang.String inSeq)
          Constructs the node object with the specified values.
 
Method Summary
 Node copy()
          Gets a deep copy of a node.
 int draw(java.awt.Graphics g, int unit_x, int radius, int rect_width, int size, int type)
          Defines how to draw a node in distance based algorithms.
 int drawMP(java.awt.Graphics g, int unit_x, int radius, int rect_width, int size)
          Defines how to draw a node in the MP algorithms.
 void drawMPRight(java.awt.Graphics g, int unit_x, int radius, int rect_width, int size)
          Defines how to draw a node in the last step of the MP algorithm by rotating one rooted tree to the right.
 void drawNJRight(java.awt.Graphics g, int unit_x, int radius, int rect_width, int size, int type)
          Defines how to draw a node in the last step of the FM and NJ algorithms by rotating one rooted tree to the right.
 int getBegin_x()
          Gets the begin x axis value to draw a node.
 int getBegin_y()
          Gets the begin y axis value to draw a node.
 int getCount()
          Gets the number of nodes in a node.
 int getEnd_x()
          Gets the end x axis value to draw a node.
 int getEnd_y()
          Gets the end y axis value to draw a node.
 java.lang.String getFormattedName()
          Gets the name of the node in html formatted style.
 double getHeight()
          Gets the height of a node.
 int getIndex()
          Gets the index of a node in the nodes array.
 Node getLeftNode()
          Gets the left node of a node.
 double getLength()
          Gets the branch length of a node.
 java.lang.String getName()
          Gets the name of a node.
 int getNumOfLeaves()
          Gets the number of leaf nodes rooted at a node.
 double getPathLength()
          Gets the path length from a node to the leaf node.
 Node getRightNode()
          Gets the right node of a node.
 java.lang.String getSeq()
          Gets the character sequence of this node.
 boolean isLeaf()
          Indicates if a node is a leaf node.
 boolean isLive()
          Indicates if a node is live.
 void kill()
          Defines how to kill a node when the node is joined to the other node.
 void setBegin_x(int inBegin_x)
          Sets the begin x axis value to draw a node.
 void setBegin_y(int inBegin_y)
          Sets the begin y axis value to draw a node.
 void setEnd_x(int inEnd_x)
          Sets the end x axis value to draw a node.
 void setEnd_y(int inEnd_y)
          Sets the end y axis value to draw a node.
 void setLeftNode(Node inLeftNode)
          Sets the left node of a node.
 void setLength(double inLength)
          Sets the branch length of a node.
 void setNumOfLeaves(int inNumOfLeaves)
          Sets the number of leaves rooted at a node.
 void setPathLength(double inPathLength)
          Sets the path length of a node to a specified value
 void setPosition(int inBegin_x, int inBegin_y, int inEnd_x, int inEnd_y)
          Sets a node drawing postion form (begin_x, begin_y) to (end_x, end_y).
 void setRightNode(Node inRightNode)
          Sets the right node of a node.
 void setSeq(java.lang.String inSeq)
          Sets the character sequence of a node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Node

public Node(int inCount,
            java.lang.String inName,
            int inIndex,
            double inHeight,
            double inLength,
            boolean inLive)
Constructs the node object with the specified values.

Parameters:
inCount - the number of the nodes in the composite node
inName - the name of the node
inIndex - the index of the node in the nodes array
inHeight - the heigth of the node
inLength - the branch length of the node
inLive - the value indicates if the node is live or dead

Node

public Node(java.lang.String inName,
            int inIndex,
            int inNumOfLeaves,
            double inLength,
            Node inLeftNode,
            Node inRightNode,
            java.lang.String inSeq)
Constructs the node object with the specified values.

Parameters:
inName - the name of the node
inIndex - the index of the node in the nodes array
inNumOfLeaves - the number of leave nodes rooted at this node
inLength - the branch length of the node
inLeftNode - the left node of this node
inRightNode - the right node of this node
inSeq - the character sequence of this node
Method Detail

getName

public java.lang.String getName()
Gets the name of a node.

Returns:
the name of a node

getCount

public int getCount()
Gets the number of nodes in a node.

Returns:
the number of nodes in a node

getHeight

public double getHeight()
Gets the height of a node.

Returns:
the height of a node

getLength

public double getLength()
Gets the branch length of a node.

Returns:
the branch length a the node

getPathLength

public double getPathLength()
Gets the path length from a node to the leaf node.

Returns:
the path length from a node to the leaf node

getIndex

public int getIndex()
Gets the index of a node in the nodes array.

Returns:
the index of a node

getBegin_x

public int getBegin_x()
Gets the begin x axis value to draw a node.

Returns:
the begin x axis value

getBegin_y

public int getBegin_y()
Gets the begin y axis value to draw a node.

Returns:
the begin y axis value

getEnd_x

public int getEnd_x()
Gets the end x axis value to draw a node.

Returns:
the end x axis value

getEnd_y

public int getEnd_y()
Gets the end y axis value to draw a node.

Returns:
the end y axis value

getLeftNode

public Node getLeftNode()
Gets the left node of a node.

Returns:
the left node of a node

getRightNode

public Node getRightNode()
Gets the right node of a node.

Returns:
the right node of a node

getNumOfLeaves

public int getNumOfLeaves()
Gets the number of leaf nodes rooted at a node.

Returns:
the number of leaf nodes

getSeq

public java.lang.String getSeq()
Gets the character sequence of this node.

Returns:
the character sequence of this node

getFormattedName

public java.lang.String getFormattedName()
Gets the name of the node in html formatted style.
The leaf nodes are represented by the green colors. The interior nodes are represented by the red colors.

Returns:
the name of the node in html formatted style

setPathLength

public void setPathLength(double inPathLength)
Sets the path length of a node to a specified value

Parameters:
inPathLength - the value of the length of the path

setPosition

public void setPosition(int inBegin_x,
                        int inBegin_y,
                        int inEnd_x,
                        int inEnd_y)
Sets a node drawing postion form (begin_x, begin_y) to (end_x, end_y).

Parameters:
inBegin_x - the begin x axis value
inBegin_y - the begin y axis value
inEnd_x - the end x axis value
inEnd_y - the end y axis value

setBegin_x

public void setBegin_x(int inBegin_x)
Sets the begin x axis value to draw a node.

Parameters:
inBegin_x - the begin x axis value

setBegin_y

public void setBegin_y(int inBegin_y)
Sets the begin y axis value to draw a node.

Parameters:
inBegin_y - the begin y axis value

setEnd_x

public void setEnd_x(int inEnd_x)
Sets the end x axis value to draw a node.

Parameters:
inEnd_x - the end x axis value

setEnd_y

public void setEnd_y(int inEnd_y)
Sets the end y axis value to draw a node.

Parameters:
inEnd_y - the end y axis value

setLength

public void setLength(double inLength)
Sets the branch length of a node.

Parameters:
inLength - the value of branch length

setLeftNode

public void setLeftNode(Node inLeftNode)
Sets the left node of a node.

Parameters:
inLeftNode - the left node of a node

setRightNode

public void setRightNode(Node inRightNode)
Sets the right node of a node.

Parameters:
inRightNode - the right node of a node

setNumOfLeaves

public void setNumOfLeaves(int inNumOfLeaves)
Sets the number of leaves rooted at a node.

Parameters:
inNumOfLeaves - the number of leaves

setSeq

public void setSeq(java.lang.String inSeq)
Sets the character sequence of a node.

Parameters:
inSeq - the character sequence

kill

public void kill()
Defines how to kill a node when the node is joined to the other node.


isLive

public boolean isLive()
Indicates if a node is live.


isLeaf

public boolean isLeaf()
Indicates if a node is a leaf node.


copy

public Node copy()
Gets a deep copy of a node.


draw

public int draw(java.awt.Graphics g,
                int unit_x,
                int radius,
                int rect_width,
                int size,
                int type)
Defines how to draw a node in distance based algorithms.

Parameters:
g - the Graphics object to draw a node
unit_x - the x axis scaling factor
radius - the radius of the circle representing an interior node
rect_width - the width of the rectangle representing a leaf node
size - the font size
type - the type of a node (either the left node or the rigth node)
Returns:
the last y axis value

drawNJRight

public void drawNJRight(java.awt.Graphics g,
                        int unit_x,
                        int radius,
                        int rect_width,
                        int size,
                        int type)
Defines how to draw a node in the last step of the FM and NJ algorithms by rotating one rooted tree to the right.

Parameters:
g - the Graphics object to draw a node
unit_x - the x axis scaling factor
radius - the radius of the circle representing an interior node
rect_width - the width of the rectangle representing a leaf node
size - the font size
type - the type of a node (either the left node or the rigth node)
Returns:
the last y axis value

drawMP

public int drawMP(java.awt.Graphics g,
                  int unit_x,
                  int radius,
                  int rect_width,
                  int size)
Defines how to draw a node in the MP algorithms.

Parameters:
g - the Graphics object to draw a node
unit_x - the x axis scaling factor
radius - the radius of the circle representing an interior node
rect_width - the width of the rectangle representing a leaf node
size - the font size
Returns:
the last y axis value

drawMPRight

public void drawMPRight(java.awt.Graphics g,
                        int unit_x,
                        int radius,
                        int rect_width,
                        int size)
Defines how to draw a node in the last step of the MP algorithm by rotating one rooted tree to the right.

Parameters:
g - the Graphics object to draw a node
unit_x - the x axis scaling factor
radius - the radius of the circle representing an interior node
rect_width - the width of the rectangle representing a leaf node
size - the font size
Returns:
the last y axis value