public class StringKeyAnalyzer extends KeyAnalyzer<String>
KeyAnalyzer
for String
s.Modifier and Type | Field and Description |
---|---|
static StringKeyAnalyzer |
INSTANCE
A singleton instance of
StringKeyAnalyzer . |
static int |
LENGTH
The number of bits per
Character . |
EQUAL_BIT_KEY, NULL_BIT_KEY, OUT_OF_BOUNDS_BIT_KEY
Constructor and Description |
---|
StringKeyAnalyzer() |
Modifier and Type | Method and Description |
---|---|
int |
bitIndex(String key,
int offsetInBits,
int lengthInBits,
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(String key,
int bitIndex,
int lengthInBits)
Returns whether or not a bit is set.
|
boolean |
isPrefix(String prefix,
int offsetInBits,
int lengthInBits,
String key)
Determines whether or not the given prefix (from offset to length) is a prefix of the given key.
|
int |
lengthInBits(String key)
Returns the length of the Key in bits.
|
compare
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public static final StringKeyAnalyzer INSTANCE
StringKeyAnalyzer
.public static final int LENGTH
Character
.public StringKeyAnalyzer()
public int bitsPerElement()
KeyAnalyzer
bitsPerElement
in class KeyAnalyzer<String>
public int lengthInBits(String key)
KeyAnalyzer
lengthInBits
in class KeyAnalyzer<String>
key
- the keypublic int bitIndex(String key, int offsetInBits, int lengthInBits, String other, int otherOffsetInBits, int otherLengthInBits)
KeyAnalyzer
bitIndex
in class KeyAnalyzer<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(String key, int bitIndex, int lengthInBits)
KeyAnalyzer
isBitSet
in class KeyAnalyzer<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(String prefix, int offsetInBits, int lengthInBits, String key)
KeyAnalyzer
isPrefix
in class KeyAnalyzer<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 keyCopyright © 2001–2019 The Apache Software Foundation. All rights reserved.