X
- the label class for the constructed tree.public class TreeImpl<X> extends Object implements Tree<X>
Modifier and Type | Class and Description |
---|---|
static class |
TreeImpl.ForestBuilder<X>
This is a utility class to rapidly construct forests.
|
Constructor and Description |
---|
TreeImpl()
Constructs a new tree with label null and no children (yet).
|
TreeImpl(X label)
Constructs a new tree with the given label and no children (yet).
|
TreeImpl(X label,
List<Tree<X>> children)
Constructs a new tree with the given label and the given child trees.
|
Modifier and Type | Method and Description |
---|---|
static <X> TreeImpl.ForestBuilder<X> |
builder(X rootLabel)
Creates a ForestBuilder for the given root label, creates the root node and descends to the
children of the root node.
|
boolean |
equals(Object obj) |
List<Tree<X>> |
getChildren()
Returns the children of the root node of this tree.
|
X |
getLabel()
Returns the label for the root node of this tree.
|
int |
hashCode() |
void |
setLabel(X label)
Sets the label for the root node of this tree.
|
String |
toString() |
String |
toString(int indent) |
public TreeImpl(X label, @NonNull List<Tree<X>> children)
label
- the label for the root node of this tree.children
- the children of the root of this tree.public TreeImpl(X label)
label
- the label for the root node of this tree.public TreeImpl()
public void setLabel(X label)
label
- the label for the root node of this treepublic X getLabel()
Tree
public List<Tree<X>> getChildren()
Tree
getChildren
in interface Tree<X>
public String toString(int indent)
public static <X> TreeImpl.ForestBuilder<X> builder(X rootLabel)
X
- the label class for the newly created tree.rootLabel
- the label for the root node of the newly created tree.Copyright (C) 2016-2018 Benjamin Paaßen, AG Theoretical Computer Science, Centre of Excellence Cognitive Interaction Technology (CITEC), University of Bielefeld, licensed under the AGPL v. 3: http://openresearch.cit-ec.de/projects/tcs . This documentation is licensed under the conditions of CC-BY-SA 4.0: https://creativecommons.org/licenses/by-sa/4.0/