diff options
author | 2012-11-16 16:10:10 -0800 | |
---|---|---|
committer | 2013-01-23 09:21:56 -0800 | |
commit | 2baa4b0701c6e02aa25b03881c8863b2d3856282 (patch) | |
tree | 7be9a2a6af0804fc74fdadda9751053809fb8aa8 /java/src/com/android/inputmethod/research/MainLogBuffer.java | |
parent | edb5c4638b139d6908ceea724120e5a24b21c249 (diff) | |
download | latinime-2baa4b0701c6e02aa25b03881c8863b2d3856282.tar.gz latinime-2baa4b0701c6e02aa25b03881c8863b2d3856282.tar.xz latinime-2baa4b0701c6e02aa25b03881c8863b2d3856282.zip |
[Rlog83] Fix missing uses of hasWord() abstraction
Change-Id: I78e286723b1b8c8bcc7aea0cc81ef2ee66a193ac
Diffstat (limited to 'java/src/com/android/inputmethod/research/MainLogBuffer.java')
-rw-r--r-- | java/src/com/android/inputmethod/research/MainLogBuffer.java | 27 |
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) { |