|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A positional container whose elements are linearly organized. It is a generalization of stacks, queues, linked lists, and arrays.
For a Sequence, methods InspectableContainer.elements()
and InspectablePositionalContainer.positions()
are guaranteed to return iterators in first-to-last order.
InspectableSequence
,
PositionalContainer
Method Summary | |
Position |
insertAfter(Position p,
java.lang.Object element)
Inserts an object after a position in the sequence. |
Position |
insertAtRank(int rank,
java.lang.Object element)
Inserts based on an integer rank similar to array indices. |
Position |
insertBefore(Position p,
java.lang.Object element)
Inserts an object before a position in the sequence. |
Position |
insertFirst(java.lang.Object element)
Inserts an object as first element of the sequence |
Position |
insertLast(java.lang.Object element)
Inserts an object as last element of the sequence. |
java.lang.Object |
remove(Position pos)
Removes and invalidates the specified position |
java.lang.Object |
removeAfter(Position pos)
Remove and invalidates the position after the position specified |
java.lang.Object |
removeAtRank(int rank)
Removes and invalidates the position at the specified rank |
java.lang.Object |
removeBefore(Position pos)
Removes and invalidates the position before the position specified. |
java.lang.Object |
removeFirst()
Removes and invalidates the first position of this. |
java.lang.Object |
removeLast()
Removes and invalidates the last position of this. |
Methods inherited from interface jdsl.core.api.InspectableSequence |
after, atRank, before, first, isFirst, isLast, last, rankOf |
Methods inherited from interface jdsl.core.api.InspectablePositionalContainer |
positions |
Methods inherited from interface jdsl.core.api.InspectableContainer |
contains, elements, isEmpty, size |
Methods inherited from interface jdsl.core.api.PositionalContainer |
swapElements |
Methods inherited from interface jdsl.core.api.Container |
newContainer, replaceElement |
Method Detail |
public Position insertFirst(java.lang.Object element)
element
- Any java.lang.ObjectPosition
containing that element
,
which is now the first position in the sequence.public Position insertLast(java.lang.Object element)
element
- Any java.lang.ObjectPosition
containing that element
,
which is now the last in the sequence.public Position insertBefore(Position p, java.lang.Object element) throws InvalidAccessorException
p
- Position in this sequence before which to insert an
element.element
- Any java.lang.Objectelement
and before
Position p
.InvalidAccessorException
- Thrown if p
is
not a valid position in this sequencepublic Position insertAfter(Position p, java.lang.Object element) throws InvalidAccessorException
p
- Position in this sequence after which to insert an
element.element
- Any java.lang.Objectelement
and after
Position p
.InvalidAccessorException
- Thrown if p
is
not a valid position in this sequencepublic Position insertAtRank(int rank, java.lang.Object element) throws BoundaryViolationException
size() - 1
. It is valid to insert at any rank greater
than or equal to zero and less than or equal to size()
.rank
- Rank that element
should have after insertion.element
- Any java.lang.Objectelement
in the sequence.BoundaryViolationException
- if rank
exceeds
size()
or if 0 exceeds rank
public java.lang.Object removeFirst() throws EmptyContainerException
EmptyContainerException
- if this sequence is emptypublic java.lang.Object removeLast() throws EmptyContainerException
EmptyContainerException
- if this sequence is emptypublic java.lang.Object remove(Position pos) throws InvalidAccessorException
pos
- the position to be removedInvalidAccessorException
- if the specified position is
invalid or not belong to this container.public java.lang.Object removeAfter(Position pos) throws BoundaryViolationException, InvalidAccessorException
pos
- a positionBoundaryViolationException
- if pos is the last position of this
sequenceInvalidAccessorException
- if the specified position is
invalid or not belong to this container.public java.lang.Object removeBefore(Position pos) throws BoundaryViolationException, InvalidAccessorException
pos
- a positionBoundaryViolationException
- if pos is the first position of
this sequence.InvalidAccessorException
- if the specified position is
invalid or not belong to this container.public java.lang.Object removeAtRank(int rank) throws BoundaryViolationException
rank
- the rank of the position to be removedBoundaryViolationException
- if rank is less than 0 or greater
than the size of this sequence
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |