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 SummaryAll 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- 
dataprotected java.lang.Object data The user node data.
 - 
childrenpublic java.util.List<TreeNode> children The children.
 
- 
 - 
Method Detail- 
getChildrenpublic java.util.List<TreeNode> getChildren() Return the children of node.- Returns:
- The children of node.
 
 - 
setChildrenpublic void setChildren(java.util.List<TreeNode> children) Sets the children of a Node object.- Parameters:
- children- The list to set.
 
 - 
getNumberOfChildrenpublic int getNumberOfChildren() Returns the number of immediate children of this node.- Returns:
- the number of immediate children.
 
 - 
addChildpublic void addChild(TreeNode child) Adds a child to the list of children for this node.- Parameters:
- child- a Node
 
 - 
insertChildAtpublic 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.
 
 - 
removeChildAtpublic 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.
 
 - 
getDatapublic java.lang.Object getData() Get the node data.- Returns:
- The node data.
 
 - 
setDatapublic void setData(java.lang.Object data) Set the node data.- Parameters:
- data- The node data.
 
 - 
toStringpublic java.lang.String toString() Get the string representation.- Overrides:
- toStringin class- java.lang.Object
- Returns:
- The string representation.
 
 
- 
 
-