jdsl
Class NodeRankedSequence

java.lang.Object
  |
  +--jdsl.MyDeque
        |
        +--jdsl.NodeRankedSequence

public class NodeRankedSequence
extends MyDeque
implements Deque, RankedSequence

This is the implementation of the RankedSequence interface by means of a doubly-linked list. Note that this class extends class Deque and uses class DLNode, which is the node that stores the previos and next nodes in the list, and a reference to its element.


Constructor Summary
NodeRankedSequence()
           
 
Method Summary
 java.lang.Object elemAtRank(int rank)
           
 java.util.Iterator elements()
          Returns an iterator of the elements in this sequence
 void insertElemAtRank(int rank, java.lang.Object element)
           
 Container newContainer()
          Make a new container of this type
 java.lang.Object removeElemAtRank(int rank)
           
 java.lang.Object replaceElemAtRank(int rank, java.lang.Object newElement)
           
 
Methods inherited from class jdsl.MyDeque
first, insertFirst, insertLast, isEmpty, last, removeFirst, removeLast, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeRankedSequence

public NodeRankedSequence()
Method Detail

elemAtRank

public java.lang.Object elemAtRank(int rank)
Specified by:
elemAtRank in interface RankedSequence

replaceElemAtRank

public java.lang.Object replaceElemAtRank(int rank,
                                          java.lang.Object newElement)
                                   throws BoundaryViolationException
Specified by:
replaceElemAtRank in interface RankedSequence

insertElemAtRank

public void insertElemAtRank(int rank,
                             java.lang.Object element)
                      throws BoundaryViolationException
Specified by:
insertElemAtRank in interface RankedSequence

removeElemAtRank

public java.lang.Object removeElemAtRank(int rank)
                                  throws BoundaryViolationException
Specified by:
removeElemAtRank in interface RankedSequence

newContainer

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

elements

public java.util.Iterator elements()
Returns an iterator of the elements in this sequence