Package com.marakana.calculator.expressions

Examples of com.marakana.calculator.expressions.OperationExpression


      return false;
    }

    // pop two numbers off the stack and push the result
    Expression rhs = stack.pop(), lhs = stack.pop();
    stack.push(new OperationExpression(operator, lhs, rhs));
    return true;
  }
View Full Code Here


  public void handleOperatorMustPerformOperation() {
    Stack<Expression> stack = new Stack<Expression>();
    stack.push(new NumberExpression(3));
    stack.push(new NumberExpression(4));
    assertTrue(Calculator.handleOperator("*", stack));
    assertEquals(new OperationExpression(Operator.MULTIPLY,
        new NumberExpression(3), new NumberExpression(4)), stack.pop());
  }
View Full Code Here

TOP

Related Classes of com.marakana.calculator.expressions.OperationExpression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.