|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsoftparsmap.Node
Define common behavior for gene and species nodes and trees. When writing 'this subtree' below it refers to the tree where this node is the root.
Constructor Summary | |
Node(int label)
Constructs a gene node with given label. |
Method Summary | |
Node |
addChild(Node child)
Adds a child under this parent and sets the child's parent as this node. |
int |
compareTo(java.lang.Object o)
Returns this label number minus the given nodes label number. |
boolean |
equals(java.lang.Object o)
Two nodes are equal iff they have the same label. |
Node |
findLCA(java.util.Set leaves)
Find the last common ancestor in this subtree for the given set of leaves. |
java.util.Set |
getChildren()
Returns the child set containing the children. |
int |
getLabel()
Returns the label. |
java.util.Set |
getLeaves()
Return the leaves of this subtree. |
java.util.Map |
getMap()
Returns a map that can be used to save any additional information associated with this node. |
java.util.Set |
getNodes()
Return all internal nodes and leaves in this subtree. |
Node |
getParent()
Returns the parent of this node. |
Node |
getRoot()
Returns the root of this tree. |
java.util.List |
getSplits()
Returns the splits that exist in this tree. |
boolean |
hasChildren()
Returns true if this node has children, else false. |
int |
hashCode()
Returns the label value. |
boolean |
isBinaryTree()
Return true if the subtree where this node is the root is binary, else false. |
boolean |
isConsistentWith(Node tree)
Returns true if this tree is consistent with the given tree. |
boolean |
isRoot()
Returns true if this node is the root of the tree. |
static int |
nextUnique()
Returns the next unique integer. |
int |
numChildren()
Returns the number of children this node has. |
Node |
pruneOneChildNodes()
Remove all internal nodes with only one child. |
boolean |
removeChild(Node child)
Remove the child from this parent and set the child's parent to null. |
void |
setMap(java.util.Map map)
|
static void |
setNextUnique(int newNextUnique)
|
java.lang.String |
toString()
Returns the label number. |
java.lang.String |
toStringAll()
Return toStringTree() and toStringTable() . |
java.lang.String |
toStringTable()
Returns a table of all the attribute information that is found in this subtree. |
java.lang.String |
toStringTree()
Returns a easy to read tree of this subtree. |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Node(int label)
label
- the label for this node. Two labels in the same
tree can not be the same.Method Detail |
public java.util.List getSplits()
Split
public java.util.Map getMap()
public void setMap(java.util.Map map)
public boolean isConsistentWith(Node tree)
Split
public Node findLCA(java.util.Set leaves)
leaves
- is a subset of all leaves in this tree
public boolean isBinaryTree()
public java.util.Set getNodes()
public java.util.Set getLeaves()
public Node pruneOneChildNodes()
public Node getRoot()
public boolean equals(java.lang.Object o)
public int hashCode()
equals(java.lang.Object)
.
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
o
- is the given node
Comparable
public boolean removeChild(Node child)
child
- is the child of this parent that will be removed.
public Node addChild(Node child)
child
- is the new child.
FatalException
- if there already exists a child with the
the same label.public Node getParent()
public boolean isRoot()
public int getLabel()
public java.lang.String toString()
public java.lang.String toStringAll()
toStringTree()
and toStringTable()
.
toStringTree()
and toStringTable()
public java.lang.String toStringTree()
public java.lang.String toStringTable()
public boolean hasChildren()
public int numChildren()
public java.util.Set getChildren()
public static int nextUnique()
public static void setNextUnique(int newNextUnique)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |