diff options
author | 2012-03-05 16:56:58 +0900 | |
---|---|---|
committer | 2012-03-05 22:11:13 +0900 | |
commit | 8cc8f26adfe0f06cebc697dac43a856326cf7afc (patch) | |
tree | e9b325af864e558e49a7fca9ea7c358137fe6d63 /java/src/com/android/inputmethod/latin/SuggestedWords.java | |
parent | d5b6360549c1e97958a2ec25e5c20ab4d8b455b1 (diff) | |
download | latinime-8cc8f26adfe0f06cebc697dac43a856326cf7afc.tar.gz latinime-8cc8f26adfe0f06cebc697dac43a856326cf7afc.tar.xz latinime-8cc8f26adfe0f06cebc697dac43a856326cf7afc.zip |
Make SuggestedWords partially immutable
Change-Id: I72a2f71d7f6565a30c06e563b0a64f496542cde9
Diffstat (limited to 'java/src/com/android/inputmethod/latin/SuggestedWords.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/SuggestedWords.java | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java index ff8945f71..9383c89b1 100644 --- a/java/src/com/android/inputmethod/latin/SuggestedWords.java +++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java @@ -20,6 +20,7 @@ import android.text.TextUtils; import android.view.inputmethod.CompletionInfo; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; @@ -27,14 +28,15 @@ import java.util.List; public class SuggestedWords { public static final SuggestedWords EMPTY = new SuggestedWords(null, false, false, false, null); - public final List<CharSequence> mWords; + private final List<CharSequence> mWords; public final boolean mTypedWordValid; public final boolean mHasAutoCorrectionCandidate; public final boolean mIsPunctuationSuggestions; private final List<SuggestedWordInfo> mSuggestedWordInfoList; + // TODO: Make the following member final. private boolean mShouldBlockAutoCorrectionBySafetyNet; - private SuggestedWords(List<CharSequence> words, boolean typedWordValid, + SuggestedWords(List<CharSequence> words, boolean typedWordValid, boolean hasAutoCorrectionCandidate, boolean isPunctuationSuggestions, List<SuggestedWordInfo> suggestedWordInfoList) { if (words != null) { @@ -65,11 +67,8 @@ public class SuggestedWords { return mHasAutoCorrectionCandidate && size() > 1 && !mTypedWordValid; } - public boolean isPunctuationSuggestions() { - return mIsPunctuationSuggestions; - } - - public void setShouldBlockAutoCorrectionBySatefyNet() { + // TODO: Remove this method. + public void setShouldBlockAutoCorrectionBySafetyNet() { mShouldBlockAutoCorrectionBySafetyNet = true; } @@ -190,15 +189,11 @@ public class SuggestedWords { @Override public String toString() { // Pretty-print method to help debug - final StringBuilder sb = new StringBuilder("StringBuilder: mTypedWordValid = " - + mTypedWordValid + " ; mHasMinimalSuggestion = " + mHasMinimalSuggestion - + " ; mIsPunctuationSuggestions = " + mIsPunctuationSuggestions - + " --- "); - for (CharSequence s : mWords) { - sb.append(s); - sb.append(" ; "); - } - return sb.toString(); + return "SuggestedWords.Builder:" + + " mTypedWordValid = " + mTypedWordValid + + " mHasMinimalSuggestion = " + mHasMinimalSuggestion + + " mIsPunctuationSuggestions = " + mIsPunctuationSuggestions + + " mWords=" + Arrays.toString(mWords.toArray()); } } |