Move an implementation detail to native code (A107)
Java code does not have to know about this implementation detail: the generic method should do the dispatching, instead of having the caller call either method. Change-Id: Ic13727f0cb18f4ced2c356cce2f8d710588c0421main
parent
6a5d17cd2f
commit
cc470c78e4
|
@ -147,10 +147,17 @@ static int latinime_BinaryDictionary_getSuggestions(JNIEnv *env, jobject object,
|
||||||
jint *prevWordChars = prevWordForBigrams
|
jint *prevWordChars = prevWordForBigrams
|
||||||
? env->GetIntArrayElements(prevWordForBigrams, 0) : 0;
|
? env->GetIntArrayElements(prevWordForBigrams, 0) : 0;
|
||||||
jsize prevWordLength = prevWordChars ? env->GetArrayLength(prevWordForBigrams) : 0;
|
jsize prevWordLength = prevWordChars ? env->GetArrayLength(prevWordForBigrams) : 0;
|
||||||
int count = dictionary->getSuggestions(pInfo, xCoordinates, yCoordinates, times, pointerIds,
|
|
||||||
|
int count;
|
||||||
|
if (isGesture || arraySize > 1) {
|
||||||
|
count = dictionary->getSuggestions(pInfo, xCoordinates, yCoordinates, times, pointerIds,
|
||||||
inputCodes, arraySize, prevWordChars, prevWordLength, commitPoint, isGesture,
|
inputCodes, arraySize, prevWordChars, prevWordLength, commitPoint, isGesture,
|
||||||
useFullEditDistance, (unsigned short*) outputChars,
|
useFullEditDistance, (unsigned short*) outputChars, frequencies, spaceIndices);
|
||||||
frequencies, spaceIndices);
|
} else {
|
||||||
|
count = dictionary->getBigrams(prevWordChars, prevWordLength, inputCodes,
|
||||||
|
arraySize, (unsigned short*) outputChars, frequencies);
|
||||||
|
}
|
||||||
|
|
||||||
if (prevWordChars) {
|
if (prevWordChars) {
|
||||||
env->ReleaseIntArrayElements(prevWordForBigrams, prevWordChars, JNI_ABORT);
|
env->ReleaseIntArrayElements(prevWordForBigrams, prevWordChars, JNI_ABORT);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue