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.

See Also:
BoundaryViolationException, Container, Sequence, PositionalSequence

Method Index

 o elemAtRank(int)
Inspect the element at a specified rank.
 o insertElemAtRank(int, Object)
Insert an element at a specified rank.
 o removeElemAtRank(int)
Remove the element at a specified rank.
 o replaceElemAtRank(int, Object)
Replace the element at a specified rank.

Methods

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