| Modifier and Type | Method and Description |
|---|---|
Tree<T> |
Tree.firstChild()
Returns the leftmost child of this node, or
null if
this node has no children. |
Tree<T> |
Tree.lastChild()
Returns the rightmost child of this node, or
null if
this node has no children. |
Tree<T> |
Tree.nextSibling()
Returns the next child of the parent of this node,
or
null if there are no additional children. |
Tree<T> |
Tree.parent()
Returns the parent of this node, or
null if
this node is the root. |
Tree<T> |
Tree.previousSibling()
Returns the previous child of the parent of this node,
or
null if there are no prior children. |
| Modifier and Type | Method and Description |
|---|---|
java.util.ArrayList<Tree<T>> |
Tree.children()
Returns a list of the children of this node.
|
java.util.Iterator<Tree<T>> |
Tree.iterator()
Returns a preorder iterator for this Tree.
|
| Modifier and Type | Method and Description |
|---|---|
void |
Tree.addChild(Tree<T> newChild)
Adds a child to this node, following any previously existing
children.
|
void |
Tree.addChildren(Tree<T>... newChildren)
Adds any number of children to this node, following any
previously existing children.
|
boolean |
Tree.hasAncestor(Tree<T> ancestor)
Tests whether its parameter is an ancestor node of this node.
|