diff options
author | 2012-09-13 00:38:43 -0700 | |
---|---|---|
committer | 2012-09-13 00:38:44 -0700 | |
commit | 328755eee2f6e44daa98a54bd0ee9c0f433c58be (patch) | |
tree | 79dc1cd654b69ab2472dc39063ab09cf20cfa606 /java/src/com/android/inputmethod/latin/makedict/FormatSpec.java | |
parent | 9deb52c9968c0dfc00713b76aff9398173df6f79 (diff) | |
parent | 1a347723c5ad4a71076df67f3af3b702db205719 (diff) | |
download | latinime-328755eee2f6e44daa98a54bd0ee9c0f433c58be.tar.gz latinime-328755eee2f6e44daa98a54bd0ee9c0f433c58be.tar.xz latinime-328755eee2f6e44daa98a54bd0ee9c0f433c58be.zip |
Merge "Move FormatOptions and FileHeader to FormatSpec." into jb-mr1-dev
Diffstat (limited to 'java/src/com/android/inputmethod/latin/makedict/FormatSpec.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/makedict/FormatSpec.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java index 1e2e93d90..1707ccc39 100644 --- a/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java +++ b/java/src/com/android/inputmethod/latin/makedict/FormatSpec.java @@ -17,6 +17,7 @@ package com.android.inputmethod.latin.makedict; import com.android.inputmethod.latin.Constants; +import com.android.inputmethod.latin.makedict.FusionDictionary.DictionaryOptions; /** * Dictionary File Format Specification. @@ -194,6 +195,40 @@ public final class FormatSpec { static final int MAX_TERMINAL_FREQUENCY = 255; static final int MAX_BIGRAM_FREQUENCY = 15; + /** + * Options about file format. + */ + public static class FormatOptions { + public final int mVersion; + public final boolean mHasParentAddress; + public FormatOptions(final int version) { + this(version, false); + } + public FormatOptions(final int version, final boolean hasParentAddress) { + mVersion = version; + if (version < FormatSpec.FIRST_VERSION_WITH_PARENT_ADDRESS && hasParentAddress) { + throw new RuntimeException("Parent addresses are only supported with versions " + + FormatSpec.FIRST_VERSION_WITH_PARENT_ADDRESS + " and ulterior."); + } + mHasParentAddress = hasParentAddress; + } + } + + /** + * Class representing file header. + */ + static final class FileHeader { + public final int mHeaderSize; + public final DictionaryOptions mDictionaryOptions; + public final FormatOptions mFormatOptions; + public FileHeader(final int headerSize, final DictionaryOptions dictionaryOptions, + final FormatOptions formatOptions) { + mHeaderSize = headerSize; + mDictionaryOptions = dictionaryOptions; + mFormatOptions = formatOptions; + } + } + private FormatSpec() { // This utility class is not publicly instantiable. } |