Beispiel #1
0
        private bool recursiveMatch(int repeat, Name name, int offset, int len)
        {
            int tried = len;
            NdnRegexMatcherBase matcher = matchers_[0];

            if (0 < len && repeat >= repeatMax_)
            {
                return(false);
            }

            if (0 == len && repeat < repeatMin_)
            {
                return(false);
            }

            if (0 == len && repeat >= repeatMin_)
            {
                return(true);
            }

            while (tried >= 0)
            {
                if (matcher.match(name, offset, tried) &&
                    recursiveMatch(repeat + 1, name, offset + tried, len
                                   - tried))
                {
                    return(true);
                }
                --tried;
            }

            return(false);
        }
Beispiel #2
0
        private bool recursiveMatch(int matcherNo, Name name, int offset, int len)
        {
            int tried = len;

            if (matcherNo >= matchers_.Count)
            {
                return(len == 0);
            }

            NdnRegexMatcherBase matcher = matchers_[matcherNo];

            while (tried >= 0)
            {
                if (matcher.match(name, offset, tried) &&
                    recursiveMatch(matcherNo + 1, name, offset + tried, len
                                   - tried))
                {
                    return(true);
                }
                --tried;
            }

            return(false);
        }