Source of LinkedDeque.java


  1: /**
  2:    A class that implements the a deque of objects by using 
  3:    a chain of doubly linked nodes.
  4:  
  5:    @author Frank M. Carrano
  6:    @author Timothy M. Henry
  7:    @version 4.0
  8: */
  9: public final class LinkedDeque<T> implements DequeInterface<T>
 10: {
 11:    private DLNode firstNode; // References node at front of deque
 12:    private DLNode lastNode;  // References node at back of deque
 13:         
 14:         public LinkedDeque()
 15:         {
 16:                 firstNode = null;
 17:                 lastNode = null;
 18:         } // end default constructor
 19:   
 20: //  < Implementations of the deque operations go here. >
 21: //  . . .
 22:   
 23:    private class DLNode
 24:    {
 25:                 private T      data;           // Deque entry
 26:                 private DLNode next;           // Link to next node
 27:                 private DLNode previous; // Link to previous node
 28:     
 29: //    < Constructors and the methods getData, setData, getNextNode, setNextNode, 
 30: //      getPreviousNode, and setPreviousNode are here. >
 31: //    . . .
 32:     
 33:   } // end DLNode
 34: } // end LinkedDeque