aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-04-25 18:49:31 +0900
committerJean Chalard <jchalard@google.com>2012-04-26 16:40:29 +0900
commit20a6dea1cabfd8822824f7dca828d898e5b91cbc (patch)
tree8d240b92bd08af04bb5cbc773e691f67658e4d0c /java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
parent329c8d7bcce4f785fa6e31df6cbda0c11014d49b (diff)
downloadlatinime-20a6dea1cabfd8822824f7dca828d898e5b91cbc.tar.gz
latinime-20a6dea1cabfd8822824f7dca828d898e5b91cbc.tar.xz
latinime-20a6dea1cabfd8822824f7dca828d898e5b91cbc.zip
Add a flag for bigram presence in the header
This is a cherry-pick of Icb602762 onto jb-dev. Bug: 6355745 Change-Id: Icb602762bb0d81472f024fa491571062ec1fc4e9
Diffstat (limited to 'java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java')
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
index 88da7b0d8..d82d503c4 100644
--- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
+++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
@@ -131,6 +131,7 @@ public class BinaryDictInputOutput {
// These options need to be the same numeric values as the one in the native reading code.
private static final int GERMAN_UMLAUT_PROCESSING_FLAG = 0x1;
private static final int FRENCH_LIGATURE_PROCESSING_FLAG = 0x4;
+ private static final int CONTAINS_BIGRAMS_FLAG = 0x8;
// TODO: Make this value adaptative to content data, store it in the header, and
// use it in the reading code.
@@ -752,9 +753,12 @@ public class BinaryDictInputOutput {
/**
* Makes the 2-byte value for options flags.
*/
- private static final int makeOptionsValue(final DictionaryOptions options) {
+ private static final int makeOptionsValue(final FusionDictionary dictionary) {
+ final DictionaryOptions options = dictionary.mOptions;
+ final boolean hasBigrams = dictionary.hasBigrams();
return (options.mFrenchLigatureProcessing ? FRENCH_LIGATURE_PROCESSING_FLAG : 0)
- + (options.mGermanUmlautProcessing ? GERMAN_UMLAUT_PROCESSING_FLAG : 0);
+ + (options.mGermanUmlautProcessing ? GERMAN_UMLAUT_PROCESSING_FLAG : 0)
+ + (hasBigrams ? CONTAINS_BIGRAMS_FLAG : 0);
}
/**
@@ -970,7 +974,7 @@ public class BinaryDictInputOutput {
headerBuffer.write((byte) (0xFF & version));
}
// Options flags
- final int options = makeOptionsValue(dict.mOptions);
+ final int options = makeOptionsValue(dict);
headerBuffer.write((byte) (0xFF & (options >> 8)));
headerBuffer.write((byte) (0xFF & options));
if (version >= FIRST_VERSION_WITH_HEADER_SIZE) {