net.sf.eos.trie
Class ByteArrayKeyAnalyzer
java.lang.Object
net.sf.eos.trie.ByteArrayKeyAnalyzer
- All Implemented Interfaces:
- Serializable, Comparator<byte[]>, PatriciaTrie.KeyAnalyzer<byte[]>
public class ByteArrayKeyAnalyzer
- extends Object
- implements PatriciaTrie.KeyAnalyzer<byte[]>
- See Also:
- Serialized Form
Method Summary |
int |
bitIndex(byte[] key,
int keyOff,
int keyLength,
byte[] found,
int foundOff,
int foundKeyLength)
Returns the n-th different bit between key and found. |
int |
bitsPerElement()
Returns the number of bits per element in the key. |
int |
compare(byte[] o1,
byte[] o2)
|
boolean |
isBitSet(byte[] key,
int keyLength,
int bitIndex)
Returns whether or not a bit is set |
boolean |
isPrefix(byte[] prefix,
int offset,
int length,
byte[] key)
Determines whether or not the given prefix (from offset to length)
is a prefix of the given key. |
int |
length(byte[] key)
Returns the length of the Key in bits. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ByteArrayKeyAnalyzer
public ByteArrayKeyAnalyzer()
bitsPerElement
public int bitsPerElement()
- Description copied from interface:
PatriciaTrie.KeyAnalyzer
- Returns the number of bits per element in the key.
This is only useful for variable-length keys, such as Strings.
- Specified by:
bitsPerElement
in interface PatriciaTrie.KeyAnalyzer<byte[]>
isBitSet
public boolean isBitSet(byte[] key,
int keyLength,
int bitIndex)
- Description copied from interface:
PatriciaTrie.KeyAnalyzer
- Returns whether or not a bit is set
- Specified by:
isBitSet
in interface PatriciaTrie.KeyAnalyzer<byte[]>
isPrefix
public boolean isPrefix(byte[] prefix,
int offset,
int length,
byte[] key)
- Description copied from interface:
PatriciaTrie.KeyAnalyzer
- Determines whether or not the given prefix (from offset to length)
is a prefix of the given key.
- Specified by:
isPrefix
in interface PatriciaTrie.KeyAnalyzer<byte[]>
length
public int length(byte[] key)
- Description copied from interface:
PatriciaTrie.KeyAnalyzer
- Returns the length of the Key in bits.
- Specified by:
length
in interface PatriciaTrie.KeyAnalyzer<byte[]>
compare
public int compare(byte[] o1,
byte[] o2)
- Specified by:
compare
in interface Comparator<byte[]>
bitIndex
public int bitIndex(byte[] key,
int keyOff,
int keyLength,
byte[] found,
int foundOff,
int foundKeyLength)
- Description copied from interface:
PatriciaTrie.KeyAnalyzer
- Returns the n-th different bit between key and found.
This starts the comparison in key at 'keyStart' and goes
for 'keyLength' bits, and compares to the found key
starting at 'foundStart' and going for 'foundLength' bits.
- Specified by:
bitIndex
in interface PatriciaTrie.KeyAnalyzer<byte[]>
Copyright © 2008. All Rights Reserved.