Class BitSetMatcher


public final class BitSetMatcher extends InvertibleCharMatcher
Matcher that matches multiple characters with a common high byte using a bit set.
Example: characters တ, ဠ, ူ have a common high byte 0x10, so they are matched by this high byte and a bit set that matches 0x10, 0x20 and 0x30.
  • Method Details

    • create

      public static InvertibleCharMatcher create(boolean invert, int highByte, long[] bitSet)
      Constructs a new bit-set-based character matcher.
      Parameters:
      invert - see InvertibleCharMatcher.
      highByte - the high byte common to all characters to match.
      bitSet - the bit set to match the low byte of the characters to match.
      Returns:
      a new BitSetMatcher or a NullHighByteBitSetMatcher.
    • getBitSet

      public long[] getBitSet()
    • match

      public boolean match(int c)
      Description copied from class: CharMatcher
      Check if a given code point matches this CharMatcher.
      Specified by:
      match in class CharMatcher
      Parameters:
      c - any code point.
      Returns:
      true if the character matches.
      See Also:
      • CompilerDirectives.isPartialEvaluationConstant(Object)
    • estimatedCost

      public int estimatedCost()
      Description copied from class: CharMatcher
      Conservatively estimate the equivalent number of integer comparisons of calling CharMatcher.match(int).
      Specified by:
      estimatedCost in class CharMatcher
      Returns:
      the number of integer comparisons one call to CharMatcher.match(int) is roughly equivalent to. Array loads are treated as two comparisons.
    • toString

      public String toString()
      Overrides:
      toString in class Object