|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.swabunga.spell.engine.SpellDictionaryASpell
com.swabunga.spell.engine.SpellDictionaryDisk
public class SpellDictionaryDisk
An implementation of SpellDictionary
that doesn't cache any words in memory. Avoids the huge
footprint of SpellDictionaryHashMap
at the cost of relatively minor latency. A future version
of this class that implements some caching strategies might be a good idea in the future, if there's any
demand for it.
This class makes use of the "classic" Java IO library (java.io). However, it could probably benefit from
the new IO APIs (java.nio) and it is anticipated that a future version of this class, probably called
SpellDictionaryDiskNIO
will appear at some point.
Constructor Summary | |
---|---|
SpellDictionaryDisk(java.io.File base,
java.io.File phonetic,
boolean block)
NOTE: Do *not* create two instances of this class pointing to the same File unless
you are sure that a new dictionary does not have to be created. |
Method Summary | |
---|---|
void |
addWord(java.lang.String word)
Add a word permanently to the dictionary. |
java.util.List |
getWords(java.lang.String code)
Returns a list of words that have the same phonetic code. |
boolean |
isReady()
|
Methods inherited from class com.swabunga.spell.engine.SpellDictionaryASpell |
---|
getCode, getSuggestions, isCorrect |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SpellDictionaryDisk(java.io.File base, java.io.File phonetic, boolean block) throws java.io.FileNotFoundException, java.io.IOException
File
unless
you are sure that a new dictionary does not have to be created. In the future, some sort of
external locking mechanism may be created that handles this scenario gracefully.
base
- the base directory in which SpellDictionaryDisk
can expect to find
its necessary filesblock
- if a new word db needs to be created, there can be a considerable delay before
the constructor returns. If block is true, this method will block while the db is created
and return when done. If block is false, this method will create a thread to create the new
dictionary and return immediately.
java.io.FileNotFoundException
java.io.IOException
Method Detail |
---|
public void addWord(java.lang.String word)
SpellDictionary
public java.util.List getWords(java.lang.String code)
SpellDictionaryASpell
public boolean isReady()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |