Merge "Do away with Utils#addAllSuggestions (A14)"

main
Jean Chalard 2012-06-26 01:53:08 -07:00 committed by Android (Google) Code Review
commit 582b69b317
4 changed files with 1 additions and 15 deletions

View File

@ -141,7 +141,6 @@ public class BinaryDictionary extends Dictionary {
mBigramScores[j], SuggestedWordInfo.KIND_CORRECTION)); mBigramScores[j], SuggestedWordInfo.KIND_CORRECTION));
} }
} }
Utils.addAllSuggestions(mDicTypeId, Dictionary.BIGRAM, suggestions, callback);
return suggestions; return suggestions;
} }
@ -168,7 +167,6 @@ public class BinaryDictionary extends Dictionary {
mScores[j], SuggestedWordInfo.KIND_CORRECTION)); mScores[j], SuggestedWordInfo.KIND_CORRECTION));
} }
} }
Utils.addAllSuggestions(mDicTypeId, Dictionary.UNIGRAM, suggestions, callback);
return suggestions; return suggestions;
} }

View File

@ -262,7 +262,6 @@ public class ExpandableDictionary extends Dictionary {
} }
final ArrayList<SuggestedWordInfo> suggestions = final ArrayList<SuggestedWordInfo> suggestions =
getWordsInner(codes, prevWordForBigrams, proximityInfo); getWordsInner(codes, prevWordForBigrams, proximityInfo);
Utils.addAllSuggestions(mDicTypeId, Dictionary.UNIGRAM, suggestions, callback);
return suggestions; return suggestions;
} }
@ -618,7 +617,6 @@ public class ExpandableDictionary extends Dictionary {
if (!reloadDictionaryIfRequired()) { if (!reloadDictionaryIfRequired()) {
final ArrayList<SuggestedWordInfo> suggestions = new ArrayList<SuggestedWordInfo>(); final ArrayList<SuggestedWordInfo> suggestions = new ArrayList<SuggestedWordInfo>();
runBigramReverseLookUp(previousWord, suggestions); runBigramReverseLookUp(previousWord, suggestions);
Utils.addAllSuggestions(mDicTypeId, Dictionary.BIGRAM, suggestions, callback);
return suggestions; return suggestions;
} }
return null; return null;

View File

@ -531,14 +531,4 @@ public class Utils {
} }
return builder.toString(); return builder.toString();
} }
public static void addAllSuggestions(final int dicTypeId, final int dataType,
final ArrayList<SuggestedWords.SuggestedWordInfo> suggestions,
final Dictionary.WordCallback callback) {
for (SuggestedWordInfo suggestion : suggestions) {
final String suggestionStr = suggestion.mWord.toString();
callback.addWord(suggestionStr.toCharArray(), null, 0, suggestionStr.length(),
suggestion.mScore, dicTypeId, dataType);
}
}
} }

View File

@ -792,7 +792,7 @@ public class AndroidSpellCheckerService extends SpellCheckerService
composer, prevWord, suggestionsGatherer, dictInfo.mProximityInfo); composer, prevWord, suggestionsGatherer, dictInfo.mProximityInfo);
for (final SuggestedWordInfo suggestion : suggestions) { for (final SuggestedWordInfo suggestion : suggestions) {
final String suggestionStr = suggestion.mWord.toString(); final String suggestionStr = suggestion.mWord.toString();
suggestionsGatherer.oldAddWord(suggestionStr.toCharArray(), 0, suggestionsGatherer.oldAddWord(suggestionStr.toCharArray(), null, 0,
suggestionStr.length(), suggestion.mScore, 0 /* ignored */, suggestionStr.length(), suggestion.mScore, 0 /* ignored */,
Dictionary.UNIGRAM); Dictionary.UNIGRAM);
} }