LimeWire collection component api

org.limewire.collection
Interface AutoCompleteDictionary

All Superinterfaces:
java.lang.Iterable<java.lang.String>
All Known Implementing Classes:
StringTrieSet

public interface AutoCompleteDictionary
extends java.lang.Iterable<java.lang.String>

Defines the interface for an auto-complete dictionary. Implementations should perform look ups quickly to avoid delays as the user types. The interface includes adding, removing and clearing entries from the dictionary. Additionally, AutoCompleteDictionary provides a search and way to iterate through the dictionary entries.


Method Summary
 void addEntry(java.lang.String s)
          Adds an entry to the dictionary.
 void clear()
          Clears the dictionary.
 java.util.Collection<java.lang.String> getPrefixedBy(java.lang.String s)
          Returns an iterator of potential matches from the given string.
 boolean isImmediate()
          Returns true if the dictionary can immediately return results.
 java.lang.String lookup(java.lang.String s)
          Perform a lookup and returns the closest matching string to the passed string.
 boolean removeEntry(java.lang.String s)
          Removes an entry from the dictionary.
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

isImmediate

boolean isImmediate()
Returns true if the dictionary can immediately return results. False if it will block for any reason.


addEntry

void addEntry(java.lang.String s)
Adds an entry to the dictionary.

Parameters:
s - The string to add to the dictionary.

removeEntry

boolean removeEntry(java.lang.String s)
Removes an entry from the dictionary.

Parameters:
s - The string to remove to the dictionary.
Returns:
True if successful, false if the string is not contained or cannot be removed.

lookup

java.lang.String lookup(java.lang.String s)
Perform a lookup and returns the closest matching string to the passed string.

Parameters:
s - The string to use as the base for the lookup. How this routine is implemented determines the behaviour of the component. Typically, the closest matching string that completely contains the given string is returned.

getPrefixedBy

java.util.Collection<java.lang.String> getPrefixedBy(java.lang.String s)
                                                     throws java.lang.InterruptedException
Returns an iterator of potential matches from the given string.

Throws:
java.lang.InterruptedException

clear

void clear()
Clears the dictionary.


LimeWire collection component api

Copyright © 2009 Lime Wire LLC. All Rights Reserved.