|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface GenericSequence<E,P extends GenericPosition<E,P>>
Method Summary | |
---|---|
P |
after(Position<?> position)
returns the Position that is placed after position
in the sequence |
P |
before(Position<?> position)
This method returns the position that is placed before the one given as argument in the sequence. |
P |
first()
The method first() returns the
Position containing the first element of the
sequence. |
P |
insertAfter(Position<?> position,
E element)
This method insert element in the sequence. |
P |
insertBefore(Position<?> position,
E element)
This method insert element in the sequence. |
P |
last()
The method last() returns the
Position containing the last element of the
sequence. |
P |
position(int rank)
The position method returns the
Position corresponding to a given
rank . |
PositionListIterator<E,P> |
positionListIterator()
The positionListIterator method creates and return a ListIterator for the Position s contained in the sequence. |
PositionListIterator<E,P> |
positionListIterator(int rank)
The positionListIterator method creates and return a ListIterator for the Position s contained in the sequence. |
Methods inherited from interface ch.bfh.algo.core.GenericContainer |
---|
insert, positionIterator |
Methods inherited from interface ch.bfh.algo.Container |
---|
delete, element, encloses, replace, swap |
Methods inherited from interface ch.bfh.algo.Sequence |
---|
rank |
Methods inherited from interface ch.bfh.algo.Container |
---|
delete, element, encloses, replace, swap |
Methods inherited from interface java.util.List |
---|
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray |
Method Detail |
---|
P first() throws EmptySequenceException
Sequence
first()
returns the
Position
containing the first element of the
sequence.
It throws an EmptySequenceException
if the
sequence is empty.
first
in interface Sequence<E>
Position
EmptySequenceException
- if the sequence is empty.P last() throws EmptySequenceException
Sequence
last()
returns the
Position
containing the last element of the
sequence.
It throws an EmptySequenceException
if the
sequence is empty.
last
in interface Sequence<E>
Position
in the sequence.
EmptySequenceException
- if the sequence is empty.P before(Position<?> position) throws InvalidAccessorException, BoundaryViolationException
Sequence
before
in interface Sequence<E>
position
- Position
Position
that is before the given one
InvalidAccessorException
- if position
does not belong to this sequence.
BoundaryViolationException
- if the given position is the
first one (there is nothing before it in this case).P after(Position<?> position) throws InvalidAccessorException, BoundaryViolationException
Sequence
position
in the sequence
after
in interface Sequence<E>
position
- a Position<?>
position
InvalidAccessorException
- if position
does not belong to this sequence.
BoundaryViolationException
- if the given position is the
last one (there is nothing after it in this case).P insertBefore(Position<?> position, E element) throws InvalidAccessorException
Sequence
element
in the sequence. It
creates a new Position
that is inserted before
position
. The new position contains the new
element
and is returned by the method.
insertBefore
in interface Sequence<E>
position
- a Position<?>
Position
containing element
InvalidAccessorException
- if position
does
not belong to this sequence.P insertAfter(Position<?> position, E element) throws InvalidAccessorException
Sequence
element
in the sequence. It
creates a new Position
that is inserted after
position
. The new position contains the new
element
and is returned by the method.
insertAfter
in interface Sequence<E>
position
- a Position<?>
Position
containing element
InvalidAccessorException
- if position
does
not belong to this sequence.P position(int rank) throws IndexOutOfBoundsException
Sequence
position
method returns the
Position
corresponding to a given
rank
.
This method is a bridge between the methods of the
List
interface and the ones of the
Sequence
.
position
in interface Sequence<E>
rank
- an int
that denotes the index of the researched position in the sequence.
Position
containing element
IndexOutOfBoundsException
- if rank
is smaller than 0 or larger than or equal to the number of elements in the sequence.PositionListIterator<E,P> positionListIterator()
Sequence
positionListIterator
method creates and return a ListIterator
for the Position
s contained in the sequence.
This method gives the possibility to iterate over all the
Positions in the sequence.
positionListIterator
in interface Sequence<E>
ListIterator<Position<E>>
of all the Position
s in the sequence.PositionListIterator<E,P> positionListIterator(int rank) throws IndexOutOfBoundsException
Sequence
positionListIterator
method creates and return a ListIterator
for the Position
s contained in the sequence. This iterator is initially placed at the rank given as a parmeter
This method gives the possibility to iterate over all the
Positions in the sequence.
positionListIterator
in interface Sequence<E>
rank
- an int
denoting the initial position
of the pointer of the iterator.
ListIterator<Position<E>>
of
all the Position
s in the sequence.
IndexOutOfBoundsException
- if rank
is smaller than 0 or larger than the number of elements in the sequence.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |