|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.entityfs.support.util.TreeNode<T>
public class TreeNode<T>
This is a simple implementation of a node in a linked tree of objects. The node contains a value and an optional list of child nodes. This can be used to create simple object trees.
The tree node value cannot be modified after it has been created. New child entities can be added though.
Objects of this class are not thread safe.
Constructor Summary | |
---|---|
TreeNode(T value)
Create a new tree node. |
Method Summary | |
---|---|
TreeNode<T> |
addChildNode(TreeNode<T> n)
Add one child node. |
TreeNode<T> |
addChildNodes(Collection<? extends TreeNode<T>> c)
Add a collection of child nodes. |
boolean |
equals(Object o)
|
Set<TreeNode<T>> |
getChildNodes()
Get the set of child nodes. |
T |
getValue()
Get the tree node's value. |
int |
hashCode()
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TreeNode(T value) throws NullPointerException
value
- The node's value.
NullPointerException
- If value
is null
.Method Detail |
---|
public T getValue()
public TreeNode<T> addChildNode(TreeNode<T> n)
n
- A child node.
this
public TreeNode<T> addChildNodes(Collection<? extends TreeNode<T>> c)
c
- A collection of child nodes.
this
public Set<TreeNode<T>> getChildNodes()
Changes made to the set will modify the state of this object.
null
.public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |