diff options
author | 2012-07-10 22:48:52 -0700 | |
---|---|---|
committer | 2012-07-10 22:48:52 -0700 | |
commit | 8b166465b0fb07e3271a13c9880c9d0ecb41418d (patch) | |
tree | 8ab5c91984e62b6a445fe1fc4717614ffd7c50d0 /java/src/com/android/inputmethod/latin/BinaryDictionary.java | |
parent | fd9b485111a37293f8660c0123fd145e3fd988b6 (diff) | |
parent | e77f2996ea4eca42fbb46d0ce0a6055233b21c38 (diff) | |
download | latinime-8b166465b0fb07e3271a13c9880c9d0ecb41418d.tar.gz latinime-8b166465b0fb07e3271a13c9880c9d0ecb41418d.tar.xz latinime-8b166465b0fb07e3271a13c9880c9d0ecb41418d.zip |
Merge "Inline a method to avoid confusion (A97)"
Diffstat (limited to 'java/src/com/android/inputmethod/latin/BinaryDictionary.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/BinaryDictionary.java | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java index 0747959d6..42aa28351 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java @@ -157,7 +157,24 @@ public class BinaryDictionary extends Dictionary { // proximityInfo and/or prevWordForBigrams may not be null. private ArrayList<SuggestedWordInfo> getWordsInternal(final WordComposer codes, final int[] prevWord, final ProximityInfo proximityInfo) { - final int count = getWordsInternalInternal(codes, prevWord, proximityInfo); + final InputPointers ips = codes.getInputPointers(); + final boolean isGesture = codes.isBatchMode(); + final int codesSize; + if (isGesture) { + codesSize = ips.getPointerSize(); + } else { + codesSize = codes.size(); + // Won't deal with really long words. + if (codesSize > MAX_WORD_LENGTH - 1) return null; + for (int i = 0; i < codesSize; i++) { + mInputCodes[i] = codes.getCodeAt(i); + } + } + + final int count = getSuggestionsNative(mNativeDict, proximityInfo.getNativeProximityInfo(), + ips.getXCoordinates(), ips.getYCoordinates(), ips.getTimes(), ips.getPointerIds(), + mInputCodes, codesSize, 0 /* unused */, isGesture, prevWord, + mUseFullEditDistance, mOutputChars, mOutputScores, mSpaceIndices); final ArrayList<SuggestedWordInfo> suggestions = new ArrayList<SuggestedWordInfo>(); for (int j = 0; j < count; ++j) { @@ -181,30 +198,6 @@ public class BinaryDictionary extends Dictionary { return mNativeDict != 0; } - // proximityInfo may not be null. - // TODO: remove this method by inlining it into getWordsInternal - private int getWordsInternalInternal(final WordComposer codes, - final int[] prevWord, final ProximityInfo proximityInfo) { - final InputPointers ips = codes.getInputPointers(); - final boolean isGesture = codes.isBatchMode(); - final int codesSize; - if (isGesture) { - codesSize = ips.getPointerSize(); - } else { - codesSize = codes.size(); - // Won't deal with really long words. - if (codesSize > MAX_WORD_LENGTH - 1) return -1; - for (int i = 0; i < codesSize; i++) { - mInputCodes[i] = codes.getCodeAt(i); - } - } - - return getSuggestionsNative(mNativeDict, proximityInfo.getNativeProximityInfo(), - ips.getXCoordinates(), ips.getYCoordinates(), ips.getTimes(), ips.getPointerIds(), - mInputCodes, codesSize, 0 /* unused */, isGesture, prevWord, - mUseFullEditDistance, mOutputChars, mOutputScores, mSpaceIndices); - } - public static float calcNormalizedScore(String before, String after, int score) { return calcNormalizedScoreNative(before.toCharArray(), before.length(), after.toCharArray(), after.length(), score); |