Package com.zybooks.dsaj.tree
Class LinkedBinaryTree.Node<E>
java.lang.Object
com.zybooks.dsaj.tree.LinkedBinaryTree.Node<E>
- Type Parameters:
E
- type of element to be stored at each position of the tree
- All Implemented Interfaces:
Position<E>
- Direct Known Subclasses:
TreeMap.BalanceableBinaryTree.BSTNode
- Enclosing class:
LinkedBinaryTree<E>
Nested static class for a binary tree node.
-
Constructor Summary
ConstructorDescriptionNode
(E e, LinkedBinaryTree.Node<E> above, LinkedBinaryTree.Node<E> leftChild, LinkedBinaryTree.Node<E> rightChild) Constructs a node with the given element and neighbors. -
Method Summary
Modifier and TypeMethodDescriptionReturns the element stored at this position.getLeft()
getRight()
void
setElement
(E e) void
setLeft
(LinkedBinaryTree.Node<E> leftChild) void
setParent
(LinkedBinaryTree.Node<E> parentNode) void
setRight
(LinkedBinaryTree.Node<E> rightChild)
-
Constructor Details
-
Node
public Node(E e, LinkedBinaryTree.Node<E> above, LinkedBinaryTree.Node<E> leftChild, LinkedBinaryTree.Node<E> rightChild) Constructs a node with the given element and neighbors.- Parameters:
e
- the element to be storedabove
- reference to a parent nodeleftChild
- reference to a left child noderightChild
- reference to a right child node
-
-
Method Details
-
getElement
Description copied from interface:Position
Returns the element stored at this position.- Specified by:
getElement
in interfacePosition<E>
- Returns:
- the stored element
-
getParent
-
getLeft
-
getRight
-
setElement
-
setParent
-
setLeft
-
setRight
-