Пример #1
0
        public static bool IsPredMatch(Unifiable required, Unifiable actualValue, SubQuery subquery)
        {
            if (IsNull(required))
            {
                return(IsNullOrEmpty(actualValue));
            }
            required = required.Trim();
            if (required.IsAnyText)
            {
                return(!IsNullOrEmpty(actualValue));
            }

            string requiredToUpper = required.ToUpper();

            if (requiredToUpper == "*")
            {
                return(!IsUnknown(actualValue));
            }

            if (requiredToUpper == "OM" || IsNullOrEmpty(required) || requiredToUpper == "$MISSING")
            {
                return(IsNullOrEmpty(actualValue) || actualValue == "OM");
            }
            if (IsIncomplete(required))
            {
                return(IsIncomplete(actualValue));
            }
            if (IsNull(actualValue))
            {
                return(IsNullOrEmpty(required));
            }
            actualValue = actualValue.Trim();
            if (actualValue.WillUnify(required, subquery))
            {
                return(true);
            }
            string requiredAsStringReplaceReplace = required.AsString().Replace(" ", "\\s")
                                                    .Replace("*", "[\\sA-Z0-9]+").Replace("_", "[A-Z0-9]+");
            Regex matcher = new Regex("^" + requiredAsStringReplaceReplace + "$",
                                      RegexOptions.IgnoreCase);

            if (matcher.IsMatch(actualValue))
            {
                return(true);
            }
            if (requiredToUpper == "UNKNOWN" && (IsUnknown(actualValue)))
            {
                return(true);
            }
            return(false);
        }