public String unparse() // throws BugException { return "(" + left.unparse() + ")" + SyntaxTree.token2String(token) + "(" + right.unparse() + ")"; }
public EC evaluate(EC ec) throws BugException, PartialException { EC ec1 = left.evaluate(ec); EC ec2 = right.evaluate(ec); EC ec3 = EC.ZERO; switch (token) { case -1: throw new BugException("SyntaxTreeBinary.evaluate(NOTOKEN)"); case 0: // '\0' ec3 = ec1.add(ec2); break; case 1: // '\001' ec3 = ec1.subtract(ec2); break; case 2: // '\002' ec3 = ec1.multiply(ec2); break; case 3: // '\003' ec3 = ec1.divide(ec2); break; case 4: // '\004' ec3 = ec1.power(ec2); break; case 5: // '\005' case 6: // '\006' case 7: // '\007' case 8: // '\b' case 9: // '\t' case 10: // '\n' case 11: // '\013' case 12: // '\f' case 13: // '\r' case 14: // '\016' case 15: // '\017' case 16: // '\020' case 17: // '\021' case 18: // '\022' throw new BugException( "SyntaxTreeBinary.evaluate with unary token " + SyntaxTree.token2String(token)); } return ec3; }