Package com.exasol.util
Class AbstractTreeNode
- java.lang.Object
-
- com.exasol.util.AbstractTree
-
- com.exasol.util.AbstractTreeNode
-
- All Implemented Interfaces:
TreeNode
- Direct Known Subclasses:
AbstractFunction,BinaryArithmeticExpression
public abstract class AbstractTreeNode extends AbstractTree
This is an abstract base class for nodes in a tree structure.
-
-
Field Summary
-
Fields inherited from class com.exasol.util.AbstractTree
children, parent
-
-
Constructor Summary
Constructors Constructor Description AbstractTreeNode()Create a new instance of aAbstractTreeNodethat serves as root for a tree.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChild(TreeNode child)Add a child node below this node.TreeNodegetRoot()Get the root of the treevoidsetParent(TreeNode parent)Link to a parent node-
Methods inherited from class com.exasol.util.AbstractTree
getChild, getChildren, getParent, isChild, isFirstSibling, isRoot, isSibling
-
-
-
-
Constructor Detail
-
AbstractTreeNode
public AbstractTreeNode()
Create a new instance of aAbstractTreeNodethat serves as root for a tree.
-
-
Method Detail
-
setParent
public void setParent(TreeNode parent)
Link to a parent node- Parameters:
parent- the parent to which this node will be linked as a child- Throws:
IllegalArgumentException- if parent isnullor parent and child are identical
-
getRoot
public TreeNode getRoot()
Description copied from interface:TreeNodeGet the root of the tree- Returns:
- root node
-
addChild
public void addChild(TreeNode child)
Description copied from interface:TreeNodeAdd a child node below this node. Children are registered in the order in which they are added.Important: this also automatically creates a link in the opposite direction. All implementations must adhere to this rule.
- Parameters:
child- child node
-
-