Package org.aksw.deer.util
Class TreeX<T>
java.lang.Object
org.aksw.deer.util.TreeX<T>
-
Constructor Summary
ConstructorsConstructorDescriptionTreeX()Create an empty tree nodecreate tree node with many parents and many childrencreate tree node with many parents and a single childCopy constructorcreate tree node with a single parent and many childrenCreate a tree node with the given value with a null parents and children -
Method Summary
Modifier and TypeMethodDescriptionAdd child node to the current tree nodeAdd parent node to the current tree nodelongdepth()returns tree leavesReturn the first parentReturn all parentsgetValue()longlevel()static voidvoidprint()Print current tree in consolevoidremoveChild(TreeX<T> child)Remove ChildvoidsetChildren(List<TreeX<T>> children)voidvoidsetParents(List<TreeX<T>> parents)longsize()
-
Constructor Details
-
TreeX
create tree node with many parents and many children -
TreeX
Copy constructor -
TreeX
create tree node with a single parent and many children -
TreeX
create tree node with many parents and a single child -
TreeX
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
-
getChildren
- Returns:
- the children
-
setChildren
- Parameters:
children-
-
getLeaves
returns tree leaves -
addChild
Add child node to the current tree node -
addParent
Add parent node to the current tree node- Returns:
- the added parent node
-
removeChild
Remove Child -
getParent
Return the first parent -
setParent
- Parameters:
parent-
-
getParents
Return all parents -
setParents
- Parameters:
parents-
-
getchildren
- Returns:
- a list of all children nodes of the current tree node
-
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
-