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
ConstructorsConstructorDescriptionNode(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()voidsetElement(E e) voidsetLeft(LinkedBinaryTree.Node<E> leftChild) voidsetParent(LinkedBinaryTree.Node<E> parentNode) voidsetRight(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:PositionReturns the element stored at this position.- Specified by:
getElementin interfacePosition<E>- Returns:
- the stored element
-
getParent
-
getLeft
-
getRight
-
setElement
-
setParent
-
setLeft
-
setRight
-