All Packages Class Hierarchy This Package Previous Next Index
Interface jdsl.core.api.BookSequence
- public interface BookSequence
- extends PositionalSequence, RankedSequence
Interface for a sequence, as it is described in the
Goodrich-Tamassia book. It extends core.api.PositionalSequence and
simple.api.RankedSequence.
- Version:
- JDSL 1.0 beta, January 1998
- Author:
- Michael T. Goodrich, Roberto Tamassia
- See Also:
- Sequence, PositionalSequence, RankedSequence
-
atRank(int)
-
Return the position with the specified rank.
-
insertAtRank(int, Object)
-
Insert a new position into the sequence at the specified rank,
and store the given element into the position.
-
rankOf(Position)
-
Return the rank of the specified position.
atRank
public abstract Position atRank(int rank) throws BoundaryViolationException
- Return the position with the specified rank.
A BoundaryViolationException is thrown if rank < 0 or if
rank > n - 1, where n is the size (number of positions) of the
sequence.
- Parameters:
- rank - integer specifying the rank.
- Returns:
- position at the specified rank.
rankOf
public abstract int rankOf(Position p) throws InvalidPositionException
- Return the rank of the specified position. Note that the first
position has rank 0, and the last position has rank n - 1, where
n is the size (number of positions) of the sequence.
- Parameters:
- p - position
- Returns:
- rank of the specified position in the sequence.
insertAtRank
public abstract Position insertAtRank(int rank,
Object newElement) throws BoundaryViolationException
- Insert a new position into the sequence at the specified rank,
and store the given element into the position. Return the newly
created position.
- Parameters:
- rank - rank that the new position should have. For
example, if rank = 0, the insertion is done at the beginning,
and if rank = n, where n is the old size (number of positions)
of the sequence, the insertion is done at the end.
- newElement - new element to be inserted.
- Returns:
- newly created position.
All Packages Class Hierarchy This Package Previous Next Index