Class SmallCharMatcher

  • All Implemented Interfaces:
    Predicate<java.lang.Character>, java.util.function.Predicate<java.lang.Character>

    @GwtIncompatible
    final class SmallCharMatcher
    extends CharMatcher.NamedFastMatcher
    An immutable version of CharMatcher for smallish sets of characters that uses a hash table with linear probing to check for matches.
    • Constructor Detail

      • SmallCharMatcher

        private SmallCharMatcher​(char[] table,
                                 long filter,
                                 boolean containsZero,
                                 java.lang.String description)
    • Method Detail

      • smear

        static int smear​(int hashCode)
      • checkFilter

        private boolean checkFilter​(int c)
      • chooseTableSize

        static int chooseTableSize​(int setSize)
        Returns an array size suitable for the backing array of a hash table that uses open addressing with linear probing in its implementation. The returned size is the smallest power of two that can hold setSize elements with the desired load factor.
      • from

        static CharMatcher from​(java.util.BitSet chars,
                                java.lang.String description)
      • matches

        public boolean matches​(char c)
        Description copied from class: CharMatcher
        Determines a true or false value for the given character.
        Specified by:
        matches in class CharMatcher
      • setBits

        void setBits​(java.util.BitSet table)
        Description copied from class: CharMatcher
        Sets bits in table matched by this matcher.
        Overrides:
        setBits in class CharMatcher