com.jspell.domain
Class JSpellDictionaryManager

java.lang.Object
  extended by com.jspell.domain.JSpellDictionaryManager

public class JSpellDictionaryManager
extends java.lang.Object

This class manages a collection of dictionaries for use by JSpell. This class is implemented as a singleton, meaning only one instance of this class may exist per virtual machine. To construct an instance of this class you must supply a parameter specifying the location of the JSpell dictionaries. JSpell dictionaries are identified by the extension .jdx. Dictionaries that are compatible with JSpell Pro start with lex_.

Author:
clifford_admin

Method Summary
 java.util.HashMap getBlockList()
          A HashMap containing words to filter or replace.
 java.lang.String getDictionaryDirectory()
          Returns the directory where the JSpell dictionary files are located.
 JSpellDictionaryLocal getJSpellDictionaryLocal(java.lang.String description)
          Retrieve a JSpellDictionaryLocal object from the manager using the description containing the language and country code to determine which dictionary object to return.
 JSpellDictionaryLocal getJSpellDictionaryLocal(java.lang.String language, java.lang.String country, java.lang.String version)
          Retrieve a JSpellDictionaryLocal object from the manager using the language and country to determine which dictionary object to return.
static JSpellDictionaryManager getJSpellDictionaryManager()
          Returns an instance of the JSpellDictionaryManager object.
 java.util.Vector getLanguages()
          Returns a Vector containing String descriptions of the languages and country codes that this JSpellDictionaryManager is managing.
 boolean isForceUpperCase()
          Getter for property forceUpperCase.
 boolean isIgnoreDoubleWords()
          Getter for property ignoreDoubleWords.
 boolean isIgnoreFirstCaps()
          Getter for property ignoreFirstCaps.
 boolean isIgnoreIrregularCaps()
          Getter for property ignoreIrregularCaps.
 boolean isIgnoreUpper()
          Getter for property ignoreUpper.
 boolean isIgnoreWordsWithNumbers()
          Getter for property ignoreWordsWithNumbers.
 boolean setDictionaryDirectory(java.lang.String dictionaryDirectory)
          Setter for property dictionaryDirectory.
 void setForceUpperCase(boolean forceUpperCase)
          Setter for property forceUpperCase.
 void setIgnoreDoubleWords(boolean ignoreDoubleWords)
          Setter for property ignoreDoubleWords.
 void setIgnoreFirstCaps(boolean ignoreFirstCaps)
          Setter for property ignoreFirstCaps.
 void setIgnoreIrregularCaps(boolean ignoreIrregularCaps)
          Setter for property ignoreIrregularCaps.
 void setIgnoreUpper(boolean ignoreUpper)
          Setter for property ignoreUpper.
 void setIgnoreWordsWithNumbers(boolean ignoreWordsWithNumbers)
          Setter for property ignoreWordsWithNumbers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getJSpellDictionaryManager

public static JSpellDictionaryManager getJSpellDictionaryManager()
Returns an instance of the JSpellDictionaryManager object. This class is implemented as a singleton. Multiple calls to this method will return the same object.

Returns:
a JSpellDictionaryManager object.

getJSpellDictionaryLocal

public JSpellDictionaryLocal getJSpellDictionaryLocal(java.lang.String language,
                                                      java.lang.String country,
                                                      java.lang.String version)
Retrieve a JSpellDictionaryLocal object from the manager using the language and country to determine which dictionary object to return.

Parameters:
language - ISO language code.
country - ISO country code.
Returns:
a JSpellDictionaryLocal object.

getJSpellDictionaryLocal

public JSpellDictionaryLocal getJSpellDictionaryLocal(java.lang.String description)
Retrieve a JSpellDictionaryLocal object from the manager using the description containing the language and country code to determine which dictionary object to return.

Parameters:
description - a String description of the dictionary, e.g., "English (US)" or "Spanish (ES)"
Returns:
a JSpellDictionaryLocal object.

getLanguages

public java.util.Vector getLanguages()
Returns a Vector containing String descriptions of the languages and country codes that this JSpellDictionaryManager is managing. These descriptions may be passed to the getJSpellDictionaryLocal method to retrieve a specific dictionary object for a given language and country.

Returns:
a Vector of String language and country descriptions.

