aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-06-13 02:31:49 +0900
committerJean Chalard <jchalard@google.com>2012-06-26 13:12:01 +0900
commitd7b9e8f503cd0f4616506ed891efd468dfdbef0e (patch)
tree5fd6e1702c83ac5fccdffcf23c2eadb869a4f0ba /java/src
parent3c5db23c7acd8564a3637a64851b27dd3fc592d3 (diff)
downloadlatinime-d7b9e8f503cd0f4616506ed891efd468dfdbef0e.tar.gz
latinime-d7b9e8f503cd0f4616506ed891efd468dfdbef0e.tar.xz
latinime-d7b9e8f503cd0f4616506ed891efd468dfdbef0e.zip
Remove another dependency to WordCallback (A4)
Bug: 6252660 Bug: 6166228 Bug: 2704000 Bug: 6225530 Change-Id: I5b277124dc9244e78c4a1f4d542a55071eb479bd
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/ExpandableDictionary.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/latin/ExpandableDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableDictionary.java
index c989614fb..d1eec6b7c 100644
--- a/java/src/com/android/inputmethod/latin/ExpandableDictionary.java
+++ b/java/src/com/android/inputmethod/latin/ExpandableDictionary.java
@@ -600,13 +600,13 @@ public class ExpandableDictionary extends Dictionary {
}
private void runBigramReverseLookUp(final CharSequence previousWord,
- final WordCallback callback) {
+ final ArrayList<SuggestedWordInfo> suggestions) {
// Search for the lowercase version of the word only, because that's where bigrams
// store their sons.
Node prevWord = searchNode(mRoots, previousWord.toString().toLowerCase(), 0,
previousWord.length());
if (prevWord != null && prevWord.mNGrams != null) {
- reverseLookUp(prevWord.mNGrams, callback);
+ reverseLookUp(prevWord.mNGrams, suggestions);
}
}
@@ -614,7 +614,9 @@ public class ExpandableDictionary extends Dictionary {
public void getBigrams(final WordComposer codes, final CharSequence previousWord,
final WordCallback callback) {
if (!reloadDictionaryIfRequired()) {
- runBigramReverseLookUp(previousWord, callback);
+ final ArrayList<SuggestedWordInfo> suggestions = new ArrayList<SuggestedWordInfo>();
+ runBigramReverseLookUp(previousWord, suggestions);
+ Utils.addAllSuggestions(mDicTypeId, Dictionary.BIGRAM, suggestions, callback);
}
}
@@ -642,11 +644,12 @@ public class ExpandableDictionary extends Dictionary {
/**
* reverseLookUp retrieves the full word given a list of terminal nodes and adds those words
- * through callback.
+ * to the suggestions list passed as an argument.
* @param terminalNodes list of terminal nodes we want to add
+ * @param suggestions the suggestion collection to add the word to
*/
private void reverseLookUp(LinkedList<NextWord> terminalNodes,
- final WordCallback callback) {
+ final ArrayList<SuggestedWordInfo> suggestions) {
Node node;
int freq;
for (NextWord nextWord : terminalNodes) {
@@ -660,9 +663,9 @@ public class ExpandableDictionary extends Dictionary {
} while (node != null);
if (freq >= 0) {
- callback.addWord(mLookedUpString, null, index,
- BinaryDictionary.MAX_WORD_LENGTH - index, freq, mDicTypeId,
- Dictionary.BIGRAM);
+ suggestions.add(new SuggestedWordInfo(new String(mLookedUpString, index,
+ BinaryDictionary.MAX_WORD_LENGTH - index),
+ freq, SuggestedWordInfo.KIND_CORRECTION));
}
}
}