Source of J9.13.java


  1: // @author Frank M. Carrano, Timothy M. Henry
  2: // @version 5.0

  4: private class Node implements Cloneable
  5: {
  6:    private T    data;
  7:    private Node next;

  9: /* Constructors
 10:    . . .

 12:    Accessor and mutator methods getData, setData, getNextNode, and setNextNode
 13:    . . . */

 15:    protected Object clone()
 16:    {
 17:       Node theCopy = null;
 18:       try
 19:       {
 20:          @SuppressWarnings("unchecked")
 21:          Node temp = (Node)super.clone();
 22:          theCopy = temp;
 23:       }
 24:       catch (CloneNotSupportedException e)
 25:       {
 26:          throw new Error(e.toString());
 27:       }
 28:       
 29:       @SuppressWarnings("unchecked")
 30:       T temp = (T)data.clone();
 31:       theCopy.data = temp;
 32:       theCopy.next = null; // Don't clone link; it's set later
 33:       
 34:       return theCopy;
 35:    } // end clone
 36: } // end Node