public abstract class OnlineDictionary
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,?>> |
alternativeDefinitions
Stores the alternative definitions
|
protected int |
timeout
Maximum allowed length for the call in milliseconds
|
Constructor and Description |
---|
OnlineDictionary()
Create a new instance of OnlineDictionary.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
convertCode(java.lang.String languageCode,
boolean threeChar)
Convert the language code into the required word for querying.
|
protected java.util.HashMap<java.lang.String,?> |
getReplyHash(java.lang.String alternativeDescription)
Get the reply hashtable relating to the alternative description that is passed in.
|
boolean |
isDefaultLanguage(java.lang.String languageCode)
Return true if the language code is the default one for the dictionary.
|
abstract java.util.HashMap<java.lang.String,?> |
queryDictionary(java.util.ArrayList<java.lang.String[]> parameters)
Query the dictionary using a single http GET request.
|
abstract java.util.HashMap<java.lang.String,?> |
queryDictionary(java.util.ArrayList<java.lang.String[]> parameters,
java.lang.String language)
Query the dictionary using a single http GET request.
|
abstract java.util.HashMap<java.lang.String,?> |
requeryDictionary(java.lang.String whichMeaning,
java.util.ArrayList<java.lang.String[]> parameters)
Re-query the dictionary using a single http GET request.
|
java.util.HashMap<java.lang.String,?> |
requeryDictionary(java.lang.String whichMeaning,
java.util.ArrayList<java.lang.String[]> parameters,
java.lang.String language)
Re-query the dictionary using a single http GET request.
|
protected int timeout
protected java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,?>> alternativeDefinitions
public OnlineDictionary()
public abstract java.util.HashMap<java.lang.String,?> queryDictionary(java.util.ArrayList<java.lang.String[]> parameters) throws java.lang.Exception
parameters
- the parameter list of type String[2] (name, value).java.lang.Exception
- any error.public abstract java.util.HashMap<java.lang.String,?> queryDictionary(java.util.ArrayList<java.lang.String[]> parameters, java.lang.String language) throws java.lang.Exception
parameters
- the parameter list of type String[2] (name, value).language
- the code for the language the query should be in.java.lang.Exception
- any error.public abstract java.util.HashMap<java.lang.String,?> requeryDictionary(java.lang.String whichMeaning, java.util.ArrayList<java.lang.String[]> parameters) throws java.lang.Exception
whichMeaning
- which meaning to query if alternatives are possible.parameters
- the parameter list of type String[2] (name, value).java.lang.Exception
- any error.public java.util.HashMap<java.lang.String,?> requeryDictionary(java.lang.String whichMeaning, java.util.ArrayList<java.lang.String[]> parameters, java.lang.String language)
whichMeaning
- which meaning to query if alternatives are possible.parameters
- the parameter list of type String[2] (name, value).language
- the code for the language the query should be in.protected java.util.HashMap<java.lang.String,?> getReplyHash(java.lang.String alternativeDescription)
alternativeDescription
- the intended meaning when there is more than one.public boolean isDefaultLanguage(java.lang.String languageCode)
languageCode
- the code for the specified language.protected java.lang.String convertCode(java.lang.String languageCode, boolean threeChar)
languageCode
- the code to convertthreeChar
- true if return the three char version.