aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/research/MainLogBuffer.java
diff options
context:
space:
mode:
authorKurt Partridge <kep@google.com>2013-01-24 16:14:11 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2013-01-24 16:14:11 -0800
commit10e117610240f7ab3f010811f8d06f3c264853af (patch)
treeb5c19995ac99f20c04f66b40788f669c0b9ec3b7 /java/src/com/android/inputmethod/research/MainLogBuffer.java
parent76cf1c9cd78af63355d6e15b29eff7a5cb35f73d (diff)
parent2baa4b0701c6e02aa25b03881c8863b2d3856282 (diff)
downloadlatinime-10e117610240f7ab3f010811f8d06f3c264853af.tar.gz
latinime-10e117610240f7ab3f010811f8d06f3c264853af.tar.xz
latinime-10e117610240f7ab3f010811f8d06f3c264853af.zip
am 2baa4b07: [Rlog83] Fix missing uses of hasWord() abstraction
# Via Kurt Partridge * commit '2baa4b0701c6e02aa25b03881c8863b2d3856282': [Rlog83] Fix missing uses of hasWord() abstraction
Diffstat (limited to 'java/src/com/android/inputmethod/research/MainLogBuffer.java')
-rw-r--r--java/src/com/android/inputmethod/research/MainLogBuffer.java27
1 files changed, 13 insertions, 14 deletions
diff --git a/java/src/com/android/inputmethod/research/MainLogBuffer.java b/java/src/com/android/inputmethod/research/MainLogBuffer.java
index 57d5c41d7..3a87bf1df 100644
--- a/java/src/com/android/inputmethod/research/MainLogBuffer.java
+++ b/java/src/com/android/inputmethod/research/MainLogBuffer.java
@@ -117,20 +117,19 @@ public abstract class MainLogBuffer extends FixedLogBuffer {
if (IS_LOGGING_EVERYTHING) {
if (mIsStopping) {
return true;
- } else {
- // Only check that it is the right length. If not, wait for later words to make
- // complete n-grams.
- int numWordsInLogUnitList = 0;
- final int length = logUnits.size();
- for (int i = 0; i < length; i++) {
- final LogUnit logUnit = logUnits.get(i);
- final String word = logUnit.getWord();
- if (word != null) {
- numWordsInLogUnitList++;
- }
+ }
+ // Only check that it is the right length. If not, wait for later words to make
+ // complete n-grams.
+ int numWordsInLogUnitList = 0;
+ final int length = logUnits.size();
+ for (int i = 0; i < length; i++) {
+ final LogUnit logUnit = logUnits.get(i);
+ final String word = logUnit.getWord();
+ if (word != null) {
+ numWordsInLogUnitList++;
}
- return numWordsInLogUnitList >= minNGramSize;
}
+ return numWordsInLogUnitList >= minNGramSize;
}
// Check that we are not sampling too frequently. Having sampled recently might disclose
@@ -157,14 +156,14 @@ public abstract class MainLogBuffer extends FixedLogBuffer {
final int length = logUnits.size();
for (int i = 0; i < length; i++) {
final LogUnit logUnit = logUnits.get(i);
- final String word = logUnit.getWord();
- if (word == null) {
+ if (!logUnit.hasWord()) {
// Digits outside words are a privacy threat.
if (logUnit.mayContainDigit()) {
return false;
}
} else {
numWordsInLogUnitList++;
+ final String word = logUnit.getWord();
// Words not in the dictionary are a privacy threat.
if (ResearchLogger.hasLetters(word) && !(dictionary.isValidWord(word))) {
if (DEBUG) {