|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.collections4.trie.KeyAnalyzer<String>
org.apache.commons.collections4.trie.analyzer.StringKeyAnalyzer
public class StringKeyAnalyzer
An KeyAnalyzer
for String
s.
Field Summary | |
---|---|
static StringKeyAnalyzer |
INSTANCE
A singleton instance of StringKeyAnalyzer . |
static int |
LENGTH
The number of bits per Character . |
Fields inherited from class org.apache.commons.collections4.trie.KeyAnalyzer |
---|
EQUAL_BIT_KEY, NULL_BIT_KEY, OUT_OF_BOUNDS_BIT_KEY |
Constructor Summary | |
---|---|
StringKeyAnalyzer()
|
Method Summary | |
---|---|
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. |
Methods inherited from class org.apache.commons.collections4.trie.KeyAnalyzer |
---|
compare |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
---|
equals |
Field Detail |
---|
public static final StringKeyAnalyzer INSTANCE
StringKeyAnalyzer
.
public static final int LENGTH
Character
.
Constructor Detail |
---|
public StringKeyAnalyzer()
Method Detail |
---|
public int bitsPerElement()
KeyAnalyzer
bitsPerElement
in class KeyAnalyzer<String>
public int lengthInBits(String key)
KeyAnalyzer
lengthInBits
in class KeyAnalyzer<String>
key
- the key
public 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 key
public 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 check
true
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 check
true
if this is a valid prefix for the given key
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |