/** * Node containing an element of a linked list. * @author Jeff Raab */ public class Node implements Position { /** Object stored in this. */ protected Object element; /** Node before this in the list containing this. */ public Node before; /** Node after this in the list containing this. */ public Node after; /** Constructs a new node with no data. */ public Node() {} /** * Constructs a new node with the given data. * @param anObject object to be stored in the node * @param aBefore node that comes before the node * @param anAfter node that comes after the node */ public Node(Object anObject, Node aBefore, Node anAfter) { element = anObject; before = aBefore; after = anAfter; } /** Returns the element stored in this. */ public Object element() { return element; } }