Package com.ibm.icu.text
Class Quantifier
- java.lang.Object
-
- com.ibm.icu.text.Quantifier
-
- All Implemented Interfaces:
UnicodeMatcher
class Quantifier extends java.lang.Object implements UnicodeMatcher
-
-
Field Summary
Fields Modifier and Type Field Description private UnicodeMatcher
matcher
static int
MAX
Maximum count a quantifier can have.private int
maxCount
private int
minCount
-
Fields inherited from interface com.ibm.icu.text.UnicodeMatcher
ETHER, U_MATCH, U_MISMATCH, U_PARTIAL_MATCH
-
-
Constructor Summary
Constructors Constructor Description Quantifier(UnicodeMatcher theMatcher, int theMinCount, int theMaxCount)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMatchSetTo(UnicodeSet toUnionTo)
Implementation of UnicodeMatcher API.int
matches(Replaceable text, int[] offset, int limit, boolean incremental)
Implement UnicodeMatcher API.boolean
matchesIndexValue(int v)
Implement UnicodeMatcher APIjava.lang.String
toPattern(boolean escapeUnprintable)
Implement UnicodeMatcher API
-
-
-
Field Detail
-
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:
- Constant Field Values
-
-
Constructor Detail
-
Quantifier
public Quantifier(UnicodeMatcher theMatcher, int theMinCount, int theMaxCount)
-
-
Method Detail
-
matches
public int matches(Replaceable text, int[] offset, int limit, boolean incremental)
Implement UnicodeMatcher API.- Specified by:
matches
in interfaceUnicodeMatcher
- Parameters:
text
- the text to be matchedoffset
- 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 java.lang.String toPattern(boolean escapeUnprintable)
Implement UnicodeMatcher API- Specified by:
toPattern
in interfaceUnicodeMatcher
- 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 interfaceUnicodeMatcher
-
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 interfaceUnicodeMatcher
- Parameters:
toUnionTo
- the set into which to union the source characters
-
-