/** * This class implements a node for a PDA singly linked list in Java. */ public class Node { //The input character to match public String wordChar; //The stck character to match //"e" = empty string public String stackChar; //The new character to push onto the stack //"e" = empty string public String pushChar; Node next; /** * Constructs a new node object, initalizing it with the given data * item. The next pointer of the node is set to null. * @param data The character this node is to be initalized with. */ public Node(String l, String s, String p) { wordChar = l; stackChar = s; pushChar = p; next = null; } /** * Returns the next pointer for the given node. * @return The next pointer of this node. */ public Node getNext() { return next; } /** * Sets the next pointer for the given node. * @param next The new value for the next pointer of this node */ public void setNext(Node next) { this.next = next; } /** * Sets the data item for the given node. * @param data The new value for the data item in this node. */ public void setData(String l, String s, String p ) { wordChar = l; stackChar = s; pushChar = p; } public String toString () { // Convenience method for tracing. return ("["+wordChar+","+stackChar+","+pushChar+"]"); } }