Package fr.formiko.usuel.structures
Class TreeNode<T>
java.lang.Object
fr.formiko.usuel.structures.Node
fr.formiko.usuel.structures.TreeNode<T>
- All Implemented Interfaces:
Serializable
TreeNode used by tree.
It have a parent, children & content.
It have a parent, children & content.
- Author:
- Hydrolien
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a child to the children list.voidaddChildren(int x)Add x child to the children list.voidaddChildren(T childContent)Add a child to the children list.(package private) voidaddFileAsNode(File file)Add a folder (and it's sub folder) at this TreeNode.(package private) voidcopyStructure(TreeNode<T> nodeIn)Copy the structure of a given TreeNode into this.getChildren(int index)intvoidsetContent(T content)toString()toString(int id)Compact toString function.
-
Field Details
-
-
parent
-
children
-
-
Constructor Details
-
TreeNode
Main constructor. -
TreeNode
public TreeNode()Secondary constructor used only by the Tree constructor.
-
-
Method Details
-
getParent
-
getChildren
- Overrides:
getChildrenin classNode
-
getChildren
-
getChildrenSize
public int getChildrenSize() -
getContent
-
setContent
-
toString
Compact toString function. -
toString
-
addChildren
Add a child to the children list.- Parameters:
childContent- the content of the child.
-
addChildren
public void addChildren()Add a child to the children list. -
addChildren
public void addChildren(int x)Add x child to the children list.- Parameters:
x- the number of children to add
-
addFileAsNode
Add a folder (and it's sub folder) at this TreeNode.
It sort file name to be sur to get it in the same order in Windows & Linux. (Linux don't give us file in alphabetic order)- Parameters:
file- file to Transform into TreeNode.
-
copyStructure
Copy the structure of a given TreeNode into this. content of node will not be copy.- Parameters:
nodeIn- TreeNode to copy.
-