aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/research/MainLogBuffer.java
diff options
context:
space:
mode:
authorKurt Partridge <kep@google.com>2013-02-21 21:18:31 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-02-21 21:18:32 +0000
commit7c996475d8531af413c09d4ece51423b96edd172 (patch)
treecfbeb24b87406e1d45981ee5c0103db44b1d3fb1 /java/src/com/android/inputmethod/research/MainLogBuffer.java
parentc8a1ec6e4128240a8f666120dbc3fb066a717f00 (diff)
parent19e05359e641fff2fee410eda5572011926620a5 (diff)
downloadlatinime-7c996475d8531af413c09d4ece51423b96edd172.tar.gz
latinime-7c996475d8531af413c09d4ece51423b96edd172.tar.xz
latinime-7c996475d8531af413c09d4ece51423b96edd172.zip
Merge "[TestPrep3] Add helper method to retrive dictionary"
Diffstat (limited to 'java/src/com/android/inputmethod/research/MainLogBuffer.java')
-rw-r--r--java/src/com/android/inputmethod/research/MainLogBuffer.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/research/MainLogBuffer.java b/java/src/com/android/inputmethod/research/MainLogBuffer.java
index 3a87bf1df..182b924fc 100644
--- a/java/src/com/android/inputmethod/research/MainLogBuffer.java
+++ b/java/src/com/android/inputmethod/research/MainLogBuffer.java
@@ -93,6 +93,11 @@ public abstract class MainLogBuffer extends FixedLogBuffer {
mSuggest = suggest;
}
+ private Dictionary getDictionary() {
+ if (mSuggest == null || !mSuggest.hasMainDictionary()) return null;
+ return mSuggest.getMainDictionary();
+ }
+
public void resetWordCounter() {
mNumWordsUntilSafeToSample = mNumWordsBetweenNGrams;
}
@@ -137,16 +142,13 @@ public abstract class MainLogBuffer extends FixedLogBuffer {
if (mNumWordsUntilSafeToSample > 0) {
return false;
}
- if (mSuggest == null || !mSuggest.hasMainDictionary()) {
- // Main dictionary is unavailable. Since we cannot check it, we cannot tell if a
- // word is out-of-vocabulary or not. Therefore, we must judge the entire buffer
- // contents to potentially pose a privacy risk.
- return false;
- }
// Reload the dictionary in case it has changed (e.g., because the user has changed
// languages).
- final Dictionary dictionary = mSuggest.getMainDictionary();
+ final Dictionary dictionary = getDictionary();
if (dictionary == null) {
+ // Main dictionary is unavailable. Since we cannot check it, we cannot tell if a
+ // word is out-of-vocabulary or not. Therefore, we must judge the entire buffer
+ // contents to potentially pose a privacy risk.
return false;
}