Esempio n. 1
0
        /// <summary>
        /// Returns stringIndex+shift, the next position to match
        /// </summary>
        ///
        public override int Matches(int stringIndex, String testString,
                                    MatchResultImpl matchResult)
        {
            int size      = children.Count;
            int leftBound = (matchResult.HasTransparentBounds()) ? 0 : matchResult
                            .GetLeftBound();

            int shift = next.Matches(stringIndex, testString, matchResult);

            if (shift >= 0)
            {
                //fSet will take this index to check if we at the right bound
                // and return true if the current index equal to this one
                matchResult.SetConsumed(groupIndex, stringIndex);
                for (int i = 0; i < size; i++)
                {
                    AbstractSet e = (AbstractSet)children[i];
                    // find limits could be calculated though e.getCharCount()
                    // fSet will return true only if string index at fSet equal
                    // to stringIndex
                    if (e.FindBack(leftBound, stringIndex, testString, matchResult) >= 0)
                    {
                        matchResult.SetConsumed(groupIndex, -1);
                        return(shift);
                    }
                }
            }

            return(-1);
        }
Esempio n. 2
0
        public override int Matches(int stringIndex, String testString,
                                    MatchResultImpl matchResult)
        {
            int rightBound = (matchResult.HasTransparentBounds()) ? testString.Length : matchResult.GetRightBound();

            if (stringIndex < rightBound)
            {
                return(-1);
            }

            matchResult.hitEnd     = true;
            matchResult.requireEnd = true;

            return(next.Matches(stringIndex, testString, matchResult));
        }
Esempio n. 3
0
        public override int Matches(int stringIndex, String testString,
                                    MatchResultImpl matchResult)
        {
            bool left;
            bool right;

            char ch1 = (stringIndex >= matchResult.GetRightBound()) ? ' '
                                        : testString[stringIndex];
            char ch2 = (stringIndex == 0) ? ' ' : testString[stringIndex - 1];

            int leftBound = (matchResult.HasTransparentBounds()) ? 0 : matchResult
                            .GetLeftBound();

            left  = (ch1 == ' ') || IsSpace(ch1, stringIndex, leftBound, testString);
            right = (ch2 == ' ') ||
                    IsSpace(ch2, stringIndex - 1, leftBound, testString);
            return(((left ^ right) ^ positive) ? -1 : next.Matches(stringIndex,
                                                                   testString, matchResult));
        }
Esempio n. 4
0
 /// @com.intel.drl.spec_ref
 public bool HasTransparentBounds()
 {
     return(matchResult.HasTransparentBounds());
 }