Class Quantifier

java.lang.Object
com.ibm.icu.text.Quantifier
All Implemented Interfaces:
UnicodeMatcher

class Quantifier extends Object implements UnicodeMatcher
  • Field Details

    • matcher

      private UnicodeMatcher matcher
    • minCount

      private int minCount
    • maxCount

      private int maxCount
    • MAX

      public static final int MAX
      Maximum count a quantifier can have.
      See Also:
  • Constructor Details

    • Quantifier

      public Quantifier(UnicodeMatcher theMatcher, int theMinCount, int theMaxCount)
  • Method Details

    • matches

      public int matches(Replaceable text, int[] offset, int limit, boolean incremental)
      Implement UnicodeMatcher API.
      Specified by:
      matches in interface UnicodeMatcher
      Parameters:
      text - the text to be matched
      offset - on input, the index into text at which to begin matching. On output, the limit of the matched text. The number of matched characters is the output value of offset minus the input value. Offset should always point to the HIGH SURROGATE (leading code unit) of a pair of surrogates, both on entry and upon return.
      limit - the limit index of text to be matched. Greater than offset for a forward direction match, less than offset for a backward direction match. The last character to be considered for matching will be text.charAt(limit-1) in the forward direction or text.charAt(limit+1) in the backward direction.
      incremental - if true, then assume further characters may be inserted at limit and check for partial matching. Otherwise assume the text as given is complete.
      Returns:
      a match degree value indicating a full match, a partial match, or a mismatch. If incremental is false then U_PARTIAL_MATCH should never be returned.
    • toPattern

      public String toPattern(boolean escapeUnprintable)
      Implement UnicodeMatcher API
      Specified by:
      toPattern in interface UnicodeMatcher
      Parameters:
      escapeUnprintable - if true then convert unprintable character to their hex escape representations, \\uxxxx or \\Uxxxxxxxx. Unprintable characters are those other than U+000A, U+0020..U+007E.
    • matchesIndexValue

      public boolean matchesIndexValue(int v)
      Implement UnicodeMatcher API
      Specified by:
      matchesIndexValue in interface UnicodeMatcher
    • addMatchSetTo

      public void addMatchSetTo(UnicodeSet toUnionTo)
      Implementation of UnicodeMatcher API. Union the set of all characters that may be matched by this object into the given set.
      Specified by:
      addMatchSetTo in interface UnicodeMatcher
      Parameters:
      toUnionTo - the set into which to union the source characters