N
- the kind of elements in the treepublic interface Tree<N>
Modifier and Type | Method and Description |
---|---|
void |
dump(PrintWriter writer)
Dump.
|
void |
dump(PrintWriter writer,
int indent)
Dump.
|
List<N> |
fillDepthFirst()
Fill depth first.
|
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) |
Tree<N> |
getParent()
Gets the parent of this tree node.
|
List<Tree<N>> |
getPathToRoot()
Gets the path to root.
|
Tree<N> |
getRoot()
A convenience method that gets the root of this tree.
|
N |
getUserObject()
Gets the "content" of this tree node.
|
Set<N> |
getUserObjectClosure()
Gets the user object closure.
|
List<N> |
getUserObjectPathToRoot()
Gets the user object path to root.
|
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 |
setNodeRenderer(NodeRenderer<N> renderer)
Sets the node renderer.
|
void |
sortChildren(Comparator<Tree<N>> comparator)
Sorts the children using the specified comparator.
|
@Nonnull N getUserObject()
@Nonnull Tree<N> getParent()
null
if this node doesn't have a
parent.@Nonnull List<Tree<N>> getChildren()
Object getEdge(Tree<N> child)
child
- the child to usevoid sortChildren(@Nonnull Comparator<Tree<N>> comparator)
comparator
- The comparator to be used for the sorting.int getChildCount()
boolean isRoot()
true
if this is a root node, otherwise false
.boolean isLeaf()
true
if this node is a leaf node otherwise false
.@Nonnull Tree<N> getRoot()
@Nonnull List<Tree<N>> getPathToRoot()
@Nonnull List<N> getUserObjectPathToRoot()
void dump(@Nonnull PrintWriter writer)
writer
- the writer to print tovoid dump(@Nonnull PrintWriter writer, int indent)
writer
- the writer to print toindent
- how much to indentvoid setNodeRenderer(@Nonnull NodeRenderer<N> renderer)
renderer
- the renderer to use@Nonnull Set<N> getUserObjectClosure()
Copyright © 2020 The University of Manchester. All rights reserved.