getDictionaryDirectory

public java.lang.String getDictionaryDirectory()
Returns the directory where the JSpell dictionary files are located.

Returns:
a String containing a path to a directory.

setDictionaryDirectory

public boolean setDictionaryDirectory(java.lang.String dictionaryDirectory)
Setter for property dictionaryDirectory. Looks in specified directory for JSpell dictionaries and makes them available via the JSpellDictionaryManager. Once the dictionaries are loaded, call getJSpellDictionaryLocal with the language and country code to obtain a dictionary. You may place a file called 'lexicon.lst' into the directory containing JSpell dictionaries in order to specify which lexicons to use, as well as to specify the order in which they should appear in GUI elements that use the JSpellDictionaryManager.getLanguages method. Logging information is written using Messages.delayLog for consumption after calling setDictionaryDirectory.

Parameters:
dictionaryDirectory - New value of property dictionaryDirectory.
Returns:
Returns true or false if the dictionary directory was set with a valid directory.

getBlockList

public java.util.HashMap getBlockList()
A HashMap containing words to filter or replace. This HashMap is populated by making entries into the block.lst file which is contained within the same directory as the JSpell dictionary files.

Returns:
a HashMap with original words as keys and replacement words as values.

isForceUpperCase

public boolean isForceUpperCase()
Getter for property forceUpperCase.

Returns:
Value of property forceUpperCase.

setForceUpperCase

public void setForceUpperCase(boolean forceUpperCase)
Setter for property forceUpperCase. Propagates the setting to all the dictionaries managed by the JSpellDictionaryManager.

Parameters:
forceUpperCase - New value of property forceUpperCase.

isIgnoreDoubleWords

public boolean isIgnoreDoubleWords()
Getter for property ignoreDoubleWords.

Returns:
Value of property ignoreDoubleWords.

setIgnoreDoubleWords

public void setIgnoreDoubleWords(boolean ignoreDoubleWords)
Setter for property ignoreDoubleWords. Propagates the setting to all the dictionaries managed by the JSpellDictionaryManager.

Parameters:
ignoreDoubleWords - New value of property ignoreDoubleWords.

isIgnoreFirstCaps

public boolean isIgnoreFirstCaps()
Getter for property ignoreFirstCaps.

Returns:
Value of property ignoreFirstCaps.

setIgnoreFirstCaps

public void setIgnoreFirstCaps(boolean ignoreFirstCaps)
Setter for property ignoreFirstCaps. Propagates the setting to all the dictionaries managed by the JSpellDictionaryManager.

Parameters:
ignoreFirstCaps - New value of property ignoreFirstCaps.

isIgnoreIrregularCaps

public boolean isIgnoreIrregularCaps()
Getter for property ignoreIrregularCaps.

Returns:
Value of property ignoreIrregularCaps.

setIgnoreIrregularCaps

public void setIgnoreIrregularCaps(boolean ignoreIrregularCaps)
Setter for property ignoreIrregularCaps. Propagates the setting to all the dictionaries managed by the JSpellDictionaryManager.

Parameters:
ignoreIrregularCaps - New value of property ignoreIrregularCaps.

isIgnoreUpper

public boolean isIgnoreUpper()
Getter for property ignoreUpper.

Returns:
Value of property ignoreUpper.

setIgnoreUpper

public void setIgnoreUpper(boolean ignoreUpper)
Setter for property ignoreUpper. Propagates the setting to all the dictionaries managed by the JSpellDictionaryManager.

Parameters:
ignoreUpper - New value of property ignoreUpper.

isIgnoreWordsWithNumbers

public boolean isIgnoreWordsWithNumbers()
Getter for property ignoreWordsWithNumbers.

Returns:
Value of property ignoreWordsWithNumbers.

setIgnoreWordsWithNumbers

public void setIgnoreWordsWithNumbers(boolean ignoreWordsWithNumbers)
Setter for property ignoreWordsWithNumbers. Propagates the setting to all the dictionaries managed by the JSpellDictionaryManager.

Parameters:
ignoreWordsWithNumbers - New value of property ignoreWordsWithNumbers.


JSpell SDK - Spell Checker for the Java ™ Platform
Copyright © 2009 Page Scholar Inc, All Rights Reserved - http://www.jspell.com