From 64dad2d5a958acf2bc53cce5cade4b8e2b34c05f Mon Sep 17 00:00:00 2001
From: Jean Chalard <jchalard@google.com>
Date: Tue, 26 Jun 2012 15:22:26 +0900
Subject: [PATCH] Remove an unused method and inline another (A10)

Change-Id: Ifd71ce79711b0c15c7764e97351dbb1b8e4c0c2d
---
 .../android/inputmethod/latin/Suggest.java    | 53 ++++---------------
 1 file changed, 10 insertions(+), 43 deletions(-)

diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index 61a8e28310..67c03f626e 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -209,31 +209,6 @@ public class Suggest implements Dictionary.WordCallback {
         return sb;
     }
 
-    private static final WordComposer sEmptyWordComposer = new WordComposer();
-    public SuggestedWords getBigramPredictions(CharSequence prevWordForBigram) {
-        LatinImeLogger.onStartSuggestion(prevWordForBigram);
-        mIsFirstCharCapitalized = false;
-        mIsAllUpperCase = false;
-        mTrailingSingleQuotesCount = 0;
-        mSuggestions = new ArrayList<SuggestedWordInfo>(MAX_SUGGESTIONS);
-
-        // Treating USER_TYPED as UNIGRAM suggestion for logging now.
-        LatinImeLogger.onAddSuggestedWord("", Suggest.DIC_USER_TYPED, Dictionary.UNIGRAM);
-        mConsideredWord = "";
-
-        getAllBigrams(prevWordForBigram, sEmptyWordComposer);
-
-        SuggestedWordInfo.removeDups(mSuggestions);
-
-        return new SuggestedWords(mSuggestions,
-                false /* typedWordValid */,
-                false /* hasAutoCorrectionCandidate */,
-                false /* allowsToBeAutoCorrected */,
-                false /* isPunctuationSuggestions */,
-                false /* isObsoleteSuggestions */,
-                true /* isPrediction */);
-    }
-
     // Compatibility for tests. TODO: remove this
     public SuggestedWords getSuggestedWords(
             final WordComposer wordComposer, CharSequence prevWordForBigram,
@@ -264,7 +239,16 @@ public class Suggest implements Dictionary.WordCallback {
         if (wordComposer.size() <= 1 && isCorrectionEnabled) {
             // At first character typed, search only the bigrams
             if (!TextUtils.isEmpty(prevWordForBigram)) {
-                getAllBigrams(prevWordForBigram, wordComposer);
+                if (StringUtils.hasUpperCase(prevWordForBigram)) {
+                    // TODO: Must pay attention to locale when changing case.
+                    final CharSequence lowerPrevWord = prevWordForBigram.toString().toLowerCase();
+                    for (final Dictionary dictionary : mBigramDictionaries.values()) {
+                        dictionary.getBigrams(wordComposer, lowerPrevWord, this);
+                    }
+                }
+                for (final Dictionary dictionary : mBigramDictionaries.values()) {
+                    dictionary.getBigrams(wordComposer, prevWordForBigram, this);
+                }
             }
         } else if (wordComposer.size() > 1) {
             final WordComposer wordComposerForLookup;
@@ -362,23 +346,6 @@ public class Suggest implements Dictionary.WordCallback {
                 isPrediction);
     }
 
-    /**
-     * Adds all bigram predictions for prevWord. Also checks the lower case version of prevWord if
-     * it contains any upper case characters.
-     */
-    private void getAllBigrams(final CharSequence prevWord, final WordComposer wordComposer) {
-        if (StringUtils.hasUpperCase(prevWord)) {
-            // TODO: Must pay attention to locale when changing case.
-            final CharSequence lowerPrevWord = prevWord.toString().toLowerCase();
-            for (final Dictionary dictionary : mBigramDictionaries.values()) {
-                dictionary.getBigrams(wordComposer, lowerPrevWord, this);
-            }
-        }
-        for (final Dictionary dictionary : mBigramDictionaries.values()) {
-            dictionary.getBigrams(wordComposer, prevWord, this);
-        }
-    }
-
     private static ArrayList<SuggestedWordInfo> getSuggestionsInfoListWithDebugInfo(
             final String typedWord, final ArrayList<SuggestedWordInfo> suggestions) {
         final SuggestedWordInfo typedWordInfo = suggestions.get(0);
-- 
GitLab