N - type of elementspublic class MutableTree<N> extends Object implements Tree<N>
| Constructor and Description |
|---|
MutableTree(N userObject) |
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(MutableTree<N> child) |
void |
addChild(MutableTree<N> child,
Object edge) |
void |
clearChildren()
remove all children.
|
void |
dump(PrintWriter writer) |
void |
dump(PrintWriter writer,
int indent) |
List<N> |
fillDepthFirst() |
int |
getChildCount()
A convenience method that gets the number of child nodes that this node
has.
|
List<Tree<N>> |
getChildren()
Gets the children of this tree node.
|
Object |
getEdge(Tree<N> child) |
int |
getMaxDepth() |
Tree<N> |
getParent()
Gets the parent of this tree node.
|
List<Tree<N>> |
getPathToRoot() |
Tree<N> |
getRoot()
A convenience method that gets the root of this tree.
|
int |
getSize() |
N |
getUserObject()
Gets the "content" of this tree node.
|
Set<N> |
getUserObjectClosure() |
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)
Deprecated.
this method is not in the public interface and is unused.
|
void |
setNodeRenderer(NodeRenderer<N> renderer) |
void |
setParent(MutableTree<N> parent) |
void |
sortChildren(Comparator<Tree<N>> comparator)
Sorts the children using the specified comparator.
|
String |
toString() |
public MutableTree(N userObject)
userObject - the user objectpublic N getUserObject()
TreegetUserObject in interface Tree<N>public void setParent(MutableTree<N> parent)
parent - the new parentpublic void addChild(MutableTree<N> child)
child - child to addpublic void addChild(MutableTree<N> child, Object edge)
child - child to addedge - the edgepublic void removeChild(MutableTree<N> child)
child - child to removepublic void sortChildren(Comparator<Tree<N>> comparator)
TreesortChildren in interface Tree<N>comparator - The comparator to be used for the sorting.public void clearChildren()
public Tree<N> getParent()
Treepublic List<Tree<N>> getChildren()
TreegetChildren in interface Tree<N>public int getChildCount()
TreegetChildCount in interface Tree<N>public boolean isRoot()
Treepublic boolean isLeaf()
Treepublic Tree<N> getRoot()
Treepublic List<Tree<N>> getPathToRoot()
getPathToRoot in interface Tree<N>public List<N> getUserObjectPathToRoot()
getUserObjectPathToRoot in interface Tree<N>public Set<N> getUserObjectClosure()
getUserObjectClosure in interface Tree<N>public void dump(PrintWriter writer)
public void dump(PrintWriter writer, int indent)
public void setNodeRenderer(NodeRenderer<N> renderer)
setNodeRenderer in interface Tree<N>renderer - the renderer to usepublic List<N> fillDepthFirst()
fillDepthFirst in interface Tree<N>@Deprecated public void replace(MutableTree<N> tree)
tree - the node to put in place of this onepublic int getSize()
public int getMaxDepth()
Copyright © 2014 The University of Manchester. All Rights Reserved.