T
- the type of value to store for byte sequencesclass 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)
.bytes
- public void addPath(T value, byte[]... parts)
value
- parts
- public void setDefaultValue(T defaultValue)
find(byte[])
when no path matches.defaultValue
- public int getMaxDepth()