|
net.datastructures - version 5.0 | |||||||
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. //end#fragment Tree
Method Summary | |
---|---|
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. |
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. |
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()
Iterator<E> iterator()
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
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
|
net.datastructures - version 5.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |