Class ArrayTrie<V>
- Type Parameters:
V
- the entry type
- All Implemented Interfaces:
Trie<V>
A Trie String lookup data structure using a fixed size array.
This implementation is always case insensitive and is optimal for a small number of fixed strings with few special characters. The Trie is stored in an array of lookup tables, each indexed by the next character of the key. Frequently used characters are directly indexed in each lookup table, whilst infrequently used characters must use a big character table.
This Trie is very space efficient if the key characters are from ' ', '+', '-', ':', ';', '.', 'A' to 'Z' or 'a' to 'z'. Other ISO-8859-1 characters can be used by the key, but less space efficiently.
This Trie is not Threadsafe and contains no mutual exclusion or deliberate memory barriers. It is intended for an ArrayTrie 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.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Deprecated.Deprecated.Get an exact match from a String keyget
(ByteBuffer b, int offset, int len) Deprecated.Get an exact match from a segment of a ByteBuufer as keygetBest
(byte[] b, int offset, int len) Deprecated.Get the best match from key in a byte array.Deprecated.Get the best match from key in a String.getBest
(ByteBuffer b, int offset, int len) Deprecated.Get the best match from key in a byte buffer.boolean
isFull()
Deprecated.keySet()
Deprecated.boolean
Deprecated.Put an entry into the TrietoString()
Deprecated.Methods inherited from class org.eclipse.jetty.util.AbstractTrie
get, get, getBest, isCaseInsensitive, put, remove
-
Constructor Details
-
ArrayTrie
public ArrayTrie()Deprecated. -
ArrayTrie
public ArrayTrie(int capacity) Deprecated.- Parameters:
capacity
- The capacity of the trie, which at the worst case is the total number of characters of all keys stored in the Trie. The capacity needed is dependent of the shared prefixes of the keys. For example, a capacity of 6 nodes is required to store keys "foo" and "bar", but a capacity of only 4 is required to store "bar" and "bat".
-
-
Method Details
-
clear
public void clear()Deprecated. -
put
Deprecated.Description copied from interface:Trie
Put an entry into the Trie- Parameters:
s
- The key for the entryv
- The value of the entry- Returns:
- True if the Trie had capacity to add the field.
-
get
Deprecated.Description copied from interface:Trie
Get an exact match from a String key- Parameters:
s
- The keyoffset
- The offset within the string of the keylen
- the length of the key- Returns:
- the value for the string / offset / length
-
get
Deprecated.Description copied from interface:Trie
Get an exact match from a segment of a ByteBuufer as key- Parameters:
b
- The bufferoffset
- The offset within the buffer of the keylen
- the length of the key- Returns:
- The value or null if not found
-
getBest
Deprecated.Description copied from interface:Trie
Get the best match from key in a byte array. The key is assumed to by ISO_8859_1 characters. -
getBest
Deprecated.Description copied from interface:Trie
Get the best match from key in a byte buffer. The key is assumed to by ISO_8859_1 characters.- Parameters:
b
- The bufferoffset
- The offset within the buffer of the keylen
- the length of the key- Returns:
- The value or null if not found
-
getBest
Deprecated.Description copied from interface:Trie
Get the best match from key in a String.- Parameters:
s
- The stringoffset
- The offset within the string of the keylen
- the length of the key- Returns:
- The value or null if not found
-
toString
Deprecated. -
keySet
Deprecated. -
isFull
public boolean isFull()Deprecated.
-