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.
- Version:
- JDSL 1.0 beta, January 1998
- Author:
- Michael T. Goodrich, Mark Handy, Roberto Tamassia
- See Also:
- Sequence, Position, PositionalContainer
-
after(Position)
-
Return the position immediately after the specified one.
-
before(Position)
-
Return the position immediately before the specified one.
-
first()
-
Return the first position.
-
insertAfter(Position, Object)
-
Create a new position immediately after the specified position
and store there the given element.
-
insertBefore(Position, Object)
-
Create a new position immediately before the specified position
and store there the given element.
-
insertFirst(Object)
-
Create a new position at the beginning of the positional sequence
and store there the given element.
-
insertLast(Object)
-
Create a new position at the end of the positional sequence
and store there the given element.
-
last()
-
Return the last position.
-
remove(Position)
-
Remove and invalidate the specified position.
-
removeAfter(Position)
-
Removes the position after a specified position
-
removeBefore(Position)
-
Removes the position before a specified position
-
removeFirst()
-
Removes the first position in the sequence
-
removeLast()
-
Removes the last position of the sequence
first
public abstract Position first() throws EmptyContainerException
- Return the first position.
An EmptyContainerException is thrown if the positional sequence
is empty.
- Returns:
- first position.
last
public abstract Position last() throws EmptyContainerException
- Return the last position.
An EmptyContainerException is thrown if the positional sequence
is empty.
- Returns:
- last position.
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.
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.
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.
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.
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.
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.
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.
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
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
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
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