Package io.openml.gearbox.binarytree
Interface TreeNode<T>
- Type Parameters:
T
- The type of value stored in this tree node
- All Superinterfaces:
Visitable<T>
- All Known Implementing Classes:
ImmutableTreeNode
,MutableTreeNode
-
Method Summary
Modifier and TypeMethodDescriptiongetLeft()
Returns the reference to the left child of this tree node.getRight()
Returns the reference to the right child of this tree node.getValue()
Returns the object stored in this tree node.default boolean
isLeaf()
Returns whether thisTreeNode
is a leaf node, i.e.Returns a same instance with a specified new left child.Returns a same instance with a specified new right child.
-
Method Details
-
getValue
T getValue()Returns the object stored in this tree node.- Returns:
- an object stored in this tree node
-
getLeft
Returns the reference to the left child of this tree node.- Returns:
- the left child of this tree node, or
null
if there is no left child
-
getRight
Returns the reference to the right child of this tree node.- Returns:
- the right child of this tree node, or
null
if there is no right child
-
withLeft
Returns a same instance with a specified new left child.- Parameters:
newLeft
- The provided new left child- Returns:
- a new
TreeNode
instance
-
withRight
Returns a same instance with a specified new right child.- Parameters:
newRight
- The provided new right child- Returns:
- a new
TreeNode
instance
-
isLeaf
default boolean isLeaf()Returns whether thisTreeNode
is a leaf node, i.e. both left and right subtrees arenull
- Returns:
- true if the node is a leaf
-