public class TreeX<T> extends Object
| Constructor | Description |
|---|---|
TreeX() |
Create an empty tree node
|
TreeX(List<TreeX<T>> parents,
T value,
List<TreeX<T>> childrenlist) |
create tree node with many parents and many children
|
TreeX(List<TreeX<T>> parents,
T value,
TreeX<T> child) |
create tree node with many parents and a single child
|
TreeX(TreeX<T> root) |
Copy constructor
|
TreeX(TreeX<T> parent,
T value,
List<TreeX<T>> childrenlist) |
create tree node with a single parent and many children
|
TreeX(T value) |
Create a tree node with the given value with a null parents and children
|
| Modifier and Type | Method | Description |
|---|---|---|
TreeX<T> |
addChild(TreeX<T> child) |
Add child node to the current tree node
|
TreeX<T> |
addParent(TreeX<T> parent) |
Add parent node to the current tree node
|
long |
depth() |
|
List<TreeX<T>> |
getchildren() |
|
List<TreeX<T>> |
getChildren() |
|
Set<TreeX<T>> |
getLeaves() |
returns tree leaves
|
TreeX<T> |
getParent() |
Return the first parent
|
List<TreeX<T>> |
getParents() |
Return all parents
|
T |
getValue() |
|
long |
level() |
|
static void |
main(String[] args) |
|
void |
print() |
Print current tree in console
|
void |
removeChild(TreeX<T> child) |
Remove Child
|
void |
setChildren(List<TreeX<T>> children) |
|
void |
setParent(TreeX<T> parent) |
|
void |
setParents(List<TreeX<T>> parents) |
|
long |
size() |
public TreeX(List<TreeX<T>> parents, T value, List<TreeX<T>> childrenlist)
public TreeX(TreeX<T> parent, T value, List<TreeX<T>> childrenlist)
public TreeX(List<TreeX<T>> parents, T value, TreeX<T> child)
public TreeX(T value)
public TreeX()
public static void main(String[] args)
public TreeX<T> addParent(TreeX<T> parent)
public List<TreeX<T>> getchildren()
public T getValue()
public void print()
public long size()
public long depth()
public long level()
Copyright © 2018. All rights reserved.