// --------------------------------------------------------------- // BinaryNode - Base class of all operations that act upon two // Node objects (+, -, *, /, ^) // --------------------------------------------------------------- import java.util.HashMap; public abstract class BinaryNode extends Node { public BinaryNode(Node left, Node right) { mLeft = left; mRight = right; } // -------------------------------------------------------- // Subclasses have to provide this method, allows us to // implement toString universally // -------------------------------------------------------- public abstract char getSymbol(); public String toString() { return(mLeft.toString() + " " + getSymbol() + " " + mRight.toString()); } protected Node getLeft() { return(mLeft); } protected Node getRight() { return(mRight); } private Node mLeft; private Node mRight; }