Example #1
0
        protected override object EvaluationInternal(IDictionary <object, object> parameters)
        {
            var operand = Operand.Evaluation(parameters);

            if (operand == null)
            {
                return(0);
            }
            if (operand == ExpressionConstants.Unevaluatable)
            {
                return(ExpressionConstants.Unevaluatable);
            }

            Number num = null;

            if (operand is string)
            {
                num = ExprEvalUtils.String2Number((string)operand);
            }
            else
            {
                num = (Number)operand;
            }
            return(ExprEvalUtils.Calculate(this, num));
        }
Example #2
0
        protected override object EvaluationInternal(IDictionary <object, object> parameters)
        {
            var left  = LeftOprand.Evaluation(parameters);
            var right = rightOprand.Evaluation(parameters);

            if (left == null || right == null)
            {
                return(null);
            }
            if (left == ExpressionConstants.Unevaluatable || right == ExpressionConstants.Unevaluatable)
            {
                return(ExpressionConstants.Unevaluatable);
            }
            var pair = ExprEvalUtils.ConvertNum2SameLevel(left, right);

            return(ExprEvalUtils.Calculate(this, pair.Key, pair.Value));
        }