Start converging two identical methods (A92)

Change-Id: I3c85a80610fde664a328f5606d0724f00d445ebe
main
Jean Chalard 2012-07-10 20:13:54 +09:00
parent d82dcdc924
commit 2ae75ed56b
1 changed files with 4 additions and 4 deletions

View File

@ -118,7 +118,7 @@ public class BinaryDictionary extends Dictionary {
// TODO: move to native code // TODO: move to native code
private ArrayList<SuggestedWordInfo> getBigramsInternal(final WordComposer codes, private ArrayList<SuggestedWordInfo> getBigramsInternal(final WordComposer codes,
final CharSequence previousWord) { final CharSequence previousWord) {
if (mNativeDict == 0) return null; if (!isValidDictionary()) return null;
int[] codePoints = StringUtils.toCodePointArray(previousWord.toString()); int[] codePoints = StringUtils.toCodePointArray(previousWord.toString());
Arrays.fill(mOutputChars_bigrams, (char) 0); Arrays.fill(mOutputChars_bigrams, (char) 0);
@ -157,6 +157,8 @@ public class BinaryDictionary extends Dictionary {
// proximityInfo and/or prevWordForBigrams may not be null. // proximityInfo and/or prevWordForBigrams may not be null.
private ArrayList<SuggestedWordInfo> getWordsInternal(final WordComposer codes, private ArrayList<SuggestedWordInfo> getWordsInternal(final WordComposer codes,
final CharSequence prevWordForBigrams, final ProximityInfo proximityInfo) { final CharSequence prevWordForBigrams, final ProximityInfo proximityInfo) {
if (!isValidDictionary()) return null;
final int count = getSuggestions(codes, prevWordForBigrams, proximityInfo, mOutputChars, final int count = getSuggestions(codes, prevWordForBigrams, proximityInfo, mOutputChars,
mScores, mSpaceIndices); mScores, mSpaceIndices);
@ -183,11 +185,9 @@ public class BinaryDictionary extends Dictionary {
} }
// proximityInfo may not be null. // proximityInfo may not be null.
/* package for test */ int getSuggestions(final WordComposer codes, private int getSuggestions(final WordComposer codes,
final CharSequence prevWordForBigrams, final ProximityInfo proximityInfo, final CharSequence prevWordForBigrams, final ProximityInfo proximityInfo,
char[] outputChars, int[] scores, int[] spaceIndices) { char[] outputChars, int[] scores, int[] spaceIndices) {
if (!isValidDictionary()) return -1;
Arrays.fill(mInputCodes, WordComposer.NOT_A_CODE); Arrays.fill(mInputCodes, WordComposer.NOT_A_CODE);
Arrays.fill(outputChars, (char) 0); Arrays.fill(outputChars, (char) 0);
Arrays.fill(scores, 0); Arrays.fill(scores, 0);