Added an asynchronous dictionary service, to perform word lookups

and other dictionary tasks as separate job units on the Invoker thread
(that's because we want to be as lazy as possible about loading 
dictionary files, but those can take a while :).



git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@184 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Robert Zubeck
2007-02-13 01:47:13 +00:00
parent 1de048c799
commit 7ab410dde4
2 changed files with 183 additions and 6 deletions
@@ -130,9 +130,8 @@ public class EZGameManager extends GameManager
InvocationService.ResultListener listener)
throws InvocationException
{
// TODO: real logic here :)
String letters = "A,B,C";
listener.requestProcessed(letters);
DictionaryService dictionary = getDictionaryService ();
dictionary.getLetterSet (locale, count, listener);
}
// from EZGameProvider
@@ -141,10 +140,24 @@ public class EZGameManager extends GameManager
InvocationService.ResultListener listener)
throws InvocationException
{
// TODO: real logic here :)
listener.requestProcessed (true);
DictionaryService dictionary = getDictionaryService ();
dictionary.checkWord (locale, word, listener);
}
/**
* Find the dictionary manager
*/
protected DictionaryService getDictionaryService ()
throws InvocationException
{
DictionaryService dictionary = DictionaryService.getInstance ();
if (dictionary == null) {
log.warning("DictionaryService not initialized.");
throw new InvocationException(INTERNAL_ERROR);
}
return dictionary;
}
// from EZGameProvider
public void addToCollection (
ClientObject caller, String collName, byte[][] data,