Package jadex.commons.collection
Class TreeNode
- java.lang.Object
 - 
- jadex.commons.collection.TreeNode
 
 
- 
public class TreeNode extends java.lang.ObjectRepresents a node of a tree. 
- 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChild(TreeNode child)Adds a child to the list of children for this node.java.util.List<TreeNode>getChildren()Return the children of node.java.lang.ObjectgetData()Get the node data.intgetNumberOfChildren()Returns the number of immediate children of this node.voidinsertChildAt(int index, TreeNode child)Inserts a node at the specified position in the child list.voidremoveChildAt(int index)Remove the Node element at index index of the List.voidsetChildren(java.util.List<TreeNode> children)Sets the children of a Node object.voidsetData(java.lang.Object data)Set the node data.java.lang.StringtoString()Get the string representation. 
 - 
 
- 
- 
Field Detail
- 
data
protected java.lang.Object data
The user node data. 
- 
children
public java.util.List<TreeNode> children
The children. 
 - 
 
- 
Method Detail
- 
getChildren
public java.util.List<TreeNode> getChildren()
Return the children of node.- Returns:
 - The children of node.
 
 
- 
setChildren
public void setChildren(java.util.List<TreeNode> children)
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
public void addChild(TreeNode child)
Adds a child to the list of children for this node.- Parameters:
 child- a Node
 
- 
insertChildAt
public void insertChildAt(int index, TreeNode child) throws java.lang.IndexOutOfBoundsExceptionInserts 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:
 java.lang.IndexOutOfBoundsException- if thrown.
 
- 
removeChildAt
public void removeChildAt(int index) throws java.lang.IndexOutOfBoundsExceptionRemove the Node element at index index of the List.- Parameters:
 index- the index of the element to delete.- Throws:
 java.lang.IndexOutOfBoundsException- if thrown.
 
- 
getData
public java.lang.Object getData()
Get the node data.- Returns:
 - The node data.
 
 
- 
setData
public void setData(java.lang.Object data)
Set the node data.- Parameters:
 data- The node data.
 
- 
toString
public java.lang.String toString()
Get the string representation.- Overrides:
 toStringin classjava.lang.Object- Returns:
 - The string representation.
 
 
 - 
 
 -