Merge "Inline a method to avoid confusion (A97)"
This commit is contained in:
commit
8b166465b0
1 changed files with 18 additions and 25 deletions
|
@ -157,7 +157,24 @@ 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 int[] prevWord, final ProximityInfo proximityInfo) {
|
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>();
|
final ArrayList<SuggestedWordInfo> suggestions = new ArrayList<SuggestedWordInfo>();
|
||||||
for (int j = 0; j < count; ++j) {
|
for (int j = 0; j < count; ++j) {
|
||||||
|
@ -181,30 +198,6 @@ public class BinaryDictionary extends Dictionary {
|
||||||
return mNativeDict != 0;
|
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) {
|
public static float calcNormalizedScore(String before, String after, int score) {
|
||||||
return calcNormalizedScoreNative(before.toCharArray(), before.length(),
|
return calcNormalizedScoreNative(before.toCharArray(), before.length(),
|
||||||
after.toCharArray(), after.length(), score);
|
after.toCharArray(), after.length(), score);
|
||||||
|
|
Loading…
Reference in a new issue