diff options
author | 2012-03-13 20:39:21 +0900 | |
---|---|---|
committer | 2012-03-14 13:10:22 +0900 | |
commit | 88bf1ba5263f5a5c1df367ddc401db4109ef8677 (patch) | |
tree | 57b82f940e391fd6021914fc544073ff05f8c03a /java/src/com/android/inputmethod/latin/SuggestedWords.java | |
parent | 8e19b1183e4925b7c396de45a5e4e7d67a7b876a (diff) | |
download | latinime-88bf1ba5263f5a5c1df367ddc401db4109ef8677.tar.gz latinime-88bf1ba5263f5a5c1df367ddc401db4109ef8677.tar.xz latinime-88bf1ba5263f5a5c1df367ddc401db4109ef8677.zip |
Move up the static methods of the Builder
Change-Id: Ic3e07b745b7b24cae0f772ea49e0de615b44caf9
Diffstat (limited to 'java/src/com/android/inputmethod/latin/SuggestedWords.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/SuggestedWords.java | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java index 0def1d419..5fae06f73 100644 --- a/java/src/com/android/inputmethod/latin/SuggestedWords.java +++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java @@ -98,49 +98,49 @@ public class SuggestedWords { mShouldBlockAutoCorrectionBySafetyNet = shouldBlockAutoCorrectionBySafetyNet; } - public static ArrayList<SuggestedWordInfo> getFromCharSequenceList( - final List<CharSequence> wordList) { - final ArrayList<SuggestedWordInfo> result = new ArrayList<SuggestedWordInfo>(); - for (CharSequence word : wordList) { - if (null != word) result.add(new SuggestedWordInfo(word, null, false)); - } - return result; + public SuggestedWords build() { + return new SuggestedWords(mTypedWordValid, mHasMinimalSuggestion, + mIsPunctuationSuggestions, mShouldBlockAutoCorrectionBySafetyNet, + mAllowsToBeAutoCorrected, mSuggestedWordInfoList); } + } - public static List<SuggestedWordInfo> getFromApplicationSpecifiedCompletions( - final CompletionInfo[] infos) { - final ArrayList<SuggestedWordInfo> result = new ArrayList<SuggestedWordInfo>(); - for (CompletionInfo info : infos) { - if (null != info) result.add(new SuggestedWordInfo(info.getText(), null, false)); - } - return result; + public static ArrayList<SuggestedWordInfo> getFromCharSequenceList( + final List<CharSequence> wordList) { + final ArrayList<SuggestedWordInfo> result = new ArrayList<SuggestedWordInfo>(); + for (CharSequence word : wordList) { + if (null != word) result.add(new SuggestedWordInfo(word, null, false)); } + return result; + } - // Should get rid of the first one (what the user typed previously) from suggestions - // and replace it with what the user currently typed. - public static ArrayList<SuggestedWordInfo> getTypedWordAndPreviousSuggestions( - final CharSequence typedWord, final SuggestedWords previousSuggestions) { - final ArrayList<SuggestedWordInfo> suggestionsList = new ArrayList<SuggestedWordInfo>(); - final HashSet<String> alreadySeen = new HashSet<String>(); - suggestionsList.add(new SuggestedWordInfo(typedWord, null, false)); - alreadySeen.add(typedWord.toString()); - final int previousSize = previousSuggestions.size(); - for (int pos = 1; pos < previousSize; pos++) { - final String prevWord = previousSuggestions.getWord(pos).toString(); - // Filter out duplicate suggestion. - if (!alreadySeen.contains(prevWord)) { - suggestionsList.add(new SuggestedWordInfo(prevWord, null, true)); - alreadySeen.add(prevWord); - } - } - return suggestionsList; + public static List<SuggestedWordInfo> getFromApplicationSpecifiedCompletions( + final CompletionInfo[] infos) { + final ArrayList<SuggestedWordInfo> result = new ArrayList<SuggestedWordInfo>(); + for (CompletionInfo info : infos) { + if (null != info) result.add(new SuggestedWordInfo(info.getText(), null, false)); } + return result; + } - public SuggestedWords build() { - return new SuggestedWords(mTypedWordValid, mHasMinimalSuggestion, - mIsPunctuationSuggestions, mShouldBlockAutoCorrectionBySafetyNet, - mAllowsToBeAutoCorrected, mSuggestedWordInfoList); + // Should get rid of the first one (what the user typed previously) from suggestions + // and replace it with what the user currently typed. + public static ArrayList<SuggestedWordInfo> getTypedWordAndPreviousSuggestions( + final CharSequence typedWord, final SuggestedWords previousSuggestions) { + final ArrayList<SuggestedWordInfo> suggestionsList = new ArrayList<SuggestedWordInfo>(); + final HashSet<String> alreadySeen = new HashSet<String>(); + suggestionsList.add(new SuggestedWordInfo(typedWord, null, false)); + alreadySeen.add(typedWord.toString()); + final int previousSize = previousSuggestions.size(); + for (int pos = 1; pos < previousSize; pos++) { + final String prevWord = previousSuggestions.getWord(pos).toString(); + // Filter out duplicate suggestion. + if (!alreadySeen.contains(prevWord)) { + suggestionsList.add(new SuggestedWordInfo(prevWord, null, true)); + alreadySeen.add(prevWord); + } } + return suggestionsList; } public static class SuggestedWordInfo { |