|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | 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,
Object element)
Inserts an object after a position in the sequence. |
Position |
insertAtRank(int rank,
Object element)
Inserts based on an integer rank similar to array indices. |
Position |
insertBefore(Position p,
Object element)
Inserts an object before a position in the sequence. |
Position |
insertFirst(Object element)
Inserts an object as first element of the sequence |
Position |
insertLast(Object element)
Inserts an object as last element of the sequence. |
Object |
remove(Position pos)
Removes and invalidates the specified position |
Object |
removeAfter(Position pos)
Remove and invalidates the position after the position specified |
Object |
removeAtRank(int rank)
Removes and invalidates the position at the specified rank |
Object |
removeBefore(Position pos)
Removes and invalidates the position before the position specified. |
Object |
removeFirst()
Removes and invalidates the first position of this. |
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(Object element)
element - Any java.lang.Object
Position containing that element,
which is now the first position in the sequence.public Position insertLast(Object element)
element - Any java.lang.Object
Position containing that element,
which is now the last in the sequence.
public Position insertBefore(Position p,
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 sequence
public Position insertAfter(Position p,
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 sequence
public Position insertAtRank(int rank,
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 Object removeFirst()
throws EmptyContainerException
EmptyContainerException - if this sequence is empty
public Object removeLast()
throws EmptyContainerException
EmptyContainerException - if this sequence is empty
public Object remove(Position pos)
throws InvalidAccessorException
pos - the position to be removed
InvalidAccessorException - if the specified position is
invalid or not belong to this container.
public Object removeAfter(Position pos)
throws BoundaryViolationException,
InvalidAccessorException
pos - a position
BoundaryViolationException - if pos is the last position of this
sequence
InvalidAccessorException - if the specified position is
invalid or not belong to this container.
public Object removeBefore(Position pos)
throws BoundaryViolationException,
InvalidAccessorException
pos - a position
BoundaryViolationException - if pos is the first position of
this sequence.
InvalidAccessorException - if the specified position is
invalid or not belong to this container.
public Object removeAtRank(int rank)
throws BoundaryViolationException
rank - the rank of the position to be removed
BoundaryViolationException - if rank is less than 0 or greater
than the size of this sequence
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||