Interface KeyAnalyzer<K>
-
- All Superinterfaces:
java.util.Comparator<K>
public interface KeyAnalyzer<K> extends java.util.Comparator<K>
TheKeyAnalyzer
provides bit-level access to keys for thePatriciaTrie
.
-
-
Field Summary
Fields Modifier and Type Field Description static int
EQUAL_BIT_KEY
Returned bybitIndex(Object, Object)
if a the bits of two keys were all equal.static int
NULL_BIT_KEY
Returned bybitIndex(Object, Object)
if a key's bits were all zero (0).static int
OUT_OF_BOUNDS_BIT_KEY
Returned bybitIndex(Object, Object)
if a keys indices are out of bounds.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
bitIndex(K key, K otherKey)
Returns the index of the first bit that is different in the two keys.boolean
isBitSet(K key, int bitIndex)
Returnstrue
if a key's bit it set at the given index.boolean
isPrefix(K key, K prefix)
Returnstrue
if the second argument is a prefix of the first argument.int
lengthInBits(K key)
Returns the key's length in bits.
-
-
-
Field Detail
-
NULL_BIT_KEY
static final int NULL_BIT_KEY
Returned bybitIndex(Object, Object)
if a key's bits were all zero (0).- See Also:
- Constant Field Values
-
EQUAL_BIT_KEY
static final int EQUAL_BIT_KEY
Returned bybitIndex(Object, Object)
if a the bits of two keys were all equal.- See Also:
- Constant Field Values
-
OUT_OF_BOUNDS_BIT_KEY
static final int OUT_OF_BOUNDS_BIT_KEY
Returned bybitIndex(Object, Object)
if a keys indices are out of bounds.- See Also:
- Constant Field Values
-
-
Method Detail
-
lengthInBits
int lengthInBits(K key)
Returns the key's length in bits.
-
isBitSet
boolean isBitSet(K key, int bitIndex)
Returnstrue
if a key's bit it set at the given index.
-
bitIndex
int bitIndex(K key, K otherKey)
Returns the index of the first bit that is different in the two keys.
-
-