Modifier and Type | Field and Description |
---|---|
private java.util.List<Tree.Entry<E>> |
children |
private int |
depth |
private E |
node |
private Tree.Entry<E> |
parent |
private Tree<E> |
tree |
Modifier | Constructor and Description |
---|---|
private |
Tree.Entry(Tree<E> tree,
E node,
Tree.Entry<E> parent) |
Modifier and Type | Method and Description |
---|---|
Tree.Entry<E> |
addChild(E child)
Add a child to the node.
|
private void |
addChildEntry(Tree.Entry<E> child) |
java.util.List<Tree.Entry<E>> |
getChildren()
Get the list of entries for the children to this node.
|
int |
getDepth()
Get the depth of this entry within the tree.
|
E |
getNode()
Get the node element object.
|
int |
getNumChildren()
Get the number of children added to this node.
|
Tree.Entry<E> |
getParent()
Get the entry for the parent node.
|
boolean |
isFirstChild(E child)
Check if the specified object is the first child to this node.
|
boolean |
isLastChild(E child)
Check if the specified object is the last child to this node.
|
private final E node
private final Tree.Entry<E> parent
private java.util.List<Tree.Entry<E>> children
private final int depth
private Tree.Entry(Tree<E> tree, E node, Tree.Entry<E> parent)
public E getNode()
public Tree.Entry<E> getParent()
Entry
object or null if this is the root entrypublic int getDepth()
public Tree.Entry<E> addChild(E child)
child
- The child to addEntry
object of the new child nodejava.lang.IllegalArgumentException
- If the child already exists in the treepublic int getNumChildren()
public java.util.List<Tree.Entry<E>> getChildren()
List
containing the entries for the children
or null if no children has been added to this nodepublic boolean isFirstChild(E child)
child
- The object to checkpublic boolean isLastChild(E child)
child
- The object to checkprivate void addChildEntry(Tree.Entry<E> child)