diff options
author | 2012-06-26 15:44:21 +0900 | |
---|---|---|
committer | 2012-06-26 17:58:52 +0900 | |
commit | 61e7ec658710eca3fd03af39b52b4a87eabcdd4c (patch) | |
tree | 96686f1ea252c62a9c1f8ba479de6ffa7cebd0e1 /java/src/com | |
parent | 2f1b6c9ea438841fc2a7262a0593739c3dc82782 (diff) | |
download | latinime-61e7ec658710eca3fd03af39b52b4a87eabcdd4c.tar.gz latinime-61e7ec658710eca3fd03af39b52b4a87eabcdd4c.tar.xz latinime-61e7ec658710eca3fd03af39b52b4a87eabcdd4c.zip |
Remove the Callback interface for simpler code. (A17)
Bug: 6252660
Bug: 6166228
Bug: 2704000
Bug: 6225530
Change-Id: I009b54fc2e73cadca6734bdca074d033e81f6a2b
Diffstat (limited to 'java/src/com')
3 files changed, 3 insertions, 40 deletions
diff --git a/java/src/com/android/inputmethod/latin/Dictionary.java b/java/src/com/android/inputmethod/latin/Dictionary.java index e6d3cfbbc..99a04da72 100644 --- a/java/src/com/android/inputmethod/latin/Dictionary.java +++ b/java/src/com/android/inputmethod/latin/Dictionary.java @@ -35,27 +35,6 @@ public abstract class Dictionary { public static final int BIGRAM = 1; public static final int NOT_A_PROBABILITY = -1; - /** - * Interface to be implemented by classes requesting words to be fetched from the dictionary. - * @see #getWords(WordComposer, CharSequence, WordCallback, ProximityInfo) - */ - public interface WordCallback { - /** - * Adds a word to a list of suggestions. The word is expected to be ordered based on - * the provided score. - * @param word the character array containing the word - * @param spaceIndices the indices of inserted spaces - * @param wordOffset starting offset of the word in the character array - * @param wordLength length of valid characters in the character array - * @param score the score of occurrence. This is normalized between 1 and 255, but - * can exceed those limits - * @param dicTypeId of the dictionary where word was from - * @param dataType tells type of this data, either UNIGRAM or BIGRAM - * @return true if the word was added, false if no more words are required - */ - boolean addWord(char[] word, int[] spaceIndices, int wordOffset, int wordLength, int score, - int dicTypeId, int dataType); - } /** * Searches for words in the dictionary that match the characters in the composer. Matched @@ -64,7 +43,6 @@ public abstract class Dictionary { * @param prevWordForBigrams the previous word, or null if none * @param proximityInfo the object for key proximity. May be ignored by some implementations. * @return the list of suggestions - * @see WordCallback#addWord(char[], int, int, int, int, int) */ abstract public ArrayList<SuggestedWordInfo> getWords(final WordComposer composer, final CharSequence prevWordForBigrams, final ProximityInfo proximityInfo); diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 3729c99e4..3b420aab6 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -35,7 +35,7 @@ import java.util.concurrent.ConcurrentHashMap; * This class loads a dictionary and provides a list of suggestions for a given sequence of * characters. This includes corrections and completions. */ -public class Suggest implements Dictionary.WordCallback { +public class Suggest { public static final String TAG = Suggest.class.getSimpleName(); public static final int APPROX_MAX_WORD_LENGTH = 32; @@ -403,13 +403,6 @@ public class Suggest implements Dictionary.WordCallback { return suggestionsList; } - // TODO: Remove this method - @Override - public boolean addWord(final char[] word, int[] indices, final int offset, final int length, - int score, final int dicTypeId, final int dataType) { - return true; - } - // TODO: Use codepoint instead of char public boolean oldAddWord(final char[] word, int[] indices, final int offset, final int length, int score, final int dicTypeId, final int dataType) { diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java index 129f74f60..3bf18c520 100644 --- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java +++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java @@ -32,7 +32,6 @@ import com.android.inputmethod.keyboard.ProximityInfo; import com.android.inputmethod.latin.BinaryDictionary; import com.android.inputmethod.latin.ContactsBinaryDictionary; import com.android.inputmethod.latin.Dictionary; -import com.android.inputmethod.latin.Dictionary.WordCallback; import com.android.inputmethod.latin.DictionaryCollection; import com.android.inputmethod.latin.DictionaryFactory; import com.android.inputmethod.latin.LocaleUtils; @@ -204,9 +203,8 @@ public class AndroidSpellCheckerService extends SpellCheckerService EMPTY_STRING_ARRAY); } - // TODO: remove this class when WordCallback is finally out of the picture and - // replace it by storage local to the session. - private static class SuggestionsGatherer implements WordCallback { + // TODO: remove this class and replace it by storage local to the session. + private static class SuggestionsGatherer { public static class Result { public final String[] mSuggestions; public final boolean mHasRecommendedSuggestions; @@ -240,12 +238,6 @@ public class AndroidSpellCheckerService extends SpellCheckerService mScores = new int[mMaxLength]; } - @Override - synchronized public boolean addWord(char[] word, int[] spaceIndices, int wordOffset, - int wordLength, int score, int dicTypeId, int dataType) { - return true; - } - synchronized public boolean oldAddWord(char[] word, int[] spaceIndices, int wordOffset, int wordLength, int score, int dicTypeId /* unused */, int dataType) { final int positionIndex = Arrays.binarySearch(mScores, 0, mLength, score); |