aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-03-13 18:34:19 +0900
committerJean Chalard <jchalard@google.com>2012-03-13 18:34:19 +0900
commitd6662ecd306e1084af81c79df61cf52ef6da75ea (patch)
treee519cc5df8db9cf3189b37c63c4e98dea0e1112c /java/src
parent4ee186920e642ae8ebe0b6c97dfdceb0ad2fdeef (diff)
downloadlatinime-d6662ecd306e1084af81c79df61cf52ef6da75ea.tar.gz
latinime-d6662ecd306e1084af81c79df61cf52ef6da75ea.tar.xz
latinime-d6662ecd306e1084af81c79df61cf52ef6da75ea.zip
Cleanup
Remove an unused method, make others static, fix a formatting issue Change-Id: I40cb0b5e01a6f8e2f7b953bd9aad3168dfee71d1
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java31
-rw-r--r--java/src/com/android/inputmethod/latin/SuggestedWords.java4
2 files changed, 8 insertions, 27 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index f0bd7b13c..487e91b0e 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -180,7 +180,7 @@ public class Suggest implements Dictionary.WordCallback {
return mUnigramDictionaries;
}
- public int getApproxMaxWordLength() {
+ public static int getApproxMaxWordLength() {
return APPROX_MAX_WORD_LENGTH;
}
@@ -215,23 +215,8 @@ public class Suggest implements Dictionary.WordCallback {
mAutoCorrectionThreshold = threshold;
}
- /**
- * Number of suggestions to generate from the input key sequence. This has
- * to be a number between 1 and 100 (inclusive).
- * @param maxSuggestions
- * @throws IllegalArgumentException if the number is out of range
- */
- public void setMaxSuggestions(int maxSuggestions) {
- if (maxSuggestions < 1 || maxSuggestions > 100) {
- throw new IllegalArgumentException("maxSuggestions must be between 1 and 100");
- }
- mPrefMaxSuggestions = maxSuggestions;
- mScores = new int[mPrefMaxSuggestions];
- mBigramScores = new int[PREF_MAX_BIGRAMS];
- mSuggestions = new ArrayList<CharSequence>(mPrefMaxSuggestions);
- }
-
- private CharSequence capitalizeWord(boolean all, boolean first, CharSequence word) {
+ private static CharSequence capitalizeWord(final boolean all, final boolean first,
+ final CharSequence word) {
if (TextUtils.isEmpty(word) || !(all || first)) return word;
final int wordLength = word.length();
final StringBuilder sb = new StringBuilder(getApproxMaxWordLength());
@@ -563,16 +548,16 @@ public class Suggest implements Dictionary.WordCallback {
// TODO This is almost O(n^2). Might need fix.
// search whether the word appeared in bigram data
int bigramSuggestSize = mBigramSuggestions.size();
- for(int i = 0; i < bigramSuggestSize; i++) {
- if(mBigramSuggestions.get(i).length() == length) {
+ for (int i = 0; i < bigramSuggestSize; i++) {
+ if (mBigramSuggestions.get(i).length() == length) {
boolean chk = true;
- for(int j = 0; j < length; j++) {
- if(mBigramSuggestions.get(i).charAt(j) != word[offset+j]) {
+ for (int j = 0; j < length; j++) {
+ if (mBigramSuggestions.get(i).charAt(j) != word[offset+j]) {
chk = false;
break;
}
}
- if(chk) return i;
+ if (chk) return i;
}
}
diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java
index 31f50e4f5..9a7ea6b6a 100644
--- a/java/src/com/android/inputmethod/latin/SuggestedWords.java
+++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java
@@ -191,10 +191,6 @@ public class SuggestedWords {
return mAllowsToBeAutoCorrected;
}
- public boolean hasAutoCorrection() {
- return mHasAutoCorrection;
- }
-
@Override
public String toString() {
// Pretty-print method to help debug