
/**
 * NonEmptyListNode.java
 *
 *
 * Created: Tue Oct 08 18:41:39 2002
 *
 * @author <a href="mailto:bina@cse.buffalo.edu "</a>
 * @version
 */
package containers;

public class NonEmptyListNode extends AListNode{
   private Object head;
   private List tail;

   NonEmptyListNode(Object o)
   {
      head = o;
      tail = new List();  // instead of null
   }

   NonEmptyListNode(Object o, List t)
   {
      head = o;
      tail = t;
   }

   Object head()
   { return head;
   }

   List tail()
   {
      return tail;
   }

   boolean removeFirst(List owner)
   {
      //AListNode a = owner.tail().getState();
      owner.changeState(owner.tail().getState());
      System.out.println("NonEmptyNode: " + "Removed first node and possibly changed state");
      return true;
      } // end of if ()

   void addFirst(Object o, List owner)
   {  
      NonEmptyListNode x = new NonEmptyListNode(o, owner);
      owner.changeState(x);
      System.out.println("NonEmptyNode: " + "added " + o);
   }
      
   
}// NonEmptyListNode



