Top Description Fields Constructors Methods
com.google.common.base

pack-priv final Class SmallCharMatcher

extends NamedFastMatcher
Class Inheritance
Annotations
@GwtIncompatible
@ElementTypesAreNonnullByDefault
Imports
com.google.common.annotations.GwtIncompatible, .VisibleForTesting, com.google.common.base.CharMatcher.NamedFastMatcher, java.util.BitSet

An immutable version of CharMatcher for smallish sets of characters that uses a hash table with linear probing to check for matches.
Author
Christopher Swenson

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
private final boolean
private static final double
private final long
pack-priv static final int
private final char[]

Constructor Summary

AccessConstructor and Description
private
SmallCharMatcher(char[] table, long filter, boolean containsZero, String description)

Method Summary

Modifier and TypeMethod and Description
private boolean
checkFilter(int c)

pack-priv 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.

pack-priv static CharMatcher
from(BitSet chars, String description)

public boolean
matches(char c)

Implements abstract com.google.common.base.CharMatcher.matches.

Determines a true or false value for the given character.
pack-priv void
setBits(BitSet table)

Overrides com.google.common.base.CharMatcher.setBits.

Sets bits in table matched by this matcher.
pack-priv static int
smear(int hashCode)

Inherited from com.google.common.base.CharMatcher.NamedFastMatcher:
toString

Field Detail

C1back to summary
private static final int C1
C2back to summary
private static final int C2
containsZeroback to summary
private final boolean containsZero
DESIRED_LOAD_FACTORback to summary
private static final double DESIRED_LOAD_FACTOR
filterback to summary
private final long filter
MAX_SIZEback to summary
pack-priv static final int MAX_SIZE
tableback to summary
private final char[] table

Constructor Detail

SmallCharMatcherback to summary
private SmallCharMatcher(char[] table, long filter, boolean containsZero, String description)

Method Detail

checkFilterback to summary
private boolean checkFilter(int c)
chooseTableSizeback to summary
pack-priv 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.

Annotations
@VisibleForTesting
fromback to summary
pack-priv static CharMatcher from(BitSet chars, String description)
matchesback to summary
public boolean matches(char c)

Implements abstract com.google.common.base.CharMatcher.matches.

Doc from com.google.common.base.CharMatcher.matches.

Determines a true or false value for the given character.

Annotations
@Override
setBitsback to summary
pack-priv void setBits(BitSet table)

Overrides com.google.common.base.CharMatcher.setBits.

Doc from com.google.common.base.CharMatcher.setBits.

Sets bits in table matched by this matcher.

Annotations
@Override
smearback to summary
pack-priv static int smear(int hashCode)