Exemplo n.º 1
0
        /**
         * When the second argument is a string, many things are possible
         */
        private static IMatchPredicate CreateGeneralMatchPredicate(StringEval stringEval)
        {
            String value     = stringEval.StringValue;
            CmpOp  operator1 = CmpOp.GetOperator(value);

            value = value.Substring(operator1.Length);

            bool?booleanVal = ParseBoolean(value);

            if (booleanVal != null)
            {
                return(new BooleanMatcher(booleanVal.Value, operator1));
            }

            Double doubleVal = OperandResolver.ParseDouble(value);

            if (!double.IsNaN(doubleVal))
            {
                return(new NumberMatcher(doubleVal, operator1));
            }
            ErrorEval ee = ParseError(value);

            if (ee != null)
            {
                return(new ErrorMatcher(ee.ErrorCode, operator1));
            }

            //else - just a plain string with no interpretation.
            return(new StringMatcher(value, operator1));
        }
Exemplo n.º 2
0
        /**
         * When the second argument Is a string, many things are possible
         */
        private static I_MatchPredicate CreateGeneralMatchPredicate(StringEval stringEval)
        {
            String value = stringEval.StringValue;
            CmpOp  optr  = CmpOp.GetOperator(value);

            value = value.Substring(optr.Length);

            bool?boolVal = ParseBoolean(value);

            if (boolVal != null)
            {
                return(new BooleanMatcher(boolVal == true?true:false, optr));
            }


            Double doubleVal = OperandResolver.ParseDouble(value);

            if (!double.IsNaN(doubleVal))
            {
                return(new NumberMatcher(doubleVal, optr));
            }

            //else - just a plain string with no interpretation.
            return(new StringMatcher(value, optr));
        }