public interface BinaryTree<E> extends Tree<E>
Modifier and Type | Method and Description |
---|---|
Position<E> |
left(Position<E> p)
Returns the Position of p's left child (or null if no child exists).
|
Position<E> |
right(Position<E> p)
Returns the Position of p's right child (or null if no child exists).
|
Position<E> |
sibling(Position<E> p)
Returns the Position of p's sibling (or null if no sibling exists).
|
children, isEmpty, isExternal, isInternal, isRoot, iterator, numChildren, parent, positions, root, size
Position<E> left(Position<E> p) throws IllegalArgumentException
p
- A valid Position within the treeIllegalArgumentException
- if p is not a valid Position for this treePosition<E> right(Position<E> p) throws IllegalArgumentException
p
- A valid Position within the treeIllegalArgumentException
- if p is not a valid Position for this treePosition<E> sibling(Position<E> p) throws IllegalArgumentException
p
- A valid Position within the treeIllegalArgumentException
- if p is not a valid Position for this tree