V - the entry typepublic class TreeTrie<V> extends AbstractTrie<V>
This implementation is always case insensitive and is optimal for a variable number of fixed strings with few special characters.
This Trie is stored in a Tree and is unlimited in capacity
This Trie is not Threadsafe and contains no mutual exclusion or deliberate memory barriers. It is intended for an TreeTrie to be built by a single thread and then used concurrently by multiple threads and not mutated during that access. If concurrent mutations of the Trie is required external locks need to be applied.
| Modifier and Type | Field and Description |
|---|---|
private static int[] |
__lookup |
private char |
_c |
private java.lang.String |
_key |
private TreeTrie<V>[] |
_nextIndex |
private java.util.List<TreeTrie<V>> |
_nextOther |
private V |
_value |
private static int |
INDEX |
_caseInsensitive| Modifier | Constructor and Description |
|---|---|
|
TreeTrie() |
private |
TreeTrie(char c) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
V |
get(java.nio.ByteBuffer b,
int offset,
int len)
Get an exact match from a segment of a ByteBuufer as key
|
V |
get(java.lang.String s,
int offset,
int len)
Get an exact match from a String key
|
V |
getBest(byte[] b,
int offset,
int len)
Get the best match from key in a byte array.
|
V |
getBest(java.nio.ByteBuffer b,
int offset,
int len)
Get the best match from key in a byte buffer.
|
V |
getBest(java.lang.String s,
int offset,
int len)
Get the best match from key in a String.
|
private V |
getBestByteBuffer(java.nio.ByteBuffer b,
int offset,
int len) |
boolean |
isFull() |
java.util.Set<java.lang.String> |
keySet() |
private static <V> void |
keySet(java.util.Set<java.lang.String> set,
TreeTrie<V> t) |
boolean |
put(java.lang.String s,
V v)
Put an entry into the Trie
|
java.lang.String |
toString() |
private static <V> void |
toString(java.lang.Appendable out,
TreeTrie<V> t) |
get, get, getBest, isCaseInsensitive, put, removeprivate static final int[] __lookup
private static final int INDEX
private final char _c
private java.lang.String _key
private V _value
public void clear()
public boolean put(java.lang.String s,
V v)
Tries - The key for the entryv - The value of the entrypublic V get(java.lang.String s, int offset, int len)
Tries - The keyoffset - The offset within the string of the keylen - the length of the keypublic V get(java.nio.ByteBuffer b, int offset, int len)
Trieb - The bufferoffset - The offset within the buffer of the keylen - the length of the keypublic V getBest(byte[] b, int offset, int len)
Triepublic V getBest(java.lang.String s, int offset, int len)
Tries - The stringoffset - The offset within the string of the keylen - the length of the keypublic V getBest(java.nio.ByteBuffer b, int offset, int len)
Trieb - The bufferoffset - The offset within the buffer of the keylen - the length of the keyprivate V getBestByteBuffer(java.nio.ByteBuffer b, int offset, int len)
public java.lang.String toString()
toString in class java.lang.Objectprivate static <V> void toString(java.lang.Appendable out,
TreeTrie<V> t)
public java.util.Set<java.lang.String> keySet()
private static <V> void keySet(java.util.Set<java.lang.String> set,
TreeTrie<V> t)
public boolean isFull()