Class TreeNode<T>

java.lang.Object
fr.formiko.usuel.structures.Node
fr.formiko.usuel.structures.TreeNode<T>
All Implemented Interfaces:
Serializable

class TreeNode<T> extends Node
TreeNode used by tree.
It have a parent, children & content.
Author:
Hydrolien
  • Field Details

  • Constructor Details

    • TreeNode

      public TreeNode(TreeNode<T> parent)
      Main constructor.
    • TreeNode

      public TreeNode()
      Secondary constructor used only by the Tree constructor.
  • Method Details

    • getParent

      public TreeNode<T> getParent()
    • getChildren

      public TreeNode<T> getChildren(int index)
      Overrides:
      getChildren in class Node
    • getChildren

      public Liste<TreeNode<T>> getChildren()
    • getChildrenSize

      public int getChildrenSize()
    • getContent

      public T getContent()
    • setContent

      public void setContent(T content)
    • toString

      public String toString(int id)
      Compact toString function.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • addChildren

      public void addChildren(T childContent)
      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

      void addFileAsNode(File file)
      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

      void copyStructure(TreeNode<T> nodeIn)
      Copy the structure of a given TreeNode into this. content of node will not be copy.
      Parameters:
      nodeIn - TreeNode to copy.