|
GWT 2.7.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection<java.lang.String> com.google.gwt.user.client.ui.PrefixTree
class PrefixTree
A prefix tree (aka trie).
Field Summary | |
---|---|
protected int |
prefixLength
Stores the requested prefix length. |
protected int |
size
Store the number of elements contained by this PrefixTree and its sub-trees. |
protected JavaScriptObject |
subtrees
Field to store subtrees in. |
protected JavaScriptObject |
suffixes
Field to store terminal nodes in. |
Constructor Summary | |
---|---|
PrefixTree()
Constructor. |
|
PrefixTree(java.util.Collection<java.lang.String> source)
Constructor. |
|
PrefixTree(int prefixLength)
Constructor. |
|
PrefixTree(int prefixLength,
java.util.Collection<java.lang.String> source)
Constructor. |
Method Summary | |
---|---|
boolean |
add(java.lang.String s)
Add a String to the PrefixTree. |
void |
clear()
Initialize native state. |
boolean |
contains(java.lang.Object o)
|
boolean |
contains(java.lang.String s)
|
protected static PrefixTree |
createPrefixTree(int prefixLength)
Used by native methods to create an appropriately blessed PrefixTree. |
java.util.List<java.lang.String> |
getSuggestions(java.lang.String search,
int limit)
Retrieve suggestions from the PrefixTree. |
java.util.Iterator<java.lang.String> |
iterator()
|
int |
size()
Get the number of all elements contained within the PrefixTree. |
protected void |
suggestImpl(java.lang.String search,
java.lang.String prefix,
java.util.Collection<java.lang.String> output,
int limit)
|
Methods inherited from class java.util.AbstractCollection |
---|
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
equals, hashCode |
Field Detail |
---|
protected final int prefixLength
protected JavaScriptObject suffixes
protected JavaScriptObject subtrees
protected int size
Constructor Detail |
---|
public PrefixTree()
public PrefixTree(java.util.Collection<java.lang.String> source)
source
- Initialize from another collectionpublic PrefixTree(int prefixLength)
prefixLength
- Smaller prefix length equals faster, more direct
searches, at a cost of setup time.public PrefixTree(int prefixLength, java.util.Collection<java.lang.String> source)
prefixLength
- Smaller prefix length equals faster, more direct
searches, at a cost of setup time.source
- Initialize from another collectionMethod Detail |
---|
protected static PrefixTree createPrefixTree(int prefixLength)
prefixLength
- Smaller prefix length equals faster, more direct
searches, at a cost of setup time
public boolean add(java.lang.String s)
add
in interface java.util.Collection<java.lang.String>
add
in class java.util.AbstractCollection<java.lang.String>
s
- The data to add
true
if the string was added, false
otherwisepublic void clear()
clear
in interface java.util.Collection<java.lang.String>
clear
in class java.util.AbstractCollection<java.lang.String>
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection<java.lang.String>
contains
in class java.util.AbstractCollection<java.lang.String>
public boolean contains(java.lang.String s)
public java.util.List<java.lang.String> getSuggestions(java.lang.String search, int limit)
limit
so that all
suffixes and partial stems will be returned. This prevents the search space
from changing size if the PrefixTree is used in an interactive manner.
search
- The prefix to search forlimit
- The desired number of results to retrieve
public java.util.Iterator<java.lang.String> iterator()
iterator
in interface java.lang.Iterable<java.lang.String>
iterator
in interface java.util.Collection<java.lang.String>
iterator
in class java.util.AbstractCollection<java.lang.String>
public int size()
size
in interface java.util.Collection<java.lang.String>
size
in class java.util.AbstractCollection<java.lang.String>
protected void suggestImpl(java.lang.String search, java.lang.String prefix, java.util.Collection<java.lang.String> output, int limit)
|
GWT 2.7.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |