Пример #1
0
        public ReferenceStepQuery.MatchType Test(PropertyReference propertyReference, int startIndex)
        {
            int i;

            ReferenceStepQuery.Step.MatchType matchType;
            int num = 0;

            for (i = startIndex; num < (int)this.steps.Length && i < propertyReference.Count; i++)
            {
                ReferenceStepQuery.Step           step       = this.steps[num];
                ReferenceStepQuery.Step.MatchType matchType1 = step.Matches(propertyReference[i]);
                if (matchType1 == ReferenceStepQuery.Step.MatchType.NoMatch)
                {
                    return(ReferenceStepQuery.MatchType.NoMatch);
                }
                if (matchType1 == ReferenceStepQuery.Step.MatchType.ContinueMatch)
                {
                    if (num == (int)this.steps.Length - 1)
                    {
                        return(ReferenceStepQuery.MatchType.Exact);
                    }
                    do
                    {
                        i++;
                        if (i >= propertyReference.Count)
                        {
                            break;
                        }
                        matchType  = this.steps[num + 1].Matches(propertyReference[i]);
                        matchType1 = matchType;
                    }while (matchType != ReferenceStepQuery.Step.MatchType.YesMatch);
                }
                num++;
            }
            if (num == (int)this.steps.Length && i == propertyReference.Count)
            {
                return(ReferenceStepQuery.MatchType.Exact);
            }
            if (num == (int)this.steps.Length)
            {
                return(ReferenceStepQuery.MatchType.WildCardContains);
            }
            return(ReferenceStepQuery.MatchType.PropertyReferenceContains);
        }
Пример #2
0
        public ReferenceStepQuery.MatchType Test(DocumentNodeMarker marker, DocumentNodeMarker root)
        {
            ReferenceStepQuery.Step.MatchType matchType;
            int length = (int)this.steps.Length - 1;
            DocumentNodeMarker parent = marker;

            while (length >= 0 && parent != root)
            {
                ReferenceStepQuery.Step.MatchType matchType1 = this.steps[length].Matches(parent);
                if (matchType1 == ReferenceStepQuery.Step.MatchType.NoMatch)
                {
                    return(ReferenceStepQuery.MatchType.NoMatch);
                }
                if (matchType1 == ReferenceStepQuery.Step.MatchType.ContinueMatch)
                {
                    if (length == 0)
                    {
                        return(ReferenceStepQuery.MatchType.Exact);
                    }
                    do
                    {
                        parent = parent.Parent;
                        if (parent == root)
                        {
                            break;
                        }
                        matchType  = this.steps[length - 1].Matches(parent);
                        matchType1 = matchType;
                    }while (matchType != ReferenceStepQuery.Step.MatchType.YesMatch);
                }
                length--;
            }
            if (length == 0 && parent == root)
            {
                return(ReferenceStepQuery.MatchType.Exact);
            }
            if (length < 0)
            {
                return(ReferenceStepQuery.MatchType.NoMatch);
            }
            return(ReferenceStepQuery.MatchType.NoMatch);
        }