Package org.parboiled.trees
Class MutableBinaryTreeNodeImpl<T extends MutableBinaryTreeNode<T>>
- java.lang.Object
-
- org.parboiled.trees.MutableTreeNodeImpl<T>
-
- org.parboiled.trees.MutableBinaryTreeNodeImpl<T>
-
- Type Parameters:
T
- the actual implementation type of this MutableBinaryTreeNodeImpl
- All Implemented Interfaces:
BinaryTreeNode<T>
,GraphNode<T>
,MutableTreeNode<T>
,TreeNode<T>
public class MutableBinaryTreeNodeImpl<T extends MutableBinaryTreeNode<T>> extends MutableTreeNodeImpl<T> implements BinaryTreeNode<T>
A simpleMutableBinaryTreeNode
implementation based on theMutableTreeNodeImpl
.
-
-
Constructor Summary
Constructors Constructor Description MutableBinaryTreeNodeImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChild(int index, T child)
Adds the given child to this nodes children list and setting the childs parent field to this node.T
left()
Returns the left sub node.T
removeChild(int index)
Removes the child with the given index.T
right()
Returns the right sub node.void
setLeft(T node)
void
setRight(T node)
-
Methods inherited from class org.parboiled.trees.MutableTreeNodeImpl
getChildren, getParent, setChild
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.parboiled.trees.GraphNode
getChildren
-
-
-
-
Method Detail
-
left
public T left()
Description copied from interface:BinaryTreeNode
Returns the left sub node.- Specified by:
left
in interfaceBinaryTreeNode<T extends MutableBinaryTreeNode<T>>
- Returns:
- the left sub node
-
setLeft
public void setLeft(T node)
-
right
public T right()
Description copied from interface:BinaryTreeNode
Returns the right sub node.- Specified by:
right
in interfaceBinaryTreeNode<T extends MutableBinaryTreeNode<T>>
- Returns:
- the right sub node
-
setRight
public void setRight(T node)
-
addChild
public void addChild(int index, T child)
Description copied from interface:MutableTreeNode
Adds the given child to this nodes children list and setting the childs parent field to this node. If the child is currently attached to another node it is first removed.- Specified by:
addChild
in interfaceMutableTreeNode<T extends MutableBinaryTreeNode<T>>
- Overrides:
addChild
in classMutableTreeNodeImpl<T extends MutableBinaryTreeNode<T>>
- Parameters:
index
- the index under which to insert this child into the children listchild
- the child node to add
-
removeChild
public T removeChild(int index)
Description copied from interface:MutableTreeNode
Removes the child with the given index.- Specified by:
removeChild
in interfaceMutableTreeNode<T extends MutableBinaryTreeNode<T>>
- Overrides:
removeChild
in classMutableTreeNodeImpl<T extends MutableBinaryTreeNode<T>>
- Parameters:
index
- the index of the child to remove.- Returns:
- the removed child
-
-