示例#1
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));
        }
示例#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 b1 = ExprEvalUtils.Obj2bool(left);
            var b2 = ExprEvalUtils.Obj2bool(right);

            return(b1 != b2 ? LiteralBoolean.True : LiteralBoolean.False);
        }
示例#3
0
        protected override object EvaluationInternal(IDictionary <object, object> parameters)
        {
            object left  = LeftOprand.Evaluation(parameters);
            object right = RightOprand.Evaluation(parameters);

            if (left == null || right == null)
            {
                return(null);
            }
            if (left == UnEvaluatable || right == UnEvaluatable)
            {
                return(UnEvaluatable);
            }
            bool b1 = false, b2 = false;

            if (Boolean.TryParse(left.ToString(), out b1) && Boolean.TryParse(right.ToString(), out b2))
            {
                return(b1 != b2 ? LiteralBoolean.TRUE : LiteralBoolean.FALSE);
            }
            return(LiteralBoolean.FALSE);
        }
示例#4
0
        public override object Evaluation(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);
            }
            if (left is Number || right is Number)
            {
                var pair = ExprEvalUtils.ConvertNum2SameLevel(left, right);
                left  = pair.Key;
                right = pair.Value;
            }
            return(left.Equals(right) ? LiteralBoolean.True : LiteralBoolean.False);
        }