T
- the actual implementation type of this MutableBinaryTreeNodeImplpublic class MutableBinaryTreeNodeImpl<T extends MutableBinaryTreeNode<T>> extends MutableTreeNodeImpl<T> implements BinaryTreeNode<T>
MutableBinaryTreeNode
implementation based on the MutableTreeNodeImpl
.Constructor and Description |
---|
MutableBinaryTreeNodeImpl() |
Modifier and Type | Method and 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) |
getChildren, getParent, setChild
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getChildren
public T left()
BinaryTreeNode
left
in interface BinaryTreeNode<T extends MutableBinaryTreeNode<T>>
public void setLeft(T node)
public T right()
BinaryTreeNode
right
in interface BinaryTreeNode<T extends MutableBinaryTreeNode<T>>
public void setRight(T node)
public void addChild(int index, T child)
MutableTreeNode
addChild
in interface MutableTreeNode<T extends MutableBinaryTreeNode<T>>
addChild
in class MutableTreeNodeImpl<T extends MutableBinaryTreeNode<T>>
index
- the index under which to insert this child into the children listchild
- the child node to addpublic T removeChild(int index)
MutableTreeNode
removeChild
in interface MutableTreeNode<T extends MutableBinaryTreeNode<T>>
removeChild
in class MutableTreeNodeImpl<T extends MutableBinaryTreeNode<T>>
index
- the index of the child to remove.