diff options
author | 2012-03-05 22:08:16 +0900 | |
---|---|---|
committer | 2012-03-05 23:06:37 +0900 | |
commit | e79b1a83126b41e09a8ec0a8dbb751ae0e02c7f6 (patch) | |
tree | e0b332aa01825818091711298d20804165229464 /java/src/com/android/inputmethod/latin/Utils.java | |
parent | 40b6e666e1acfd105ca8090cbefcf6391c87cd81 (diff) | |
download | latinime-e79b1a83126b41e09a8ec0a8dbb751ae0e02c7f6.tar.gz latinime-e79b1a83126b41e09a8ec0a8dbb751ae0e02c7f6.tar.xz latinime-e79b1a83126b41e09a8ec0a8dbb751ae0e02c7f6.zip |
Make SuggestedWords immutable completely
Change-Id: I1b0f7b857e89307c987187c1969a2846aa97fdcc
Diffstat (limited to 'java/src/com/android/inputmethod/latin/Utils.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Utils.java | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java index f6bc85431..33d4b877e 100644 --- a/java/src/com/android/inputmethod/latin/Utils.java +++ b/java/src/com/android/inputmethod/latin/Utils.java @@ -190,19 +190,25 @@ public class Utils { // TODO: Resolve the inconsistencies between the native auto correction algorithms and // this safety net - public static boolean shouldBlockAutoCorrectionBySafetyNet(SuggestedWords suggestions, - Suggest suggest) { + public static boolean shouldBlockAutoCorrectionBySafetyNet( + SuggestedWords.Builder suggestedWordsBuilder, Suggest suggest) { // Safety net for auto correction. // Actually if we hit this safety net, it's actually a bug. - if (suggestions.size() <= 1 || suggestions.mTypedWordValid) return false; + if (suggestedWordsBuilder.size() <= 1 || suggestedWordsBuilder.isTypedWordValid()) { + return false; + } // If user selected aggressive auto correction mode, there is no need to use the safety // net. - if (suggest.isAggressiveAutoCorrectionMode()) return false; - final CharSequence typedWord = suggestions.getWord(0); + if (suggest.isAggressiveAutoCorrectionMode()) { + return false; + } + final CharSequence typedWord = suggestedWordsBuilder.getWord(0); // If the length of typed word is less than MINIMUM_SAFETY_NET_CHAR_LENGTH, // we should not use net because relatively edit distance can be big. - if (typedWord.length() < MINIMUM_SAFETY_NET_CHAR_LENGTH) return false; - final CharSequence suggestionWord = suggestions.getWord(1); + if (typedWord.length() < MINIMUM_SAFETY_NET_CHAR_LENGTH) { + return false; + } + final CharSequence suggestionWord = suggestedWordsBuilder.getWord(1); final int typedWordLength = typedWord.length(); final int maxEditDistanceOfNativeDictionary = (typedWordLength < 5 ? 2 : typedWordLength / 2) + 1; |