public class TreeNode<T> extends java.lang.Object
Constructor and Description |
---|
TreeNode(java.lang.String name,
T data,
TreeNode<T> parent) |
Modifier and Type | Method and Description |
---|---|
TreeNode<T> |
addChild(java.lang.String name,
T data)
Adds a child to this node.
|
TreeNode<T> |
getChild(int i)
Returns the i-child.
|
TreeNode<T> |
getChild(java.lang.String name)
Returns the child with the specified name.
|
int |
getChildCount() |
T |
getData() |
java.lang.String |
getName() |
TreeNode<T> |
getParent() |
TreeNode<T> |
getTreeNode(java.lang.String... names)
Based on a path-alike set of dir entries, returns the final node of it.
|
void |
setData(T data) |
void |
setName(java.lang.String name) |
public java.lang.String getName()
public void setName(java.lang.String name)
name
- the name to setpublic int getChildCount()
public TreeNode<T> getChild(int i)
i
- the index of the child to get.public TreeNode<T> getChild(java.lang.String name)
name
- the name of the child to get.public TreeNode<T> addChild(java.lang.String name, T data)
name
- the name of the child.data
- the data of the child.public TreeNode<T> getTreeNode(java.lang.String... names)
names
- a set of TreeNode entries.