diff options
author | 2014-02-04 21:36:04 +0900 | |
---|---|---|
committer | 2014-02-04 21:36:04 +0900 | |
commit | b986f78ba826fa360304a69565f1880bdd7ce0c5 (patch) | |
tree | 5d19c033ee15e575a78a51f8c092b3877632e664 /java/src/com/android/inputmethod/latin/makedict/FormatSpec.java | |
parent | 36c7a62dffb7f5b6728fa0850c1f63aee0f14d80 (diff) | |
download | latinime-b986f78ba826fa360304a69565f1880bdd7ce0c5.tar.gz latinime-b986f78ba826fa360304a69565f1880bdd7ce0c5.tar.xz latinime-b986f78ba826fa360304a69565f1880bdd7ce0c5.zip |
Separate header class from FormatSpec.
Bug: 12810574
Change-Id: Iacf1cd05a268bf690ab864b5e32a18a4b0ccc693
Diffstat (limited to 'java/src/com/android/inputmethod/latin/makedict/FormatSpec.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/makedict/FormatSpec.java | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java index 74e305976..5a3807389 100644 --- a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java +++ b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java @@ -19,7 +19,6 @@ package com.android.inputmethod.latin.makedict; import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.makedict.DictDecoder.DictionaryBufferFactory; -import com.android.inputmethod.latin.makedict.FusionDictionary.DictionaryOptions; import java.io.File; @@ -330,66 +329,6 @@ public final class FormatSpec { } /** - * Class representing file header. - */ - public static final class FileHeader { - public final int mBodyOffset; - public final DictionaryOptions mDictionaryOptions; - public final FormatOptions mFormatOptions; - - // Note that these are corresponding definitions in native code in latinime::HeaderPolicy - // and latinime::HeaderReadWriteUtils. - // TODO: Standardize the key names and bump up the format version, taking care not to - // break format version 2 dictionaries. - public static final String DICTIONARY_VERSION_KEY = "version"; - public static final String DICTIONARY_LOCALE_KEY = "locale"; - public static final String DICTIONARY_ID_KEY = "dictionary"; - public static final String DICTIONARY_DESCRIPTION_KEY = "description"; - public static final String DICTIONARY_DATE_KEY = "date"; - public static final String HAS_HISTORICAL_INFO_KEY = "HAS_HISTORICAL_INFO"; - public static final String USES_FORGETTING_CURVE_KEY = "USES_FORGETTING_CURVE"; - public static final String ATTRIBUTE_VALUE_TRUE = "1"; - public FileHeader(final int headerSize, final DictionaryOptions dictionaryOptions, - final FormatOptions formatOptions) throws UnsupportedFormatException { - mDictionaryOptions = dictionaryOptions; - mFormatOptions = formatOptions; - mBodyOffset = formatOptions.mVersion < VERSION4 ? headerSize : 0; - if (null == getLocaleString()) { - throw new UnsupportedFormatException("Cannot create a FileHeader without a locale"); - } - if (null == getVersion()) { - throw new UnsupportedFormatException( - "Cannot create a FileHeader without a version"); - } - if (null == getId()) { - throw new UnsupportedFormatException("Cannot create a FileHeader without an ID"); - } - } - - // Helper method to get the locale as a String - public String getLocaleString() { - return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_LOCALE_KEY); - } - - // Helper method to get the version String - public String getVersion() { - return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_VERSION_KEY); - } - - // Helper method to get the dictionary ID as a String - public String getId() { - return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_ID_KEY); - } - - // Helper method to get the description - public String getDescription() { - // TODO: Right now each dictionary file comes with a description in its own language. - // It will display as is no matter the device's locale. It should be internationalized. - return mDictionaryOptions.mAttributes.get(FileHeader.DICTIONARY_DESCRIPTION_KEY); - } - } - - /** * Returns new dictionary decoder. * * @param dictFile the dictionary file. |