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).

See Also:
Position, Container, Sequence, Tree, BinaryTree, Graph

Method Index

 o positions()
Return an Enumeration of the positions in the container.
 o replace(Position, Object)
Replace the element at the specified position with a new element.
 o swap(Position, Position)
Swaps the elements at two specified positions.

Methods

 o 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
 o 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.
 o 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