|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--AccordionTreeDrawer.TreeNode
A class representing a node of a (phylognenetic) tree. The tree that this node belongs to is of type Tree. Nodes have fields that store a pre- and post-ordering. A TreeNode has a list of children, a unique key, a leftmostleaf and a rightmost leaf
Tree,
GridCell| Field Summary | |
(package private) java.lang.Double |
bcnScore
|
java.awt.Color |
cachedColor
|
int |
cachedFrame
|
GridCell |
cell
The GridCell that this node is attached to |
(package private) java.util.ArrayList |
children
|
(package private) TreeEdge[] |
edges
|
private int |
fontSize
|
(package private) int |
height
|
int |
key
key is unique for nodes in one tree |
java.lang.String |
label
|
TreeNode |
leftmostLeaf
|
int |
lindex
leaf index |
private int |
max
The index of the largest descendant node |
private int |
min
The index of the smallest descendant node (Node in subtree rooted at this node). |
(package private) java.lang.String |
name
node name with default "". |
TreeNode |
next
next leaf added by Li |
(package private) float[] |
nodeOffset
The offset of the point with respect to the cell. |
int |
numberLeaves
|
TreeNode |
parent
|
TreeNode |
posorderNext
|
TreeNode |
preorderNext
|
TreeNode |
rightmostLeaf
|
float |
weight
weight is actually edge length for the edge immediately above the node |
| Constructor Summary | |
TreeNode()
Children list initial capacity 2 as in most case binary. |
|
TreeNode(java.lang.String s)
|
|
TreeNode(java.lang.String s,
float w)
Allocate a new TreeNode object with node name and weight. |
|
| Method Summary | |
void |
addChild(TreeNode n)
|
void |
addEdge(TreeEdge edge,
int xy)
Add edge in either X/horizontal (xy==0) direction, or Y/vertical (xy==1)direction. |
void |
close()
clean the node itself and the tree edge attached with it. |
int |
compareTo(java.lang.Object o)
implement Comparable interface - sort on key field |
void |
drawInCell(java.awt.Color col,
float plane,
AccordionDrawer d)
Draws this node inside cell, the GridCell that it is attached to, if cell is drawn large enough Prints the label of the node if the GridCell is drawn large enough |
boolean |
equals(TreeNode n)
|
protected void |
finalize()
|
TreeNode |
firstChild()
|
java.lang.Double |
getBcnScore()
|
java.awt.Color |
getCachedColor()
|
int |
getCachedFrame()
|
GridCell |
getCell()
|
TreeNode |
getChild(int i)
|
AccordionTreeDrawer |
getDrawer()
|
TreeEdge |
getEdge(int xy)
|
int |
getFontSize()
|
int |
getKey()
|
int |
getLeafCount()
|
TreeNode |
getLeftmostLeaf()
|
int |
getMax()
|
int |
getMin()
|
java.lang.String |
getName()
|
float |
getPos(int xy)
compute the real position of the node |
TreeNode |
getRightmostLeaf()
|
float |
getWeight()
|
boolean |
isAncestorOf(TreeNode that)
|
boolean |
isInteriorNode()
|
boolean |
isLeaf()
|
boolean |
isRoot()
|
TreeNode |
lastChild()
|
TreeNode |
lca(TreeNode that)
Compute the lowest common ancestor between this node and that. |
TreeNode |
leafLca(TreeNode that)
Compute the lowest common ancestor between this leaf and "that" The two nodes must belong to the same tree and must be leaves |
int |
numberChildren()
|
TreeNode |
parent()
|
boolean |
pick(int x,
int y)
|
void |
print()
|
void |
printSubtree()
|
void |
setBcnScore(float n)
|
void |
setCachedColor(java.awt.Color c)
|
void |
setCachedFrame(int framenum)
|
void |
setCell(GridCell c)
|
void |
setFontSize(int fs)
|
void |
setName(java.lang.String s)
|
void |
setSubtreeExtremeLeaves()
|
(package private) void |
setSubtreeMinMax()
|
(package private) void |
setSubtreeNumberLeaves()
set numberLeaves field for each subnode |
void |
setWeight(double w)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
java.util.ArrayList children
TreeEdge[] edges
public int key
public GridCell cell
private int min
private int max
private int fontSize
java.lang.Double bcnScore
float[] nodeOffset
public java.awt.Color cachedColor
public int cachedFrame
public TreeNode parent
java.lang.String name
public java.lang.String label
int height
public float weight
public TreeNode leftmostLeaf
public TreeNode rightmostLeaf
public int numberLeaves
public TreeNode preorderNext
public TreeNode posorderNext
public int lindex
public TreeNode next
| Constructor Detail |
public TreeNode()
public TreeNode(java.lang.String s,
float w)
s - The name of the node given by a stringw - The weight of the edge immediately above the nodepublic TreeNode(java.lang.String s)
| Method Detail |
public int getMin()
getMin in interface CellGeompublic int getMax()
getMax in interface CellGeompublic int getKey()
getKey in interface CellGeompublic java.lang.String getName()
getName in interface CellGeompublic void setCachedColor(java.awt.Color c)
public java.awt.Color getCachedColor()
public void setCachedFrame(int framenum)
public int getCachedFrame()
public AccordionTreeDrawer getDrawer()
public boolean pick(int x,
int y)
pick in interface CellGeompublic float getPos(int xy)
public void drawInCell(java.awt.Color col,
float plane,
AccordionDrawer d)
drawInCell in interface CellGeomcol - The color to draw this node inplane - The plane to draw this node inGridCellpublic void setCell(GridCell c)
setCell in interface CellGeompublic GridCell getCell()
getCell in interface CellGeom
public void addEdge(TreeEdge edge,
int xy)
public TreeEdge getEdge(int xy)
public int compareTo(java.lang.Object o)
compareTo in interface java.lang.Comparablepublic void close()
TreeEdge.close,
Tree.close
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic void setName(java.lang.String s)
public int numberChildren()
public TreeNode getChild(int i)
public TreeNode getLeftmostLeaf()
public TreeNode getRightmostLeaf()
public boolean isLeaf()
public boolean isRoot()
public int getLeafCount()
public boolean equals(TreeNode n)
public void addChild(TreeNode n)
public TreeNode parent()
public void setWeight(double w)
public float getWeight()
public TreeNode firstChild()
public TreeNode lastChild()
public boolean isAncestorOf(TreeNode that)
that - Another TreeNode object
true if this is an ancestor of thatpublic TreeNode lca(TreeNode that)
that.
The two nodes must belong to the same tree.
- Parameters:
that - A TreeNode in the Tree that this TreeNode belongs to
- Returns:
- the lowest common ancestor between this node and "that"
public TreeNode leafLca(TreeNode that)
that - A TreeNode in the Tree that this TreeNode belongs to
that, null if one of the nodes is not a leafpublic void print()
public void printSubtree()
public void setSubtreeExtremeLeaves()
void setSubtreeMinMax()
void setSubtreeNumberLeaves()
public java.lang.String toString()
toString in class java.lang.Objectpublic void setFontSize(int fs)
public int getFontSize()
public boolean isInteriorNode()
public void setBcnScore(float n)
public java.lang.Double getBcnScore()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||