com.paragon.open.dictionary.api
Class OpenDictionaryAPI

java.lang.Object
  extended by com.paragon.open.dictionary.api.OpenDictionaryAPI

public final class OpenDictionaryAPI
extends java.lang.Object

Main class for working with the Open Dictionary API.

Provides access to the installed dictionaries for translation of words.
Also provides access to the installed morphology modules for getting base forms of words.

Author:
Sergey Solomatin (Sergey_Solomatin@penreader.com)
See Also:
Dictionary, Morphology

Field Summary
static java.lang.String VENDOR
          Vendor of the Open Dictionary API.
static int VERSION_CODE
          Version code of the Open Dictionary API.
static java.lang.String VERSION_NAME
          Version name of the Open Dictionary API.
 
Constructor Summary
OpenDictionaryAPI(android.content.Context ctx)
          Constructor for an OpenDictionaryAPI object.
 
Method Summary
 java.util.HashSet<Dictionary> getDictionaries()
          Get a set of all installed dictionaries.
 java.util.HashSet<Dictionary> getDictionaries(Direction dir)
          Get a set of installed dictionaries for a specific direction.
 java.util.HashSet<Morphology> getMorphologies()
          Get a set of all installed morphology modules.
 Morphology getMorphology(Language lang)
          Get a morphology module for the specific language.
 boolean hasDictionary(Direction dir)
          Checks if there is at least one dictionary installed that provides translations for a specific direction.
 boolean hasMorphology(Language lang)
          Checks if a morphology module is installed for the specific language.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VENDOR

public static final java.lang.String VENDOR
Vendor of the Open Dictionary API.

See Also:
Constant Field Values

VERSION_CODE

public static final int VERSION_CODE
Version code of the Open Dictionary API.

See Also:
Constant Field Values

VERSION_NAME

public static final java.lang.String VERSION_NAME
Version name of the Open Dictionary API.

See Also:
Constant Field Values
Constructor Detail

OpenDictionaryAPI

public OpenDictionaryAPI(android.content.Context ctx)
Constructor for an OpenDictionaryAPI object.

Parameters:
ctx - android application context
Method Detail

hasMorphology

public boolean hasMorphology(Language lang)
Checks if a morphology module is installed for the specific language.

Parameters:
lang - language
Returns:
true if a morphology module is installed for a specific language
Throws:
java.lang.IllegalArgumentException

getMorphologies

public java.util.HashSet<Morphology> getMorphologies()
Get a set of all installed morphology modules.

Returns:
set of the all installed morphology modules or empty set if not found

getMorphology

public Morphology getMorphology(Language lang)
Get a morphology module for the specific language.

Parameters:
lang - language
Returns:
morphology module or null if not found
Throws:
java.lang.IllegalArgumentException

hasDictionary

public boolean hasDictionary(Direction dir)
Checks if there is at least one dictionary installed that provides translations for a specific direction.

Parameters:
dir - direction
Returns:
true if there is at least one dictionary installed for a specific direction
Throws:
java.lang.IllegalArgumentException

getDictionaries

public java.util.HashSet<Dictionary> getDictionaries()
Get a set of all installed dictionaries.

Returns:
set of the all installed dictionaries or empty set if not found
Throws:
java.lang.IllegalArgumentException

getDictionaries

public java.util.HashSet<Dictionary> getDictionaries(Direction dir)
Get a set of installed dictionaries for a specific direction.

Parameters:
dir - direction
Returns:
set of the installed dictionaries for a specific direction or empty set if not found
Throws:
java.lang.IllegalArgumentException