Class TreeX<T>

java.lang.Object
org.aksw.deer.util.TreeX<T>

public class TreeX<T> extends Object
  • Constructor Details

    • TreeX

      public TreeX(List<TreeX<T>> parents, T value, List<TreeX<T>> childrenlist)
      create tree node with many parents and many children
    • TreeX

      public TreeX(TreeX<T> root)
      Copy constructor
    • TreeX

      public TreeX(TreeX<T> parent, T value, List<TreeX<T>> childrenlist)
      create tree node with a single parent and many children
    • TreeX

      public TreeX(List<TreeX<T>> parents, T value, TreeX<T> child)
      create tree node with many parents and a single child
    • TreeX

      public TreeX(T value)
      Create a tree node with the given value with a null parents and children
    • TreeX

      public TreeX()
      Create an empty tree node
  • Method Details

    • main

      public static void main(String[] args)
    • getChildren

      public List<TreeX<T>> getChildren()
      Returns:
      the children
    • setChildren

      public void setChildren(List<TreeX<T>> children)
      Parameters:
      children -
    • getLeaves

      public Set<TreeX<T>> getLeaves()
      returns tree leaves
    • addChild

      public TreeX<T> addChild(TreeX<T> child)
      Add child node to the current tree node
    • addParent

      public TreeX<T> addParent(TreeX<T> parent)
      Add parent node to the current tree node
      Returns:
      the added parent node
    • removeChild

      public void removeChild(TreeX<T> child)
      Remove Child
    • getParent

      public TreeX<T> getParent()
      Return the first parent
    • setParent

      public void setParent(TreeX<T> parent)
      Parameters:
      parent -
    • getParents

      public List<TreeX<T>> getParents()
      Return all parents
    • setParents

      public void setParents(List<TreeX<T>> parents)
      Parameters:
      parents -
    • getchildren

      public List<TreeX<T>> getchildren()
      Returns:
      a list of all children nodes of the current tree node
    • getValue

      public T getValue()
      Returns:
      the data value of the current tree node
    • print

      public void print()
      Print current tree in console
    • size

      public long size()
      Returns:
      tree size
    • depth

      public long depth()
      Returns:
      tree depth
    • level

      public long level()
      Returns:
      current node level