All Packages Class Hierarchy This Package Previous Next Index
Interface jdsl.simple.api.RankedSequence
- public interface RankedSequence
- extends Container
Interface for a ranked sequence. A ranked sequence is a
collection of linearly arranged elements that are accessed,
inserted, and removed by their rank. The rank of an element is the
number of elements preceding it, that is, in a ranked sequence with
n elements, the first element has rank 0, the second element has
rank 1, ..., the last element has rank n-1.
- Version:
- $Revision: 1.3 $, $Date: 1998/07/08 21:56:42 $
- Author:
- Michael T. Goodrich, Mark Handy, Roberto Tamassia
- See Also:
- BoundaryViolationException, Container, Sequence, PositionalSequence
-
elemAtRank(int)
-
Inspect the element at a specified rank.
-
insertElemAtRank(int, Object)
-
Insert an element at a specified rank.
-
removeElemAtRank(int)
-
Remove the element at a specified rank.
-
replaceElemAtRank(int, Object)
-
Replace the element at a specified rank.
elemAtRank
public abstract Object elemAtRank(int rank) throws BoundaryViolationException
- Inspect the element at a specified rank.
- Parameters:
- rank - rank of the element to be inspected.
- Returns:
- element with the specified rank.
- Throws: BoundaryViolationException
- if the specified
rank
is
not between 0 and size()-1
.
replaceElemAtRank
public abstract Object replaceElemAtRank(int rank,
Object newElement) throws BoundaryViolationException
- Replace the element at a specified rank.
- Parameters:
- rank - rank of the element to be replaced.
- newElement - new element at the specified rank.
- Returns:
- old element at the specified rank.
- Throws: BoundaryViolationException
- is thrown if the specified rank is
not between 0 and size()-1.
insertElemAtRank
public abstract void insertElemAtRank(int rank,
Object element) throws BoundaryViolationException
- Insert an element at a specified rank.
- Parameters:
- rank - rank at which the new element should be inserted.
- element - element to be inserted.
- Throws: BoundaryViolationException
- is thrown if the specified rank is
not between 0 and size().
removeElemAtRank
public abstract Object removeElemAtRank(int rank) throws BoundaryViolationException
- Remove the element at a specified rank.
- Parameters:
- rank - rank of the element to be removed.
- Returns:
- element to be removed.
- Throws: BoundaryViolationException
- is thrown if the specified rank is not
between 0 and size()-1.
All Packages Class Hierarchy This Package Previous Next Index