Package com.google.common.base
Class SmallCharMatcher
java.lang.Object
com.google.common.base.CharMatcher
com.google.common.base.CharMatcher.FastMatcher
com.google.common.base.CharMatcher.NamedFastMatcher
com.google.common.base.SmallCharMatcher
An immutable version of CharMatcher for smallish sets of characters that uses a hash table with
linear probing to check for matches.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.common.base.CharMatcher
CharMatcher.FastMatcher, CharMatcher.NamedFastMatcher, CharMatcher.Whitespace -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate final booleanprivate static final doubleprivate final long(package private) static final intprivate final char[] -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateSmallCharMatcher(char[] table, long filter, boolean containsZero, String description) -
Method Summary
Modifier and TypeMethodDescriptionprivate booleancheckFilter(int c) (package private) static intchooseTableSize(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.(package private) static CharMatcherbooleanmatches(char c) Determines a true or false value for the given character.(package private) voidSets bits intablematched by this matcher.(package private) static intsmear(int hashCode) Methods inherited from class com.google.common.base.CharMatcher.NamedFastMatcher
toStringMethods inherited from class com.google.common.base.CharMatcher.FastMatcher
negate, precomputedMethods inherited from class com.google.common.base.CharMatcher
and, any, anyOf, apply, ascii, breakingWhitespace, collapseFrom, countIn, digit, forPredicate, indexIn, indexIn, inRange, invisible, is, isNot, javaDigit, javaIsoControl, javaLetter, javaLetterOrDigit, javaLowerCase, javaUpperCase, lastIndexIn, matchesAllOf, matchesAnyOf, matchesNoneOf, none, noneOf, or, precomputedInternal, removeFrom, replaceFrom, replaceFrom, retainFrom, singleWidth, trimAndCollapseFrom, trimFrom, trimLeadingFrom, trimTrailingFrom, whitespace
-
Field Details
-
MAX_SIZE
static final int MAX_SIZE- See Also:
-
table
private final char[] table -
containsZero
private final boolean containsZero -
filter
private final long filter -
C1
private static final int C1- See Also:
-
C2
private static final int C2- See Also:
-
DESIRED_LOAD_FACTOR
private static final double DESIRED_LOAD_FACTOR- See Also:
-
-
Constructor Details
-
SmallCharMatcher
-
-
Method Details
-
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
-
matches
public boolean matches(char c) Description copied from class:CharMatcherDetermines a true or false value for the given character.- Specified by:
matchesin classCharMatcher
-
setBits
Description copied from class:CharMatcherSets bits intablematched by this matcher.- Overrides:
setBitsin classCharMatcher
-