|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.manchester.cs.bhig.util.MutableTree<N>
public class MutableTree<N>
Author: Matthew Horridge
The University Of Manchester
Bio-Health Informatics Group
Date: 22-Jan-2008
Constructor Summary | |
---|---|
MutableTree(N userObject)
|
Method Summary | |
---|---|
void |
addChild(MutableTree<N> child)
|
void |
clearChildren()
|
void |
dump(java.io.PrintWriter writer)
|
void |
dump(java.io.PrintWriter writer,
int indent)
|
int |
getChildCount()
A convenience method that gets the number of child nodes that this node has. |
java.util.List<Tree<N>> |
getChildren()
Gets the children of this tree node. |
Tree<N> |
getParent()
Gets the parent of this tree node. |
java.util.List<Tree<N>> |
getPathToRoot()
|
Tree<N> |
getRoot()
A convenience method that gets the root of this tree. |
N |
getUserObject()
Gets the "content" of this tree node. |
java.util.Set<N> |
getUserObjectClosure()
|
java.util.List<N> |
getUserObjectPathToRoot()
|
boolean |
isLeaf()
A convenience method that determines if this node is a leaf node (because it has no children). |
boolean |
isRoot()
A convenience method that determines if this is a root node (because it has no parent node) |
void |
removeChild(MutableTree<N> child)
|
void |
replace(MutableTree<N> tree)
|
void |
setParent(MutableTree<N> parent)
|
void |
sortChildren(java.util.Comparator<Tree<N>> comparator)
Sorts the children using the specified comparator |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MutableTree(N userObject)
Method Detail |
---|
public N getUserObject()
Tree
getUserObject
in interface Tree<N>
public void setParent(MutableTree<N> parent)
public void addChild(MutableTree<N> child)
public void removeChild(MutableTree<N> child)
public void sortChildren(java.util.Comparator<Tree<N>> comparator)
Tree
sortChildren
in interface Tree<N>
comparator
- The comparator to be used for the sorting.public void clearChildren()
public Tree<N> getParent()
Tree
getParent
in interface Tree<N>
null
if this node doesn't have a parent.public java.util.List<Tree<N>> getChildren()
Tree
getChildren
in interface Tree<N>
public int getChildCount()
Tree
getChildCount
in interface Tree<N>
public boolean isRoot()
Tree
isRoot
in interface Tree<N>
true
if this is a root node,
otherwise false
.public boolean isLeaf()
Tree
isLeaf
in interface Tree<N>
true
if this node is a leaf
node otherwise false
.public Tree<N> getRoot()
Tree
getRoot
in interface Tree<N>
public java.util.List<Tree<N>> getPathToRoot()
getPathToRoot
in interface Tree<N>
public java.util.List<N> getUserObjectPathToRoot()
getUserObjectPathToRoot
in interface Tree<N>
public java.util.Set<N> getUserObjectClosure()
getUserObjectClosure
in interface Tree<N>
public void dump(java.io.PrintWriter writer)
dump
in interface Tree<N>
public void dump(java.io.PrintWriter writer, int indent)
dump
in interface Tree<N>
public void replace(MutableTree<N> tree)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |