public abstract class AbstractBottomUpTreeNode extends Object implements TreeNode
| Constructor and Description |
|---|
AbstractBottomUpTreeNode()
Create a new instance of a
AbstractBottomUpTreeNode that serves as leaf node for a tree. |
AbstractBottomUpTreeNode(List<TreeNode> children)
Create a new instance of a
AbstractBottomUpTreeNode. |
AbstractBottomUpTreeNode(TreeNode... children)
Create a new instance of a
AbstractBottomUpTreeNode. |
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(TreeNode child)
Add a child node below this node.
|
TreeNode |
getChild(int index)
Get child node by position in the list of siblings.
|
List<TreeNode> |
getChildren()
Get all child nodes of this node
|
TreeNode |
getParent()
Get the parent of this node
|
TreeNode |
getRoot()
Get the root of the tree
|
boolean |
isChild()
Check whether this node is a child node
|
boolean |
isFirstSibling()
Check whether a child is the first in the list of siblings
|
boolean |
isRoot()
Check whether this node is the root of the tree.
|
boolean |
isSibling(TreeNode node)
Check whether this node is a sibling of the second node.
|
void |
setParent(TreeNode parent)
Set a parent for this node.
|
public AbstractBottomUpTreeNode()
AbstractBottomUpTreeNode that serves as leaf node for a tree.public AbstractBottomUpTreeNode(List<TreeNode> children)
AbstractBottomUpTreeNode.children - child nodes to be linked to this node.public AbstractBottomUpTreeNode(TreeNode... children)
AbstractBottomUpTreeNode.children - child nodes to be linked to this node.public TreeNode getRoot()
TreeNodepublic TreeNode getParent()
TreeNodepublic void addChild(TreeNode child)
TreeNodeImportant: this also automatically creates a link in the opposite direction. All implementations must adhere to this rule.
public List<TreeNode> getChildren()
TreeNodegetChildren in interface TreeNodepublic TreeNode getChild(int index)
TreeNodepublic boolean isRoot()
TreeNodepublic boolean isChild()
TreeNodepublic boolean isSibling(TreeNode node)
TreeNodepublic void setParent(TreeNode parent)
TreeNodepublic boolean isFirstSibling()
TreeNodeisFirstSibling in interface TreeNodetrue if the child is the first in the list of siblingsCopyright © 2018–2020. All rights reserved.