Interface KeyAnalyzer<K>
- All Superinterfaces:
Comparator<K>
The
KeyAnalyzer provides bit-level access to keys
for the PatriciaTrie.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intReturned bybitIndex(Object, Object)if a the bits of two keys were all equal.static final intReturned bybitIndex(Object, Object)if a key's bits were all zero (0).static final intReturned bybitIndex(Object, Object)if a keys indices are out of bounds. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the index of the first bit that is different in the two keys.booleanReturnstrueif a key's bit it set at the given index.booleanReturnstrueif the second argument is a prefix of the first argument.intlengthInBits(K key) Returns the key's length in bits.Methods inherited from interface java.util.Comparator
compare, equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
NULL_BIT_KEY
static final int NULL_BIT_KEYReturned bybitIndex(Object, Object)if a key's bits were all zero (0).- See Also:
-
EQUAL_BIT_KEY
static final int EQUAL_BIT_KEYReturned bybitIndex(Object, Object)if a the bits of two keys were all equal.- See Also:
-
OUT_OF_BOUNDS_BIT_KEY
static final int OUT_OF_BOUNDS_BIT_KEYReturned bybitIndex(Object, Object)if a keys indices are out of bounds.- See Also:
-
-
Method Details
-
lengthInBits
Returns the key's length in bits. -
isBitSet
Returnstrueif a key's bit it set at the given index. -
bitIndex
Returns the index of the first bit that is different in the two keys. -
isPrefix
Returnstrueif the second argument is a prefix of the first argument.
-