|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javatools.datatypes.Tree<T>
public class Tree<T>
This class is part of the Java Tools (see http://mpii.de/yago-naga/javatools). It is licensed under the Creative Commons Attribution License (see http://creativecommons.org/licenses/by/3.0) by the YAGO-NAGA team (see http://mpii.de/yago-naga). The class represents the simple datatype of a Tree.
Constructor Summary | |
---|---|
Tree()
Constructs an empty tree with a null element |
|
Tree(T element)
Constructs a tree with a node element |
|
Tree(T element,
java.util.List<Tree<T>> children)
Constructs a tree with a node element and children |
|
Tree(Tree<T> parent,
T element)
Constructs a tree with a node element and a parent |
|
Tree(Tree<T> parent,
T element,
java.util.List<Tree<T>> children)
Constructs a tree with a node element and a parent |
Method Summary | |
---|---|
void |
addChild(Tree<T> child)
Adds a child |
java.util.List<Tree<T>> |
getChildren()
Depth first search across the tree |
T |
getElement()
Returns the element |
Tree<T> |
getParent()
Returns the parent |
java.util.Iterator<T> |
iterator()
|
static void |
main(java.lang.String[] args)
|
boolean |
receive(Visitor<Tree<T>> visitor)
Receives a visitor for a depth first traversal |
void |
setChildren(java.util.List<Tree<T>> children)
Sets the children |
void |
setElement(T element)
Sets the element |
void |
setParent(Tree<T> parent)
Sets the parent |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Tree()
public Tree(T element)
public Tree(Tree<T> parent, T element)
public Tree(T element, java.util.List<Tree<T>> children)
public Tree(Tree<T> parent, T element, java.util.List<Tree<T>> children)
Method Detail |
---|
public Tree<T> getParent()
public void setParent(Tree<T> parent)
public java.util.List<Tree<T>> getChildren()
public void setChildren(java.util.List<Tree<T>> children)
public void addChild(Tree<T> child)
public T getElement()
public void setElement(T element)
public java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T>
public boolean receive(Visitor<Tree<T>> visitor) throws java.lang.Exception
receive
in interface Visitable<Tree<T>>
java.lang.Exception
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |