edu.stanford.rsl.konrad.numerics.mathexpressions
Class CompoundExpression

java.lang.Object
  extended by edu.stanford.rsl.konrad.numerics.mathexpressions.AbstractMathExpression
      extended by edu.stanford.rsl.konrad.numerics.mathexpressions.CompoundExpression

public class CompoundExpression
extends AbstractMathExpression

Class to model Mathematical Expressions consisting of 2 or more expressions.

Author:
Rotimi X Ojo

Constructor Summary
CompoundExpression(AbstractMathExpression leftExp, AbstractMathExpression rightExp, char operator)
           
 
Method Summary
 double evaluate(java.util.Map<java.lang.String,java.lang.Double> varTable)
          Determines the value of string expression represented by this class by replacing variables with values provided in map; If expression has no variable evaluate() should be called;
 java.lang.String toString()
          Converts a mathematical expression an equivalent string literal
 
Methods inherited from class edu.stanford.rsl.konrad.numerics.mathexpressions.AbstractMathExpression
evaluate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompoundExpression

public CompoundExpression(AbstractMathExpression leftExp,
                          AbstractMathExpression rightExp,
                          char operator)
Method Detail

toString

public java.lang.String toString()
Description copied from class: AbstractMathExpression
Converts a mathematical expression an equivalent string literal

Specified by:
toString in class AbstractMathExpression

evaluate

public double evaluate(java.util.Map<java.lang.String,java.lang.Double> varTable)
Description copied from class: AbstractMathExpression
Determines the value of string expression represented by this class by replacing variables with values provided in map; If expression has no variable evaluate() should be called;

Specified by:
evaluate in class AbstractMathExpression
Returns:
the evaluation result