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.


Constructor Index

 o NodeSequence()

Method Index

 o after(Position)
Return position after this one
 o atRank(int)
Return the position at the given rank
 o before(Position)
Return position before this one
 o checkPosition(Position)
 o checkRank(int)
 o elements()
Returns an enumeration of the elements in this sequence
 o first()
Return the first position in the sequence
 o insertAfter(Position, Object)
Create a new position with the given element and insert it after the given position, returning a reference the new position
 o insertAtRank(int, Object)
Create a new position with the given element and insert it at the given rank.
 o 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
 o insertFirst(Object)
Create a new position with the given element and insert it as the first position in the sequence.
 o insertLast(Object)
Create a new position with the given element and insert it as the last position in the sequence.
 o isEmpty()
Return true iff the sequence is empty
 o last()
Return the last position in the sequence
 o newContainer()
Make a new container of this type
 o positions()
Returns an enumeration of the positions in this sequence
 o rankOf(Position)
Return the rank of the given position
 o remove(Position)
Remove this position from the sequence
 o removeAfter(Position)
Removes after p
 o removeAtRank(int)
Removes the position at rank i
 o removeBefore(Position)
Removes before p
 o removeFirst()
Removes the first position
 o removeLast()
Removes the last position
 o replace(Position, Object)
Replace the element of the given position with the new element and return the old value of element
 o size()
Return the number of elements in the sequence
 o swap(Position, Position)
Swap elements of two positions

Constructors

 o NodeSequence
 public NodeSequence()

Methods

 o first
 public Position first() throws EmptyContainerException
Return the first position in the sequence

 o last
 public Position last() throws EmptyContainerException
Return the last position in the sequence

 o atRank
 public Position atRank(int rank) throws BoundaryViolationException
Return the position at the given rank

 o before
 public Position before(Position p) throws InvalidPositionException, BoundaryViolationException
Return position before this one

 o after
 public Position after(Position p) throws InvalidPositionException, BoundaryViolationException
Return position after this one

 o rankOf
 public int rankOf(Position p) throws InvalidPositionException
Return the rank of the given position

 o 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

 o 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

 o insertFirst
 public Position insertFirst(Object element)
Create a new position with the given element and insert it as the first position in the sequence.

 o insertLast
 public Position insertLast(Object element)
Create a new position with the given element and insert it as the last position in the sequence.

 o 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.

 o remove
 public Object remove(Position p) throws InvalidPositionException
Remove this position from the sequence

 o size
 public int size()
Return the number of elements in the sequence

 o isEmpty
 public boolean isEmpty()
Return true iff the sequence is empty

 o newContainer
 public Container newContainer()
Make a new container of this type

 o elements
 public Enumeration elements()
Returns an enumeration of the elements in this sequence

 o positions
 public Enumeration positions()
Returns an enumeration of the positions in this sequence

 o 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

 o swap
 public void swap(Position a,
                  Position b) throws InvalidPositionException
Swap elements of two positions

 o checkPosition
 protected NSNode checkPosition(Position p) throws InvalidPositionException
 o checkRank
 protected void checkRank(int rank) throws BoundaryViolationException
 o removeAtRank
 public Object removeAtRank(int i)
Removes the position at rank i

 o removeBefore
 public Object removeBefore(Position p)
Removes before p

 o removeAfter
 public Object removeAfter(Position p)
Removes after p

 o removeFirst
 public Object removeFirst()
Removes the first position

 o removeLast
 public Object removeLast()
Removes the last position


All Packages  Class Hierarchy  This Package  Previous  Next  Index