From 17111afcd6315d7bfd8d9dd0f3d207d6aec1576c Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Tue, 26 Jun 2012 14:49:05 +0900 Subject: [PATCH] Remove useless code and storage (A6) This is only used as temporary storage to be then added to the other variable, relying on the fact that it is hopefully sorted. It's better to just add it right away to the final storage. Change-Id: I5da702ac9dc579593ab21feb2021a01e5dfdf4dc --- .../android/inputmethod/latin/Suggest.java | 31 ++----------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index af50c06aa..2f22df34b 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -76,12 +76,9 @@ public class Suggest implements Dictionary.WordCallback { public static final int MAX_SUGGESTIONS = 18; - private static final int PREF_MAX_BIGRAMS = 60; - private float mAutoCorrectionThreshold; private ArrayList mSuggestions = new ArrayList(); - private ArrayList mBigramSuggestions = new ArrayList(); private CharSequence mConsideredWord; // TODO: Remove these member variables by passing more context to addWord() callback method @@ -212,10 +209,6 @@ public class Suggest implements Dictionary.WordCallback { return sb; } - protected void addBigramToSuggestions(SuggestedWordInfo bigram) { - mSuggestions.add(bigram); - } - private static final WordComposer sEmptyWordComposer = new WordComposer(); public SuggestedWords getBigramPredictions(CharSequence prevWordForBigram) { LatinImeLogger.onStartSuggestion(prevWordForBigram); @@ -228,16 +221,8 @@ public class Suggest implements Dictionary.WordCallback { LatinImeLogger.onAddSuggestedWord("", Suggest.DIC_USER_TYPED, Dictionary.UNIGRAM); mConsideredWord = ""; - mBigramSuggestions = new ArrayList(PREF_MAX_BIGRAMS); - getAllBigrams(prevWordForBigram, sEmptyWordComposer); - // Nothing entered: return all bigrams for the previous word - int insertCount = Math.min(mBigramSuggestions.size(), MAX_SUGGESTIONS); - for (int i = 0; i < insertCount; ++i) { - addBigramToSuggestions(mBigramSuggestions.get(i)); - } - SuggestedWordInfo.removeDups(mSuggestions); return new SuggestedWords(mSuggestions, @@ -269,15 +254,8 @@ public class Suggest implements Dictionary.WordCallback { if (wordComposer.size() <= 1 && isCorrectionEnabled) { // At first character typed, search only the bigrams - mBigramSuggestions = new ArrayList(PREF_MAX_BIGRAMS); - if (!TextUtils.isEmpty(prevWordForBigram)) { getAllBigrams(prevWordForBigram, wordComposer); - // Nothing entered: return all bigrams for the previous word - int insertCount = Math.min(mBigramSuggestions.size(), MAX_SUGGESTIONS); - for (int i = 0; i < insertCount; ++i) { - addBigramToSuggestions(mBigramSuggestions.get(i)); - } } } else if (wordComposer.size() > 1) { final WordComposer wordComposerForLookup; @@ -423,13 +401,8 @@ public class Suggest implements Dictionary.WordCallback { int dataTypeForLog = dataType; final ArrayList suggestions; final int prefMaxSuggestions; - if (dataType == Dictionary.BIGRAM) { - suggestions = mBigramSuggestions; - prefMaxSuggestions = PREF_MAX_BIGRAMS; - } else { - suggestions = mSuggestions; - prefMaxSuggestions = MAX_SUGGESTIONS; - } + suggestions = mSuggestions; + prefMaxSuggestions = MAX_SUGGESTIONS; int pos = 0;