T
- the type of value to store for byte sequencespublic class ByteTrie<T>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ByteTrie.ByteTrieNode<T>
A node in the trie.
|
Modifier and Type | Field and Description |
---|---|
private int |
_maxDepth |
private ByteTrie.ByteTrieNode<T> |
_root |
Constructor and Description |
---|
ByteTrie() |
Modifier and Type | Method and Description |
---|---|
void |
addPath(T value,
byte[]... parts)
Store the given value at the specified path.
|
T |
find(byte[] bytes)
Return the most specific value stored for this byte sequence.
|
int |
getMaxDepth()
Gets the maximum depth stored in this trie.
|
void |
setDefaultValue(T defaultValue)
Sets the default value to use in
find(byte[]) when no path matches. |
private final ByteTrie.ByteTrieNode<T> _root
private int _maxDepth
public T find(byte[] bytes)
null
or a default values as specified by
calling setDefaultValue(T)
.public void addPath(T value, byte[]... parts)
public void setDefaultValue(T defaultValue)
find(byte[])
when no path matches.public int getMaxDepth()