All Packages Class Hierarchy This Package Previous Next Index
prev(.)
and next(.)
. Note: After splicing a
CircularSequence
into another sequence, the container that was
spliced becomes invalid, and will throw an
InvalidContainerException
if any method is called on it.
Position
after a given Position
in
this CircularSequence
Position
before a given Position
in
this CircularSequence
CircularSequence
.
CircularSequence
after a given position.
CircularSequence,
repairs this CircularSequence,
and makes a new
CircularSequence
with the snipped-out nodes.
first()
or last()
in a circular
sequence, a method is needed that will give a position -- any position --
in the circular sequence, to get things started.
public abstract Position before(Position p) throws InvalidPositionException
Position
before a given Position
in
this CircularSequence
Position
of element in this sequence
Position
of previous element
Position
is
invalid, from a different container, or null
.
public abstract Position after(Position p) throws InvalidPositionException
Position
after a given Position
in
this CircularSequence
Position
of element in this sequence
Position
of next element
Position
is
invalid, from a different container, or null
.
public abstract Position startingPosition() throws EmptyContainerException
first()
or last()
in a circular
sequence, a method is needed that will give a position -- any position --
in the circular sequence, to get things started. No guarantees about what
position is returned.
public abstract Position insertBefore(Position p, Object element) throws InvalidPositionException
Position
of element in this sequence
java.lang.Object
Position
of Object
element, now stored
ahead of Position p
(the parameter)
p
is null
or not in this CircularSequence
public abstract Position insertAfter(Position p, Object element) throws InvalidPositionException
Position
of element in this sequence
java.lang.Object
Position
of Object
element, now stored
ahead of Position p
(the parameter)
p
is null
or not in this CircularSequence
public abstract Position insertInitial(Object element) throws NotEmptyContainerException
CircularSequence
. The
counterpart to startingPosition: intended for use only in an empty
circular sequence, where there is no position before or after which you
can insert.
Object
Position
of the object inserted
public abstract Object remove(Position p) throws EmptyContainerException, InvalidPositionException
Position
of the element after the element to
be removed.
p
is
null
or not in this CircularSequence
public abstract CircularSequence split(Position inNewA, Position inNewB) throws EmptyContainerException, InvalidPositionException, InvalidContainerException
CircularSequence,
repairs this CircularSequence,
and makes a new
CircularSequence
with the snipped-out nodes. If
inNewA==inNewB,
only that one Position is removed from this
CircularSequence.
@param inNewA Start of sequence of
Positions
to be removed from this
CircularSequence
. In structures that can implement this
method in constant time, size()
will be implemented in linear
time.
Positions
to be
removed from.
Positions
to be removed from
this CircularSequence
.
CircularSequence
holding inNewA,
inNewB,
and all the Positions
between them
inNewA
or
inNewB
is null
, from a different container, or
of an incompatible type.
public abstract void splice(Position afterWhich, CircularSequence toMerge, Position newSuccessor) throws InvalidContainerException, InvalidPositionException, InvalidArgumentException
CircularSequence
after a given position.
That is, this CircularSequence
is snipped after a given
Position,
and the merged-in CircularSequence
is
snipped before a given Position. toMerge
will be invalidated
after this method returns. In structures that can implement this method
in constant time, size()
will be implemented in linear
time.
Position
after which to break this
CircularSequence
CircularSequence
to be spliced into this one
Position
from toMerge that will follow
Position
afterWhich from this CircularSequence
.
toMerge is invalid or of an incompatible type.
- Throws: InvalidArgumentException
- if
toMerge
is the same
container as splice
is called on.
- Throws: InvalidPositionException
- if
afterWhich
or
newSuccessor
is either null, or of the wrong type.
- See Also:
- size
All Packages Class Hierarchy This Package Previous Next Index