LimeWire Collection Component API

org.limewire.collection
Interface AutoCompleteDictionary

All Superinterfaces:
Iterable<String>
All Known Implementing Classes:
StringTrieSet

public interface AutoCompleteDictionary
extends Iterable<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.

Author:
Matt Welsh (matt@matt-welsh.com)

Method Summary
 void addEntry(String s)
          Adds an entry to the dictionary.
 void clear()
          Clears the dictionary.
 Iterator<String> iterator()
          Returns all available entries in dictionary
 Iterator<String> iterator(String s)
          Returns an iterator of potential matches from the given string.
 String lookup(String s)
          Perform a lookup and returns the closest matching string to the passed string.
 boolean removeEntry(String s)
          Removes an entry from the dictionary.
 

Method Detail

addEntry

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

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

removeEntry

boolean removeEntry(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

String lookup(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.

iterator

Iterator<String> iterator()
Returns all available entries in dictionary

Specified by:
iterator in interface Iterable<String>

iterator

Iterator<String> iterator(String s)
Returns an iterator of potential matches from the given string.


clear

void clear()
Clears the dictionary.


LimeWire Collection Component API

Copyright © 2008 Lime Wire LLC. All Rights Reserved.