Class RPNEvaluatorSolution

java.lang.Object
  |
  +--RPNEvaluatorSolution
All Implemented Interfaces:
IRPNEvaluator

public class RPNEvaluatorSolution
extends Object
implements IRPNEvaluator

IRPNEvaluator solution that uses a stack and a queue to process the tokens of the expression


Field Summary
protected  IStack operands
          Stack used to hold operands during evaluation.
protected  IQueue tokens
          Queue used to hold parsed tokens.
 
Constructor Summary
RPNEvaluatorSolution()
          Creates a new RPN evaluator.
 
Method Summary
 int evaluate(String anExpression)
          Returns the result of evaluating the given RPN expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tokens

protected IQueue tokens
Queue used to hold parsed tokens.


operands

protected IStack operands
Stack used to hold operands during evaluation.

Constructor Detail

RPNEvaluatorSolution

public RPNEvaluatorSolution()
Creates a new RPN evaluator.

Method Detail

evaluate

public int evaluate(String anExpression)
Returns the result of evaluating the given RPN expression.

Specified by:
evaluate in interface IRPNEvaluator
Parameters:
anExpression - expression to evaluate