Each Tree instance represents a node. Children are added via add(String)
or add(Tree), and both return the child node, allowing subtrees to be built
by chaining calls on the returned reference.
Rendering is performed from the root node via get(). Calling get()
on a child node renders only the subtree rooted at that node.
Note
This class is not thread-safe.
| Modifier and Type | Field and Description |
|---|---|
| private final List | |
| pack-priv static final String | |
| pack-priv static final String | |
| private final AnsiCode[] | |
| pack-priv static final String | |
| private final String | |
| private Tree | |
| pack-priv static final String | |
| private final TreeConfiguration |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| private |
| Modifier and Type | Method and Description |
|---|---|
| public Tree | |
| public Tree | |
| pack-priv void | |
| private void | |
| pack-priv List | |
| public boolean | equals(Object o)
Overrides java. Indicates whether some other object is "equal to" this one. |
| public String | Returns: the rendered tree as a stringImplements io. Renders this node and all its descendants as a formatted tree string. |
| public int | |
| public Optional | |
| public String | |
| pack-priv void |
| children | back to summary |
|---|---|
| private final List<Tree> children | |
| CONNECTING_LINE | back to summary |
|---|---|
| pack-priv static final String CONNECTING_LINE | |
| CONNECTOR | back to summary |
|---|---|
| pack-priv static final String CONNECTOR | |
| connectorColor | back to summary |
|---|---|
| private final AnsiCode[] connectorColor | |
| END_CONNECTOR | back to summary |
|---|---|
| pack-priv static final String END_CONNECTOR | |
| label | back to summary |
|---|---|
| private final String label | |
| parent | back to summary |
|---|---|
| private Tree parent | |
| SPACE | back to summary |
|---|---|
| pack-priv static final String SPACE | |
| treeConfiguration | back to summary |
|---|---|
| private final TreeConfiguration treeConfiguration | |
| Tree | back to summary |
|---|---|
| public Tree(String label) | |
| Tree | back to summary |
|---|---|
| public Tree(String label, TreeConfiguration treeConfiguration) | |
| Tree | back to summary |
|---|---|
| private Tree(String label, TreeConfiguration treeConfiguration, Tree parent) | |
| add | back to summary |
|---|---|
| public Tree add(String label) Creates a new child node with the given label and appends it to this node's children. The child inherits this node's
| |
| add | back to summary |
|---|---|
| public Tree add(Tree tree) Appends an existing The provided tree is re-parented to this node. The returned node is the provided child, not this node.
| |
| assertNotSelf | back to summary |
|---|---|
| pack-priv void assertNotSelf(Tree tree) | |
| buildTree | back to summary |
|---|---|
| private void buildTree(Tree node, String prefix, boolean isLast, StyleBuilder sb) | |
| children | back to summary |
|---|---|
| pack-priv List | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| get | back to summary |
|---|---|
| public String get() Implements io. Renders this node and all its descendants as a formatted tree string. If a parser is configured via | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| parent | back to summary |
|---|---|
| public Optional Returns the parent of this node, or an empty | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
| validateLabel | back to summary |
|---|---|
| pack-priv void validateLabel(String label) | |