aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorKeisuke Kuroyanagi <ksk@google.com>2013-09-10 18:45:39 +0900
committerKeisuke Kuroyanagi <ksk@google.com>2013-09-10 18:45:53 +0900
commite531c2241eb8d5a1462c43ce0deffaf6c769cc23 (patch)
treeb80ded1d133889cf2ff36d444c9bd6bab2687127 /java/src
parent5bf96a8fc14a014c06849d70892506ebc8984666 (diff)
downloadlatinime-e531c2241eb8d5a1462c43ce0deffaf6c769cc23.tar.gz
latinime-e531c2241eb8d5a1462c43ce0deffaf6c769cc23.tar.xz
latinime-e531c2241eb8d5a1462c43ce0deffaf6c769cc23.zip
Move a flag about switching dynamic update to java.
Bug: 6669677 Change-Id: I6aa99cae4a227f9202179c2873d13473a773e024
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
index 740b86d86..998896b2e 100644
--- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
@@ -49,6 +49,10 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
/** Whether to print debug output to log */
private static boolean DEBUG = false;
+ // TODO: Remove and enable dynamic update in native code.
+ /** Whether to call binary dictionary dynamically updating methods. */
+ private static boolean ENABLE_BINARY_DICTIONARY_DYNAMIC_UPDATE = false;
+
/**
* The maximum length of a word in this dictionary.
*/
@@ -72,6 +76,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
*/
private BinaryDictionary mBinaryDictionary;
+ // TODO: Remove and handle dictionaries in native code.
/** The in-memory dictionary used to generate the binary dictionary. */
protected AbstractDictionaryWriter mDictionaryWriter;
@@ -225,6 +230,10 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
// TODO: Use a queue to reflect what needs to be reflected.
if (mLocalDictionaryController.writeLock().tryLock()) {
try {
+ if (ENABLE_BINARY_DICTIONARY_DYNAMIC_UPDATE) {
+ mBinaryDictionary.addUnigramWord(word, frequency);
+ }
+ // TODO: Remove.
mDictionaryWriter.addUnigramWord(word, shortcutTarget, frequency, isNotAWord);
} finally {
mLocalDictionaryController.writeLock().unlock();
@@ -245,6 +254,10 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
// TODO: Use a queue to reflect what needs to be reflected.
if (mLocalDictionaryController.writeLock().tryLock()) {
try {
+ if (ENABLE_BINARY_DICTIONARY_DYNAMIC_UPDATE) {
+ mBinaryDictionary.addBigramWords(word0, word1, frequency);
+ }
+ // TODO: Remove.
mDictionaryWriter.addBigramWords(word0, word1, frequency, isValid,
0 /* lastTouchedTime */);
} finally {
@@ -265,6 +278,10 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
// TODO: Use a queue to reflect what needs to be reflected.
if (mLocalDictionaryController.writeLock().tryLock()) {
try {
+ if (ENABLE_BINARY_DICTIONARY_DYNAMIC_UPDATE) {
+ mBinaryDictionary.removeBigramWords(word0, word1);
+ }
+ // TODO: Remove.
mDictionaryWriter.removeBigramWords(word0, word1);
} finally {
mLocalDictionaryController.writeLock().unlock();