/**
   The class Node is used to built linked lists.
   Each node contains an element and a link to the next
   node in the list.
 
   @author      Franck van Breugel
   @version     1.1    August 23, 1999
*/
public class Node 
{
    private Object element; // element stored in node
    private Node next;      // next node in the list

    /** Constructs a Node without element and next node. */
    public Node() 
    {
        this(null, null);
    }

    /** 
       Constructs a Node with specified element and next node. 
         
       @param element the element stored in this node.
       @param next the next node in the list.
    */
    public Node(Object element, Node next) 
    {
        this.element = element;
        this.next = next;
    }

    /**
       Returns the element stored in this node.
     
       @return The element stored in this node.
    */
    public Object getElement()
    {
        return element;
    }

    /**
       Returns the next node in the list.
     
       @return The next node in the list.
    */
    public Node getNext()
    {
        return next;
    }

    /**
       Sets the element of this node to the specified element.
     
      @param The element of this node.
    */
    public void setElement(Object element)
    {
        this.element = element;
    }

    /**
       Sets the next node in the list to the specified node.
       
       @param The next node in the list.
    */
    public void setNext(Node next)
    {
        this.next = next;
    }
}
