public class RadixTreeImpl<T> extends Object implements RadixTree<T>, Formattable
RadixTree| Modifier and Type | Field and Description |
|---|---|
protected ds.tree.RadixTreeNode<T> |
root |
protected long |
size |
| Constructor and Description |
|---|
RadixTreeImpl()
Create a Radix Tree with only the default node root.
|
| Modifier and Type | Method and Description |
|---|---|
String |
complete(String prefix)
Complete the a prefix to the point where ambiguity starts.
|
boolean |
contains(String key)
Check if the tree contains any entry corresponding to the given key.
|
boolean |
delete(String key)
Delete a key and its associated value from the tree.
|
void |
display()
Deprecated.
|
T |
find(String key)
Find a value based on its corresponding key.
|
void |
formatTo(Formatter formatter,
int flags,
int width,
int precision)
Writes a textual representation of this tree to the given formatter.
|
long |
getSize()
Return the size of the Radix tree
|
void |
insert(String key,
T value)
Insert a new string key and its value to the tree.
|
ArrayList<T> |
searchPrefix(String key,
int recordLimit)
Search for all the keys that start with given prefix.
|
<R> void |
visit(String key,
Visitor<T,R> visitor)
visit the node those key matches the given key
|
protected ds.tree.RadixTreeNode<T> root
protected long size
public RadixTreeImpl()
public T find(String key)
RadixTreepublic boolean delete(String key)
RadixTreepublic void insert(String key, T value) throws DuplicateKeyException
RadixTreeinsert in interface RadixTree<T>key - The string key of the objectvalue - The value that need to be stored corresponding to the given
key.DuplicateKeyExceptionpublic ArrayList<T> searchPrefix(String key, int recordLimit)
RadixTreesearchPrefix in interface RadixTree<T>key - The prefix for which keys need to be searchrecordLimit - The limit for the resultspublic boolean contains(String key)
RadixTreepublic <R> void visit(String key, Visitor<T,R> visitor)
key - The key that need to be visitedvisitor - The visitor objectpublic long getSize()
RadixTree@Deprecated public void display()
formatTopublic void formatTo(Formatter formatter, int flags, int width, int precision)
formatTo in interface FormattableCopyright © 2015 Bluebrain Project. All rights reserved.