Source of LList.java


  1: /**
  2:  A class that implements the ADT list by using a chain of
  3:  linked nodes that has a head reference.
  4:  
  5:  @author Frank M. Carrano
  6:  @author Timothy M. Henry
  7:  @version 4.0
  8:  */
  9: public class LList<T> implements ListInterface<T>
 10: {
 11:         private Node firstNode;            // Reference to first node of chain
 12:         private int  numberOfEntries;
 13:    
 14:         public LList()
 15:         {
 16:                 initializeDataFields();
 17:         } // end default constructor
 18:    
 19:    public int getLength()
 20:    {
 21:       return numberOfEntries;
 22:    } // end getLength
 23: 
 24: /*  < Implementations of the public methods add, remove, clear, replace, getEntry,
 25:       contains, isEmpty, and toArray go here. >
 26:    . . . */
 27: 
 28:    // Returns a reference to the node at a given position. 
 29:    private Node getNodeAt(int givenPosition)
 30:    {
 31: //    . . .
 32:    } // end getNodeAt
 33: 
 34:    private class Node
 35:    {
 36:       private T data;
 37:       private Node next;
 38: //    . . .
 39: 
 40:    } // end Node
 41: } // end LList