All Packages Class Hierarchy This Package Previous Next Index
Class jdsl.core.ref.NodeSequence
java.lang.Object
|
+----jdsl.core.ref.NodeSequence
- public class NodeSequence
- extends Object
- implements Sequence
This class implements the sequence interface using a double-linked list
of nodes.
- Version:
- Fri Aug 22 17:24:57 1997
- Author:
- Natasha Gelfand
-
NodeSequence()
-
-
after(Position)
- Return position after this one
-
atRank(int)
- Return the position at the given rank
-
before(Position)
- Return position before this one
-
checkPosition(Position)
-
-
checkRank(int)
-
-
elements()
- Returns an enumeration of the elements in this sequence
-
first()
- Return the first position in the sequence
-
insertAfter(Position, Object)
- Create a new position with the given element and insert it after the
given position, returning a reference the new position
-
insertAtRank(int, Object)
- Create a new position with the given element and insert it
at the given rank.
-
insertBefore(Position, Object)
- Create a new position with the given element and insert it before the
given position, returning a reference to the new node
-
insertFirst(Object)
- Create a new position with the given element and insert it as the
first position in the sequence.
-
insertLast(Object)
- Create a new position with the given element and insert it as the
last position in the sequence.
-
isEmpty()
- Return true iff the sequence is empty
-
last()
- Return the last position in the sequence
-
newContainer()
- Make a new container of this type
-
positions()
- Returns an enumeration of the positions in this sequence
-
rankOf(Position)
- Return the rank of the given position
-
remove(Position)
- Remove this position from the sequence
-
removeAfter(Position)
- Removes after p
-
removeAtRank(int)
- Removes the position at rank i
-
removeBefore(Position)
- Removes before p
-
removeFirst()
- Removes the first position
-
removeLast()
- Removes the last position
-
replace(Position, Object)
- Replace the element of the given position with the new element and
return the old value of element
-
size()
- Return the number of elements in the sequence
-
swap(Position, Position)
- Swap elements of two positions
NodeSequence
public NodeSequence()
first
public Position first() throws EmptyContainerException
- Return the first position in the sequence
last
public Position last() throws EmptyContainerException
- Return the last position in the sequence
atRank
public Position atRank(int rank) throws BoundaryViolationException
- Return the position at the given rank
before
public Position before(Position p) throws InvalidPositionException, BoundaryViolationException
- Return position before this one
after
public Position after(Position p) throws InvalidPositionException, BoundaryViolationException
- Return position after this one
rankOf
public int rankOf(Position p) throws InvalidPositionException
- Return the rank of the given position
insertBefore
public Position insertBefore(Position p,
Object element) throws InvalidPositionException
- Create a new position with the given element and insert it before the
given position, returning a reference to the new node
insertAfter
public Position insertAfter(Position p,
Object element) throws InvalidPositionException
- Create a new position with the given element and insert it after the
given position, returning a reference the new position
insertFirst
public Position insertFirst(Object element)
- Create a new position with the given element and insert it as the
first position in the sequence.
insertLast
public Position insertLast(Object element)
- Create a new position with the given element and insert it as the
last position in the sequence.
insertAtRank
public Position insertAtRank(int rank,
Object element) throws BoundaryViolationException
- Create a new position with the given element and insert it
at the given rank.
remove
public Object remove(Position p) throws InvalidPositionException
- Remove this position from the sequence
size
public int size()
- Return the number of elements in the sequence
isEmpty
public boolean isEmpty()
- Return true iff the sequence is empty
newContainer
public Container newContainer()
- Make a new container of this type
elements
public Enumeration elements()
- Returns an enumeration of the elements in this sequence
positions
public Enumeration positions()
- Returns an enumeration of the positions in this sequence
replace
public Object replace(Position p,
Object element) throws InvalidPositionException
- Replace the element of the given position with the new element and
return the old value of element
swap
public void swap(Position a,
Position b) throws InvalidPositionException
- Swap elements of two positions
checkPosition
protected NSNode checkPosition(Position p) throws InvalidPositionException
checkRank
protected void checkRank(int rank) throws BoundaryViolationException
removeAtRank
public Object removeAtRank(int i)
- Removes the position at rank i
removeBefore
public Object removeBefore(Position p)
- Removes before p
removeAfter
public Object removeAfter(Position p)
- Removes after p
removeFirst
public Object removeFirst()
- Removes the first position
removeLast
public Object removeLast()
- Removes the last position
All Packages Class Hierarchy This Package Previous Next Index