All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface jdsl.core.api.PositionalSequence

public interface PositionalSequence
extends PositionalContainer
Interface for a positional sequence. A positional sequence is a positional container whose positions are linearly arranged and that supports position-based operations. It is a generalization of a linked list.

The enumerations returned by methods Container.elements() and PositionalContainer.positions() are guaranteed to give the elements/position in the same order as they are arranged in the positional sequence.

See Also:
Sequence, Position, PositionalContainer

Method Index

 o after(Position)
Return the position immediately after the specified one.
 o before(Position)
Return the position immediately before the specified one.
 o first()
Return the first position.
 o insertAfter(Position, Object)
Create a new position immediately after the specified position and store there the given element.
 o insertBefore(Position, Object)
Create a new position immediately before the specified position and store there the given element.
 o insertFirst(Object)
Create a new position at the beginning of the positional sequence and store there the given element.
 o insertLast(Object)
Create a new position at the end of the positional sequence and store there the given element.
 o last()
Return the last position.
 o remove(Position)
Remove and invalidate the specified position.
 o removeAfter(Position)
Removes the position after a specified position
 o removeBefore(Position)
Removes the position before a specified position
 o removeFirst()
Removes the first position in the sequence
 o removeLast()
Removes the last position of the sequence

Methods

 o first
 public abstract Position first() throws EmptyContainerException
Return the first position.

An EmptyContainerException is thrown if the positional sequence is empty.

Returns:
first position.
 o last
 public abstract Position last() throws EmptyContainerException
Return the last position.

An EmptyContainerException is thrown if the positional sequence is empty.

Returns:
last position.
 o before
 public abstract Position before(Position p) throws InvalidPositionException, BoundaryViolationException
Return the position immediately before the specified one.

A BoundaryViolationException is thrown if the position specified is the first one.

Parameters:
p - position.
Returns:
position immediately before position p.
 o after
 public abstract Position after(Position p) throws InvalidPositionException, BoundaryViolationException
Return the position immediately after the specified one.

A BoundaryViolationException is thrown if the position specified is the last one.

Parameters:
p - position.
Returns:
position immediately after position p.
 o insertFirst
 public abstract Position insertFirst(Object element)
Create a new position at the beginning of the positional sequence and store there the given element. Return the newly created position.

Parameters:
element - element to be inserted.
Returns:
newly created position.
 o insertLast
 public abstract Position insertLast(Object element)
Create a new position at the end of the positional sequence and store there the given element. Return the newly created position.

Parameters:
element - element to be inserted.
Returns:
newly created position.
 o insertBefore
 public abstract Position insertBefore(Position p,
                                       Object element) throws InvalidPositionException
Create a new position immediately before the specified position and store there the given element. Return the newly created position.

Parameters:
p - position immediately before which the insertion should be done.
element - element to be inserted.
Returns:
newly created position.
 o insertAfter
 public abstract Position insertAfter(Position p,
                                      Object element) throws InvalidPositionException
Create a new position immediately after the specified position and store there the given element. Return the newly created position.

Parameters:
p - position immediately after which the insertion should be done.
element - element to be inserted.
Returns:
newly created position.
 o remove
 public abstract Object remove(Position p) throws InvalidPositionException
Remove and invalidate the specified position. Return the element stored at it.

Parameters:
p - position to be removed.
Returns:
element formerly stored at the removed position.
 o removeBefore
 public abstract Object removeBefore(Position p) throws InvalidPositionException, BoundaryViolationException
Removes the position before a specified position

Parameters:
p - Position after position to be removed
Returns:
Element formerly stored at the removed position
 o removeAfter
 public abstract Object removeAfter(Position p) throws InvalidPositionException, BoundaryViolationException
Removes the position after a specified position

Parameters:
p - Position before position to be removed
Returns:
Element formerly stored at the removed position
 o removeFirst
 public abstract Object removeFirst() throws EmptyContainerException
Removes the first position in the sequence

Returns:
Element formerly stored in the first position of the sequence
 o removeLast
 public abstract Object removeLast() throws EmptyContainerException
Removes the last position of the sequence

Returns:
Element formerly stored in the last position of the sequence

All Packages  Class Hierarchy  This Package  Previous  Next  Index