Package jadex.collection
Class TreeNode
java.lang.Object
jadex.collection.TreeNode
Represents a node of a tree.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a child to the list of children for this node.Return the children of node.getData()
Get the node data.int
Returns the number of immediate children of this node.void
insertChildAt
(int index, TreeNode child) Inserts a node at the specified position in the child list.void
removeChildAt
(int index) Remove the Node element at index index of the List.void
setChildren
(List<TreeNode> children) Sets the children of a Node object.void
Set the node data.toString()
Get the string representation.
-
Field Details
-
data
The user node data. -
children
The children.
-
-
Constructor Details
-
TreeNode
public TreeNode()Create a new node. -
TreeNode
Create a new node.
-
-
Method Details
-
getChildren
Return the children of node.- Returns:
- The children of node.
-
setChildren
Sets the children of a Node object.- Parameters:
children
- The list to set.
-
getNumberOfChildren
public int getNumberOfChildren()Returns the number of immediate children of this node.- Returns:
- the number of immediate children.
-
addChild
Adds a child to the list of children for this node.- Parameters:
child
- a Nodeobject to set.
-
insertChildAt
Inserts a node at the specified position in the child list. Will throw an ArrayIndexOutOfBoundsException if the index does not exist.- Parameters:
index
- the position to insert at.child
- the Node object to insert.- Throws:
IndexOutOfBoundsException
- if thrown.
-
removeChildAt
Remove the Node element at index index of the List.- Parameters:
index
- the index of the element to delete.- Throws:
IndexOutOfBoundsException
- if thrown.
-
getData
Get the node data.- Returns:
- The node data.
-
setData
Set the node data.- Parameters:
data
- The node data.
-
toString
Get the string representation.
-