|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Tree<E>
An interface for a tree where nodes can have an arbitrary number of children.
Method Summary | |
---|---|
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. |
Method Detail |
---|
int size()
boolean isEmpty()
java.util.Iterator<E> iterator()
java.lang.Iterable<Position<E>> positions()
E replace(Position<E> v, E e) throws InvalidPositionException
InvalidPositionException
Position<E> root() throws EmptyTreeException
EmptyTreeException
Position<E> parent(Position<E> v) throws InvalidPositionException, BoundaryViolationException
InvalidPositionException
BoundaryViolationException
java.lang.Iterable<Position<E>> children(Position<E> v) throws InvalidPositionException
InvalidPositionException
boolean isInternal(Position<E> v) throws InvalidPositionException
InvalidPositionException
boolean isExternal(Position<E> v) throws InvalidPositionException
InvalidPositionException
boolean isRoot(Position<E> v) throws InvalidPositionException
InvalidPositionException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |