Exemple #1
0
 public override double GetEvaluatedValue(params object[] bindings)
 {
     if (LeftOperandExpression == null)
     {
         return(RightOperandTerm.GetEvaluatedValue(bindings));
     }
     else
     {
         if (Operator == ArithmeticOperator.PLUS)
         {
             return(LeftOperandExpression.GetEvaluatedValue(bindings) + RightOperandTerm.GetEvaluatedValue(bindings));
         }
         else if (Operator == ArithmeticOperator.MINUS)
         {
             return(LeftOperandExpression.GetEvaluatedValue(bindings) - RightOperandTerm.GetEvaluatedValue(bindings));
         }
         else
         {
             throw new InvalidOperationException();
         }
     }
 }
Exemple #2
0
 public double GetEvaluatedValue(params object[] bindings)
 {
     if (LeftOperandTerm == null)
     {
         return(RightOperandFactor.GetEvaluatedValue(bindings));
     }
     else
     {
         if (Operator == ArithmeticOperator.MULTIPLY)
         {
             return(LeftOperandTerm.GetEvaluatedValue(bindings) * RightOperandFactor.GetEvaluatedValue(bindings));
         }
         else if (Operator == ArithmeticOperator.DIVIDE)
         {
             return(LeftOperandTerm.GetEvaluatedValue(bindings) / RightOperandFactor.GetEvaluatedValue(bindings));
         }
         else
         {
             throw new InvalidOperationException();
         }
     }
 }