V
- public class ArrayTernaryTrie<V> extends AbstractTrie<V>
The Trie is stored in 3 arrays:
The lookup of a value will iterate through the _tree array matching characters. If the equal tree branch is followed, then the _key array is looked up to see if this is a complete match. If a match is found then the _value array is looked up to return the matching value.
Constructor and Description |
---|
ArrayTernaryTrie() |
ArrayTernaryTrie(ArrayTernaryTrie<V> trie,
double factor)
Copy Trie and change capacity by a factor
|
ArrayTernaryTrie(boolean insensitive) |
ArrayTernaryTrie(boolean insensitive,
int capacityInNodes) |
ArrayTernaryTrie(int capacityInNodes) |
Modifier and Type | Method and Description |
---|---|
void |
dump() |
V |
get(ByteBuffer b,
int offset,
int len)
Get and exact match from a segment of a ByteBuufer as key
|
V |
get(String s,
int offset,
int len)
Get and exact match from a String key
|
V |
getBest(ByteBuffer b,
int offset,
int len)
Get the best match from key in a byte buffer.
|
V |
getBest(String s)
Get the best match from key in a String.
|
V |
getBest(String s,
int offset,
int length)
Get the best match from key in a String.
|
static int |
hilo(int diff) |
boolean |
isFull() |
Set<String> |
keySet() |
boolean |
put(String s,
V v)
Put and entry into the Trie
|
String |
toString() |
get, get, getBest, isCaseInsensitive, put, remove
public ArrayTernaryTrie()
public ArrayTernaryTrie(boolean insensitive)
public ArrayTernaryTrie(int capacityInNodes)
public ArrayTernaryTrie(boolean insensitive, int capacityInNodes)
public ArrayTernaryTrie(ArrayTernaryTrie<V> trie, double factor)
trie
- factor
- public boolean put(String s, V v)
Trie
s
- The key for the entryv
- The value of the entrypublic V get(String s, int offset, int len)
Trie
s
- The keyoffset
- The offset within the string of the keylen
- the length of the keypublic V get(ByteBuffer b, int offset, int len)
Trie
b
- The bufferoffset
- The offset within the buffer of the keylen
- the length of the keypublic V getBest(String s)
Trie
public V getBest(String s, int offset, int length)
Trie
s
- The stringoffset
- The offset within the string of the keylength
- the length of the keypublic V getBest(ByteBuffer b, int offset, int len)
Trie
b
- The bufferoffset
- The offset within the buffer of the keylen
- the length of the keypublic boolean isFull()
public static int hilo(int diff)
public void dump()
Copyright © 1995-2014 Mort Bay Consulting. All Rights Reserved.