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 5.0
  8:  */
  9: public class LList<T> implements ListInterface<T>
 10: {
 11:         private Node firstNode;            // Reference to first node
 12:         private int  numberOfEntries;
 13:    
 14:         public LList()
 15:         {
 16:                 initializeDataFields();
 17:         } // end default constructor
 18:    
 19:    public int clear()
 20:    {
 21:       initializeDataFields();
 22:    } // end clear

 24: /*  < Implementations of the public methods add, remove, replace, getEntry, contains,
 25:       getLength, isEmpty, and toArray go here. >
 26:    . . . */

 28:    // Initializes the class’s data fields to indicate an empty list.
 29:    private void initializeDataFields()
 30:    {
 31:       firstNode = null;
 32:       numberOfEntries = 0;
 33:    } // end initializeDataFields
 34:    
 35:    // Returns a reference to the node at a given position. 
 36:    private Node getNodeAt(int givenPosition)
 37:    {
 38: //    . . .
 39:    } // end getNodeAt

 41:    private class Node
 42:    {
 43:       private T data;
 44:       private Node next;
 45: //    . . .

 47:    } // end Node
 48: } // end LList