aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-06-26 14:49:05 +0900
committerJean Chalard <jchalard@google.com>2012-06-26 16:39:32 +0900
commit17111afcd6315d7bfd8d9dd0f3d207d6aec1576c (patch)
tree4193a892696f629c75dd472b11119c10855fa665
parent5e0545d69dc07c9f127bbb305062f817f2ccd352 (diff)
downloadlatinime-17111afcd6315d7bfd8d9dd0f3d207d6aec1576c.tar.gz
latinime-17111afcd6315d7bfd8d9dd0f3d207d6aec1576c.tar.xz
latinime-17111afcd6315d7bfd8d9dd0f3d207d6aec1576c.zip
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
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java31
1 files 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<SuggestedWordInfo> mSuggestions = new ArrayList<SuggestedWordInfo>();
- private ArrayList<SuggestedWordInfo> mBigramSuggestions = new ArrayList<SuggestedWordInfo>();
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<SuggestedWordInfo>(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<SuggestedWordInfo>(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<SuggestedWordInfo> 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;