Trie keys on a bit level.
KeyAnalyzer's methods return the length of the key in bits, whether or not a bit is set,
and bits per element in the key.
Additionally, a method determines if a key is a prefix of another
key and returns the bit index where one key is different from another
key (if the key and found key are equal than the return value is
EQUAL_BIT_KEY).
| Modifier and Type | Field and Description |
|---|---|
| public static final int | EQUAL_BIT_KEY
Returned by |
| public static final int | NULL_BIT_KEY
Returned by |
| public static final int | |
| private static final long | serialVersionUID
Serialization version |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public abstract int | Returns: the bit index where the key and other first differthe key to use key, int the bit offset in the key offsetInBits, int the maximum key length in bits to use lengthInBits, K the other key to use other, int the bit offset in the other key otherOffsetInBits, int the maximum key length in bits for the other key otherLengthInBits)Returns the n-th different bit between key and other. |
| public abstract int | Returns: the number of bits per elementReturns the number of bits per element in the key. |
| public int | compare(final K
the first object to be compared. o1, final K the second object to be compared. o2)Implements java. |
| public abstract boolean | Returns: true if the bit is set in the given key and
bitIndex < lengthInBits, false otherwise.the key to check, may not be null key, int the bit index to check bitIndex, int the maximum key length in bits to check lengthInBits)Returns whether or not a bit is set. |
| pack-priv static boolean | |
| pack-priv static boolean | |
| pack-priv static boolean | isOutOfBoundsIndex(final int bitIndex)
Returns true if bitIndex is a |
| public abstract boolean | Returns: true if this is a valid prefix for the given keythe prefix to check prefix, int the bit offset in the key offsetInBits, int the maximum key length in bits to use lengthInBits, K the key to check key)Determines whether or not the given prefix (from offset to length) is a prefix of the given key. |
| pack-priv static boolean | |
| public abstract int |
| EQUAL_BIT_KEY | back to summary |
|---|---|
| public static final int EQUAL_BIT_KEY Returned by | |
| NULL_BIT_KEY | back to summary |
|---|---|
| public static final int NULL_BIT_KEY Returned by | |
| OUT_OF_BOUNDS_BIT_KEY | back to summary |
|---|---|
| public static final int OUT_OF_BOUNDS_BIT_KEY | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serialization version | |
| KeyAnalyzer | back to summary |
|---|---|
| public KeyAnalyzer() | |
| bitIndex | back to summary |
|---|---|
| public abstract int bitIndex(K key, int offsetInBits, int lengthInBits, K other, int otherOffsetInBits, int otherLengthInBits) Returns the n-th different bit between key and other. This starts the comparison in key at 'offsetInBits' and goes for 'lengthInBits' bits, and compares to the other key starting at 'otherOffsetInBits' and going for 'otherLengthInBits' bits.
| |
| bitsPerElement | back to summary |
|---|---|
| public abstract int bitsPerElement() Returns the number of bits per element in the key. This is only useful for variable-length keys, such as Strings.
| |
| compare | back to summary |
|---|---|
| public int compare(final K o1, final K o2) Implements java. Doc from java. Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
The implementor must ensure that
The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |
| isBitSet | back to summary |
|---|---|
| public abstract boolean isBitSet(K key, int bitIndex, int lengthInBits) Returns whether or not a bit is set.
| |
| isEqualBitKey | back to summary |
|---|---|
| pack-priv static boolean isEqualBitKey(final int bitIndex) Returns true if bitIndex is a | |
| isNullBitKey | back to summary |
|---|---|
| pack-priv static boolean isNullBitKey(final int bitIndex) Returns true if bitIndex is a | |
| isOutOfBoundsIndex | back to summary |
|---|---|
| pack-priv static boolean isOutOfBoundsIndex(final int bitIndex) Returns true if bitIndex is a | |
| isPrefix | back to summary |
|---|---|
| public abstract boolean isPrefix(K prefix, int offsetInBits, int lengthInBits, K key) Determines whether or not the given prefix (from offset to length) is a prefix of the given key.
| |
| isValidBitIndex | back to summary |
|---|---|
| pack-priv static boolean isValidBitIndex(final int bitIndex) Returns true if the given bitIndex is valid.
Indices are considered valid if they're between 0 and | |
| lengthInBits | back to summary |
|---|---|
| public abstract int lengthInBits(K key) Returns the length of the Key in bits.
| |