public final class RangeTreeMatcher extends InvertibleCharMatcher
match(char c) {
if (c < 4) {
return 1 <= c && c <= 2;
} else if (c > 5) {
if (c < 10) {
return false;
} else if (c > 11) {
return 20 <= c && c <= 22;
} else {
return true;
}
} else {
return true;
}
}
| Modifier and Type | Method and Description |
|---|---|
static RangeTreeMatcher |
create(boolean invert,
int[] ranges)
Constructs a new
RangeTreeMatcher. |
int |
estimatedCost()
Conservatively estimate the equivalent number of integer comparisons of calling
CharMatcher.match(int). |
boolean |
match(int c)
Check if a given code point matches this
CharMatcher. |
String |
toString() |
modifiersToString, result, resultpublic static RangeTreeMatcher create(boolean invert, int[] ranges)
RangeTreeMatcher.invert - see InvertibleCharMatcher.ranges - a sorted array of character ranges in the form [lower inclusive bound of range
0, higher inclusive bound of range 0, lower inclusive bound of range 1, higher
inclusive bound of range 1, ...]. The array contents are not modified by this
method.RangeTreeMatcher.public boolean match(int c)
CharMatcherCharMatcher.match in class CharMatcherc - any code point.true if the character matches.CompilerDirectives.isPartialEvaluationConstant(Object)public int estimatedCost()
CharMatcherCharMatcher.match(int).estimatedCost in class CharMatcherCharMatcher.match(int) is roughly
equivalent to. Array loads are treated as two comparisons.