All Packages Class Hierarchy This Package Previous Next Index
Interface jdsl.core.api.PositionalContainer
- public interface PositionalContainer
- extends Container
A positional container stores elements at its positions and defines
adjacency relationships between the positions (for example,
before/after in a sequence, parent/child in a tree). This is the
base interface for all the positional containers (e.g., Sequence,
Tree, Graph).
- Version:
- JDSL 1.0 beta, January 1998
- Author:
- Michael T. Goodrich, Mark Handy, Roberto Tamassia, Mike Boilen (mgb)
- See Also:
- Position, Container, Sequence, Tree, BinaryTree, Graph
-
positions()
-
Return an
Enumeration
of the positions in the container.
-
replace(Position, Object)
-
Replace the element at the specified position with a new element.
-
swap(Position, Position)
- Swaps the elements at two specified positions.
positions
public abstract Enumeration positions()
- Return an
Enumeration
of the positions in the container. There
is no guarantee of the order of the positions in the
Enumeration.
However, certain implementations of
PositionalContainer
may guarantee a certain order of the
positions in the Enumeration.
- Returns:
-
Enumeration
of all positions in the container
replace
public abstract Object replace(Position p,
Object newElement) throws InvalidPositionException
- Replace the element at the specified position with a new element.
- Parameters:
- p - position at which the replacement is to occur
- newElement - new element to be stored at position p
- Returns:
- old element formerly stored at position p
- Throws: InvalidPositionException
- is thrown if the specified position
does not belong to the container or if the position is
null
.
swap
public abstract void swap(Position p,
Position q) throws InvalidPositionException, InvalidContainerException
- Swaps the elements at two specified positions.
- Parameters:
- p - first position participating in the swap.
- q - second position participating in the swap.
- Throws: InvalidPositionException
- if thrown if on or both of the specified
Positions
does not belong to the same implementation of
Container,
or if either Position
is
null.
All Packages Class Hierarchy This Package Previous Next Index