public class StringKeyAnalyzer extends KeyAnalyzer<java.lang.String>
KeyAnalyzer for Strings.| Modifier and Type | Field and Description |
|---|---|
static StringKeyAnalyzer |
INSTANCE
A singleton instance of
StringKeyAnalyzer. |
static int |
LENGTH
The number of bits per
Character. |
private static int |
MSB
A bit mask where the first bit is 1 and the others are zero.
|
private static long |
serialVersionUID |
EQUAL_BIT_KEY, NULL_BIT_KEY, OUT_OF_BOUNDS_BIT_KEY| Constructor and Description |
|---|
StringKeyAnalyzer() |
| Modifier and Type | Method and Description |
|---|---|
int |
bitIndex(java.lang.String key,
int offsetInBits,
int lengthInBits,
java.lang.String other,
int otherOffsetInBits,
int otherLengthInBits)
Returns the n-th different bit between key and other.
|
int |
bitsPerElement()
Returns the number of bits per element in the key.
|
boolean |
isBitSet(java.lang.String key,
int bitIndex,
int lengthInBits)
Returns whether or not a bit is set.
|
boolean |
isPrefix(java.lang.String prefix,
int offsetInBits,
int lengthInBits,
java.lang.String key)
Determines whether or not the given prefix (from offset to length) is a prefix of the given key.
|
int |
lengthInBits(java.lang.String key)
Returns the length of the Key in bits.
|
private static int |
mask(int bit)
Returns a bit mask where the given bit is set.
|
compareprivate static final long serialVersionUID
public static final StringKeyAnalyzer INSTANCE
StringKeyAnalyzer.public static final int LENGTH
Character.private static final int MSB
private static int mask(int bit)
public int bitsPerElement()
KeyAnalyzerbitsPerElement in class KeyAnalyzer<java.lang.String>public int lengthInBits(java.lang.String key)
KeyAnalyzerlengthInBits in class KeyAnalyzer<java.lang.String>key - the keypublic int bitIndex(java.lang.String key,
int offsetInBits,
int lengthInBits,
java.lang.String other,
int otherOffsetInBits,
int otherLengthInBits)
KeyAnalyzerbitIndex in class KeyAnalyzer<java.lang.String>key - the key to useoffsetInBits - the bit offset in the keylengthInBits - the maximum key length in bits to useother - the other key to useotherOffsetInBits - the bit offset in the other keyotherLengthInBits - the maximum key length in bits for the other keypublic boolean isBitSet(java.lang.String key,
int bitIndex,
int lengthInBits)
KeyAnalyzerisBitSet in class KeyAnalyzer<java.lang.String>key - the key to check, may not be nullbitIndex - the bit index to checklengthInBits - the maximum key length in bits to checktrue if the bit is set in the given key and
bitIndex < lengthInBits, false otherwise.public boolean isPrefix(java.lang.String prefix,
int offsetInBits,
int lengthInBits,
java.lang.String key)
KeyAnalyzerisPrefix in class KeyAnalyzer<java.lang.String>prefix - the prefix to checkoffsetInBits - the bit offset in the keylengthInBits - the maximum key length in bits to usekey - the key to checktrue if this is a valid prefix for the given key