public class TreeNode<T,S>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.util.List<TreeNode<T,S>> |
children |
T |
data |
Modifier and Type | Method and Description |
---|---|
void |
addChild(TreeNode<T,S> child)
Adds a child to the list of children for this TreeNode
|
boolean |
containsChild(TreeNode<T,S> TreeNode) |
TreeNode<T,S> |
getChild(TreeNode<T,S> TreeNode) |
java.util.List<TreeNode<T,S>> |
getChildren()
Return the children of TreeNode
|
T |
getData() |
S |
getNodeId() |
int |
getNumberOfChildren()
Returns the number of immediate children of this TreeNode
|
void |
insertChildAt(int index,
TreeNode<T,S> child)
Inserts a TreeNode
|
void |
setChildren(java.util.List<TreeNode<T,S>> children)
Sets the children of a TreeNode
|
void |
setData(T data) |
void |
setNodeId(S nodeId) |
java.lang.String |
toString() |
public TreeNode(S nodeId)
public TreeNode()
public java.util.List<TreeNode<T,S>> getChildren()
public void setChildren(java.util.List<TreeNode<T,S>> children)
children
- the Listpublic int getNumberOfChildren()
public void addChild(TreeNode<T,S> child)
child
- a TreeNodepublic void insertChildAt(int index, TreeNode<T,S> child) throws java.lang.IndexOutOfBoundsException
index
- the position to insert at.child
- the TreeNodejava.lang.IndexOutOfBoundsException
- if thrown.public T getData()
public void setData(T data)
public java.lang.String toString()
toString
in class java.lang.Object
public S getNodeId()
public void setNodeId(S nodeId)
nodeId
- the nodeId to setCopyright © 2007-2020 EDIT. All Rights Reserved.