All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface list.Position

public interface Position
An interface for "Positions" within a list class, which might be used by singly-linked, doubly-linked, acycle, or cyclic lists, for example. A Position is similar to an "index" in an array or vector, in that you may get and set elements at a given position and get new Positions relative to the current one.


Method Index

 o elementAt()
Returns the element at the current position.
 o insertAfter(Object)
Inserts elem just before the current position in the list.
 o insertBefore(Object)
Inserts elem just before the current position in the list.
 o isValidPosition()
Determines whether the current position is valid.
 o next()
Constructs a new ListPosition at the position after this one.
 o previous()
Constructs a new ListPosition at the position before this one.
 o remove()
Removes the element at this position in the DList.
 o setElementAt(Object)
Sets the element at the current position to elem.

Methods

 o next
 public abstract Position next() throws ListBoundsException
Constructs a new ListPosition at the position after this one. This position is not modified.

Throws: ListBoundsException
if the current position is not valid.
 o previous
 public abstract Position previous() throws ListBoundsException
Constructs a new ListPosition at the position before this one. This position is not modified.

Throws: ListBoundsException
if the current position is not valid.
 o elementAt
 public abstract Object elementAt() throws ListBoundsException
Returns the element at the current position.

Throws: ListBoundsException
if the current position is not valid.
 o setElementAt
 public abstract void setElementAt(Object elem) throws ListBoundsException
Sets the element at the current position to elem.

Throws: ListBoundsException
if the current position is not valid.
 o insertBefore
 public abstract void insertBefore(Object elem) throws ListBoundsException
Inserts elem just before the current position in the list.

Throws: ListBoundsException
if the current position is not valid.
 o insertAfter
 public abstract void insertAfter(Object elem) throws ListBoundsException
Inserts elem just before the current position in the list.

Throws: ListBoundsException
if the current position is not valid.
 o remove
 public abstract Object remove() throws ListBoundsException
Removes the element at this position in the DList.

Returns:
the element at the current position (before removal).
Throws: ListBoundsException
if the current position is not valid.
 o isValidPosition
 public abstract boolean isValidPosition()
Determines whether the current position is valid.

Returns:
true if the current position is valid, false otherwise

All Packages  Class Hierarchy  This Package  Previous  Next  Index