ca.bcit.cst.comp2526.assign2b.solution
Class RPNCalculatorUtils

java.lang.Object
  extended by ca.bcit.cst.comp2526.assign2b.solution.RPNCalculatorUtils

public final class RPNCalculatorUtils
extends java.lang.Object

Abstract the processing of the formula with an RPNCalculaotr.


Method Summary
static int processFormula(RPNCalculator calc, java.lang.String formula)
          Process the speicified formula using the provided calculator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

processFormula

public static int processFormula(RPNCalculator calc,
                                 java.lang.String formula)
                          throws StackOverflowException,
                                 StackUnderflowException,
                                 InvalidOperationTypeException,
                                 java.lang.IllegalArgumentException
Process the speicified formula using the provided calculator.

Parameters:
calc - the calculator to perform the formula with.
formula - the formula to calculate.
Returns:
the result of the formula.
Throws:
StackOverflowException - if there are too many operands in the formula.
StackUnderflowException - if there are too few operands in the formula.
InvalidOperationTypeException - if there is an invalid operation type in the formula.
java.lang.IllegalArgumentException - if either of the arguments are null.
See Also:
Operation.getCode()