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 TypeMethodDescriptionvoid
Add a child to the children list.void
addChildren(int x)
Add x child to the children list.void
addChildren(T childContent)
Add a child to the children list.(package private) void
addFileAsNode(File file)
Add a folder (and it's sub folder) at this TreeNode.(package private) void
copyStructure(TreeNode<T> nodeIn)
Copy the structure of a given TreeNode into this.getChildren(int index)
int
void
setContent(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:
getChildren
in 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.
-