|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Please refer to the documentation of Tree
Tree
Method Summary | |
Position |
childAtRank(Position node,
int rank)
|
PositionIterator |
children(Position node)
Returns an iterator over the children of the node in order. |
Position |
firstChild(Position node)
|
boolean |
isExternal(Position node)
Checks if a position is a leaf of this tree. |
boolean |
isInternal(Position node)
Checks if a position is an internal node of this tree. |
boolean |
isRoot(Position node)
Checks if a position is the root of this tree. |
Position |
lastChild(Position node)
|
int |
numChildren(Position node)
|
Position |
parent(Position node)
Gets the parent of a given node. |
int |
rankOfChild(Position child)
|
Position |
root()
Gets the root of this tree. |
Position |
siblingAfter(Position node)
|
Position |
siblingBefore(Position node)
|
PositionIterator |
siblings(Position node)
Returns an iterator over the siblings of the node in order. |
Methods inherited from interface jdsl.core.api.InspectablePositionalContainer |
positions |
Methods inherited from interface jdsl.core.api.InspectableContainer |
contains, elements, isEmpty, size |
Method Detail |
public boolean isRoot(Position node) throws InvalidAccessorException
node
- a node
true
if node
is the root of this tree
InvalidAccessorException
- if node
is null or
does not belong to this treepublic boolean isInternal(Position node) throws InvalidAccessorException
node
- a node
true
if node
has at least one child
InvalidAccessorException
- if node
is null or
does not belong to this treepublic boolean isExternal(Position node) throws InvalidAccessorException
node
- Any node of the tree
true
if node
has no children
InvalidAccessorException
- if node
is null or
does not belong to this treepublic Position root()
public Position parent(Position node) throws BoundaryViolationException, InvalidAccessorException
node
- a node
BoundaryViolationException
- if node
is the
root of the tree
InvalidAccessorException
- if node
is null or
does not belong to this treepublic PositionIterator children(Position node) throws InvalidAccessorException
node
in order.
If the node
is a leaf, the iterator has no elements.
The iterator returned is a snapshot -- it iterates over all positions
that were children of node at the moment that children(.) was called,
regardless of subsequent modifications to the container.
node
- a node of the tree
InvalidAccessorException
- if node
is null or
does not belong to this treepublic PositionIterator siblings(Position node) throws BoundaryViolationException, InvalidAccessorException
node
has no siblings, the iterator
has no elements. The iterator returned is a snapshot --
it iterates over all positions that were siblings of node
at the moment that siblings(.) was called, regardless of subsequent
modifications to the container.
node
- a node of the tree
BoundaryViolationException
- if node
is the
root of the tree
InvalidAccessorException
- if node
is null or
does not belong to this treepublic int numChildren(Position node) throws InvalidAccessorException
node
- a node of the tree
node
InvalidAccessorException
- if node
is null or
does not belong to this treepublic Position siblingAfter(Position node) throws BoundaryViolationException, InvalidAccessorException
node
- a node
node
BoundaryViolationException
- if node
is
either the last child of a node or the root
InvalidAccessorException
- if node
is null
or does not belong to this treepublic Position childAtRank(Position node, int rank) throws BoundaryViolationException, InvalidAccessorException
node
- a noderank
- an integer index of the children of
node
; childAtRank(0) is the first child,
childAtRank(numChildren(node)-1) is the last child
node
at the specified rank
BoundaryViolationException
- if rank < 0 or rank >
numChildren(node)-1 or node is a leaf
InvalidAccessorException
- if node
is null
or does not belong to this treepublic Position siblingBefore(Position node) throws BoundaryViolationException, InvalidAccessorException
node
- a node
node
BoundaryViolationException
- if node
is
either the first child of a node or the root
InvalidAccessorException
- if node
is null
or does not belong to this treepublic Position firstChild(Position node) throws BoundaryViolationException, InvalidAccessorException
node
- a node
node
BoundaryViolationException
- if node
is
a leaf
InvalidAccessorException
- if node
is null
or does not belong to this treepublic Position lastChild(Position node) throws BoundaryViolationException, InvalidAccessorException
node
- a node
node
BoundaryViolationException
- if node
is
a leaf
InvalidAccessorException
- if node
is null
or does not belong to this treepublic int rankOfChild(Position child) throws BoundaryViolationException, InvalidAccessorException
child
- a node
child
BoundaryViolationException
- if child
is
the root
InvalidAccessorException
- if child
is null
or does not belong to this tree
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |