T - Type of the value object stored in the node.public class TreeNodeImpl<T> extends Object implements TreeNode<T>
| Modifier and Type | Field and Description |
|---|---|
List<TreeNode<T>> |
children
The list of child nodes.
|
T |
value
The value of the node.
|
| Constructor and Description |
|---|
TreeNodeImpl()
Construct an empty node.
|
TreeNodeImpl(T value)
Construct a node holding the given value.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(TreeNode<T> tn)
Add a child node.
|
List<TreeNode<T>> |
getChildren()
Get all children
|
T |
getValue() |
boolean |
isLeaf()
Does this tree node contain no children
|
Iterator<TreeNode<T>> |
iterator() |
void |
removeChild(TreeNode<T> tn)
Remove a child node (if it exists)
|
void |
setValue(T value)
Set the node value
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic TreeNodeImpl()
public TreeNodeImpl(T value)
value - the value.public void setValue(T value)
TreeNodepublic List<TreeNode<T>> getChildren()
TreeNodegetChildren in interface TreeNode<T>public void addChild(TreeNode<T> tn)
TreeNodepublic void removeChild(TreeNode<T> tn)
TreeNoderemoveChild in interface TreeNode<T>tn - the child node to removepublic boolean isLeaf()
TreeNode