protected static class LinkedBinaryTree.Node<E> extends Object implements Position<E>
Constructor and Description |
---|
LinkedBinaryTree.Node(E e,
LinkedBinaryTree.Node<E> above,
LinkedBinaryTree.Node<E> leftChild,
LinkedBinaryTree.Node<E> rightChild)
Constructs a node with the given element and neighbors.
|
Modifier and Type | Method and Description |
---|---|
E |
getElement()
Returns the element stored at this position.
|
LinkedBinaryTree.Node<E> |
getLeft() |
LinkedBinaryTree.Node<E> |
getParent() |
LinkedBinaryTree.Node<E> |
getRight() |
void |
setElement(E e) |
void |
setLeft(LinkedBinaryTree.Node<E> leftChild) |
void |
setParent(LinkedBinaryTree.Node<E> parentNode) |
void |
setRight(LinkedBinaryTree.Node<E> rightChild) |
public LinkedBinaryTree.Node(E e, LinkedBinaryTree.Node<E> above, LinkedBinaryTree.Node<E> leftChild, LinkedBinaryTree.Node<E> rightChild)
e
- the element to be storedabove
- reference to a parent nodeleftChild
- reference to a left child noderightChild
- reference to a right child nodepublic E getElement()
Position
getElement
in interface Position<E>
public LinkedBinaryTree.Node<E> getParent()
public LinkedBinaryTree.Node<E> getLeft()
public LinkedBinaryTree.Node<E> getRight()
public void setElement(E e)
public void setParent(LinkedBinaryTree.Node<E> parentNode)
public void setLeft(LinkedBinaryTree.Node<E> leftChild)
public void setRight(LinkedBinaryTree.Node<E> rightChild)