Exemple #1
0
        static double doMaths(double dblOne, double dblTwo, MathsOperator enumOperator)
        {
            switch (enumOperator)
            {
                case MathsOperator.add:
                    return dblOne + dblTwo;
                case MathsOperator.subtract:
                    return dblOne - dblTwo;
                case MathsOperator.divide:
                    return dblOne / dblTwo;
                case MathsOperator.multiply:
                    return dblOne * dblTwo;
                default:
                    return 0;

            }
        }
Exemple #2
0
 /// <summary>Creates a new evaluatable that returns the result of the two given evaluatables with the given operator.</summary>
 public NumberMathsOperation(Evaluatable <double> eval1, MathsOperator op, Evaluatable <double> eval2)
 {
     Operand1 = eval1; Operand2 = eval2; Operator = op;
 }
Exemple #3
0
 /// <summary>Creates a new evaluatable that returns the result of the given evaluatable and given number with the given operator.</summary>
 public NumberMathsOperation(Evaluatable <double> eval, MathsOperator op, double value)
 {
     Operand1 = eval; Operand2 = new NumberConstant(value); Operator = op;
 }
Exemple #4
0
 /// <summary>Creates a new evaluatable that returns the result of the two given numbers with the given operator.</summary>
 public NumberMathsOperation(double value1, MathsOperator op, double value2)
 {
     Operand1 = new NumberConstant(value1); Operand2 = new NumberConstant(value2); Operator = op;
 }