Package org.omegat.core.dictionaries
Class DictionaryData<T>
java.lang.Object
org.omegat.core.dictionaries.DictionaryData<T>
- Type Parameters:
T- The type of data stored
A class that encapsulates the storage and retrieval of string-keyed data.
Usage:
- Instantiate and insert data with
add(String, Object) - Call
done()when done adding data (required!) - Retrieve data with
lookUp(String)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInsert a key=value pair into the data store.voiddone()Finalize the data store.Look up the given word.lookUpPredictive(String word) Look up the given word using predictive completion; e.g.intsize()Get the number of stored keys.
-
Constructor Details
-
DictionaryData
- Parameters:
language- The dictionary's index language
-
-
Method Details
-
add
Insert a key=value pair into the data store. Unicode normalization is performed on the key. The value is stored both for the key and its lowercase version, if the latter differs.- Parameters:
key- The keyvalue- The value
-
done
public void done()Finalize the data store. This is required to be called before any lookups can be performed. -
lookUp
Look up the given word.- Parameters:
word- The word to look up- Returns:
- A list of stored objects matching the given word
- Throws:
IllegalStateException- Ifdone()has not yet been called
-
lookUpPredictive
Look up the given word using predictive completion; e.g. "term" will match "terminology" (and "terminal", etc.).- Parameters:
word- The word to look up- Returns:
- A list of stored objects matching the given word
- Throws:
IllegalStateException- Ifdone()has not yet been called
-
size
public int size()Get the number of stored keys. Returns-1ifdone()has not yet been called.- Returns:
- The number of stored keys
-