Package org.aksw.deer.util
Class TreeX<T>
- java.lang.Object
-
- org.aksw.deer.util.TreeX<T>
-
public class TreeX<T> extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description TreeX()Create an empty tree nodeTreeX(java.util.List<TreeX<T>> parents, T value, java.util.List<TreeX<T>> childrenlist)create tree node with many parents and many childrenTreeX(java.util.List<TreeX<T>> parents, T value, TreeX<T> child)create tree node with many parents and a single childTreeX(TreeX<T> root)Copy constructorTreeX(TreeX<T> parent, T value, java.util.List<TreeX<T>> childrenlist)create tree node with a single parent and many childrenTreeX(T value)Create a tree node with the given value with a null parents and children
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TreeX<T>addChild(TreeX<T> child)Add child node to the current tree nodeTreeX<T>addParent(TreeX<T> parent)Add parent node to the current tree nodelongdepth()java.util.List<TreeX<T>>getchildren()java.util.List<TreeX<T>>getChildren()java.util.Set<TreeX<T>>getLeaves()returns tree leavesTreeX<T>getParent()Return the first parentjava.util.List<TreeX<T>>getParents()Return all parentsTgetValue()longlevel()static voidmain(java.lang.String[] args)voidprint()Print current tree in consolevoidremoveChild(TreeX<T> child)Remove ChildvoidsetChildren(java.util.List<TreeX<T>> children)voidsetParent(TreeX<T> parent)voidsetParents(java.util.List<TreeX<T>> parents)longsize()
-
-
-
Constructor Detail
-
TreeX
public TreeX(java.util.List<TreeX<T>> parents, T value, java.util.List<TreeX<T>> childrenlist)
create tree node with many parents and many children
-
TreeX
public TreeX(TreeX<T> parent, T value, java.util.List<TreeX<T>> childrenlist)
create tree node with a single parent and many children
-
TreeX
public TreeX(java.util.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 Detail
-
main
public static void main(java.lang.String[] args)
-
addParent
public TreeX<T> addParent(TreeX<T> parent)
Add parent node to the current tree node- Returns:
- the added parent node
-
getchildren
public java.util.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
-
-