DoubleLink
Class DualSequence

java.lang.Object
  |
  +--DoubleLink.DualSequence

public class DualSequence
extends java.lang.Object

DualSequence models a sequence of objects so such that: -- objects at added to the front and to the rear of the sequence; -- objects can be removed from the front and rear of the sequence; -- the sequence's contents can be displayed from front to rear and from rear to front (that is, in reverse order)


Constructor Summary
DualSequence()
          Constructor DualSequence constructs an empty sequence
 
Method Summary
 void addToFront(java.lang.Object ob)
          addToFront adds a new object to the front of this sequence
 void addToRear(java.lang.Object ob)
          addToRear adds a new object to the end of this sequence
 java.lang.Object removeFromFront()
          removeFromFront deletes the front object of this sequence
 java.lang.Object removeFromRear()
          removeFromRear deletes the rear object of this sequence
 java.lang.String toString()
          toString constructs a string representation of the sequence from front to rear
 java.lang.String toStringReversed()
          toStringReversed constructs a string representation of the sequence in reverse order, from rear to front
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DualSequence

public DualSequence()
Constructor DualSequence constructs an empty sequence
Method Detail

addToFront

public void addToFront(java.lang.Object ob)
addToFront adds a new object to the front of this sequence
Parameters:
ob - - the object added

addToRear

public void addToRear(java.lang.Object ob)
addToRear adds a new object to the end of this sequence
Parameters:
ob - - the object added

removeFromFront

public java.lang.Object removeFromFront()
removeFromFront deletes the front object of this sequence
Returns:
the object that is removed.

removeFromRear

public java.lang.Object removeFromRear()
removeFromRear deletes the rear object of this sequence
Returns:
the object that is removed.

toString

public java.lang.String toString()
toString constructs a string representation of the sequence from front to rear
Returns:
the string
Overrides:
toString in class java.lang.Object

toStringReversed

public java.lang.String toStringReversed()
toStringReversed constructs a string representation of the sequence in reverse order, from rear to front
Returns:
the string