public interface Tree<E>
Modifier and Type | Method and Description |
---|---|
java.lang.Iterable<Position<E>> |
children(Position<E> v)
Returns an iterable collection of the children of a given node.
|
boolean |
isEmpty()
Returns whether the tree is empty.
|
boolean |
isExternal(Position<E> v)
Returns whether a given node is external.
|
boolean |
isInternal(Position<E> v)
Returns whether a given node is internal.
|
boolean |
isRoot(Position<E> v)
Returns whether a given node is the root of the tree.
|
java.util.Iterator<E> |
iterator()
Returns an iterator of the elements stored in the tree.
|
Position<E> |
parent(Position<E> v)
Returns the parent of a given node.
|
java.lang.Iterable<Position<E>> |
positions()
Returns an iterable collection of the the nodes.
|
E |
replace(Position<E> v,
E e)
Replaces the element stored at a given node.
|
Position<E> |
root()
Returns the root of the tree.
|
int |
size()
Returns the number of nodes in the tree.
|
java.lang.Iterable<Position<E>> children(Position<E> v) throws InvalidPositionException
InvalidPositionException
boolean isEmpty()
boolean isExternal(Position<E> v) throws InvalidPositionException
InvalidPositionException
boolean isInternal(Position<E> v) throws InvalidPositionException
InvalidPositionException
boolean isRoot(Position<E> v) throws InvalidPositionException
InvalidPositionException
java.util.Iterator<E> iterator()
Position<E> parent(Position<E> v) throws InvalidPositionException, BoundaryViolationException
java.lang.Iterable<Position<E>> positions()
E replace(Position<E> v, E e) throws InvalidPositionException
InvalidPositionException
Position<E> root() throws EmptyTreeException
EmptyTreeException
int size()