public final class HybridBitSetMatcher extends InvertibleCharMatcher
RangeTreeMatcher, but replaces some subtrees with bit-set matches. Specifically, if the
character set contains many short ranges that differ only in the lowest byte, those ranges are
converted to a bit-set, which is checked when the binary search finds that the given character is
in the byte range denoted by the bit set. The threshold for bit-set conversion is defined by
TRegexOptions.TRegexRangeToBitSetConversionThreshold.
Example:
Character set: [0x02, 0x04, 0x06, 0x1000, 0x1020-0x1030] Resulting Hybrid matcher with threshold = 3: - ranges: [0x02-0x06, 0x1000, 0x1020-0x1030] - bit-sets: [[0x02, 0x04, 0x06], null, null ]
CompressedCodePointSet| Modifier and Type | Method and Description |
|---|---|
static HybridBitSetMatcher |
create(boolean invert,
CompressedCodePointSet ccps) |
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 HybridBitSetMatcher create(boolean invert, CompressedCodePointSet ccps)
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.