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