Remove a useless parameter (A106)

Change-Id: Ic0ecea22212fd1a098a3a168da460374e446f4a3
main
Jean Chalard 2012-07-11 11:55:25 +09:00
parent 1a69ad5a10
commit 6a5d17cd2f
5 changed files with 9 additions and 12 deletions

View File

@ -93,8 +93,7 @@ public class BinaryDictionary extends Dictionary {
int[] prevWordCodePointArray, boolean useFullEditDistance, char[] outputChars,
int[] scores, int[] outputIndices);
private native int getBigramsNative(long dict, int[] prevWord, int prevWordLength,
int[] inputCodes, int inputCodesLength, char[] outputChars, int[] scores,
int maxWordLength, int maxBigrams);
int[] inputCodes, int inputCodesLength, char[] outputChars, int[] scores);
private static native float calcNormalizedScoreNative(
char[] before, int beforeLength, char[] after, int afterLength, int score);
private static native int editDistanceNative(
@ -130,7 +129,7 @@ public class BinaryDictionary extends Dictionary {
if (TextUtils.isEmpty(prevWord)) return null;
int tmpCount = getBigramsNative(mNativeDict, prevWordCodePointArray,
prevWordCodePointArray.length, mInputCodes, composerSize,
mOutputChars, mOutputScores, MAX_WORD_LENGTH, MAX_PREDICTIONS);
mOutputChars, mOutputScores);
count = Math.min(tmpCount, MAX_PREDICTIONS);
} else {
final InputPointers ips = composer.getInputPointers();

View File

@ -167,7 +167,7 @@ static int latinime_BinaryDictionary_getSuggestions(JNIEnv *env, jobject object,
static int latinime_BinaryDictionary_getBigrams(JNIEnv *env, jobject object, jlong dict,
jintArray prevWordArray, jint prevWordLength, jintArray inputArray, jint inputArraySize,
jcharArray outputArray, jintArray frequencyArray, jint maxWordLength, jint maxBigrams) {
jcharArray outputArray, jintArray frequencyArray) {
Dictionary *dictionary = (Dictionary*)dict;
if (!dictionary) return 0;
jint *prevWord = env->GetIntArrayElements(prevWordArray, 0);
@ -175,7 +175,7 @@ static int latinime_BinaryDictionary_getBigrams(JNIEnv *env, jobject object, jlo
jchar *outputChars = env->GetCharArrayElements(outputArray, 0);
int *frequencies = env->GetIntArrayElements(frequencyArray, 0);
int count = dictionary->getBigrams(prevWord, prevWordLength, inputCodes,
inputArraySize, (unsigned short*) outputChars, frequencies, maxWordLength, maxBigrams);
inputArraySize, (unsigned short*) outputChars, frequencies);
env->ReleaseIntArrayElements(frequencyArray, frequencies, 0);
env->ReleaseCharArrayElements(outputArray, outputChars, 0);
env->ReleaseIntArrayElements(inputArray, inputCodes, JNI_ABORT);
@ -265,7 +265,7 @@ static JNINativeMethod sMethods[] = {
(void*) latinime_BinaryDictionary_getSuggestions},
{"getFrequencyNative", "(J[II)I", (void*)latinime_BinaryDictionary_getFrequency},
{"isValidBigramNative", "(J[I[I)Z", (void*)latinime_BinaryDictionary_isValidBigram},
{"getBigramsNative", "(J[II[II[C[III)I", (void*)latinime_BinaryDictionary_getBigrams},
{"getBigramsNative", "(J[II[II[C[I)I", (void*)latinime_BinaryDictionary_getBigrams},
{"calcNormalizedScoreNative", "([CI[CII)F",
(void*)latinime_BinaryDictionary_calcNormalizedScore},
{"editDistanceNative", "([CI[CI)I", (void*)latinime_BinaryDictionary_editDistance}

View File

@ -99,8 +99,7 @@ bool BigramDictionary::addWordBigram(unsigned short *word, int length, int frequ
* reduce their scope to the ones that match the first letter.
*/
int BigramDictionary::getBigrams(const int32_t *prevWord, int prevWordLength, int *inputCodes,
int codesSize, unsigned short *bigramChars, int *bigramFreq, int maxWordLength,
int maxBigrams) const {
int codesSize, unsigned short *bigramChars, int *bigramFreq) const {
// TODO: remove unused arguments, and refrain from storing stuff in members of this class
// TODO: have "in" arguments before "out" ones, and make out args explicit in the name

View File

@ -29,7 +29,7 @@ class BigramDictionary {
public:
BigramDictionary(const unsigned char *dict, int maxWordLength, int maxPredictions);
int getBigrams(const int32_t *word, int length, int *inputCodes, int codesSize,
unsigned short *outWords, int *frequencies, int maxWordLength, int maxBigrams) const;
unsigned short *outWords, int *frequencies) const;
int getBigramListPositionForWord(const int32_t *prevWord, const int prevWordLength,
const bool forceLowerCaseSearch) const;
void fillBigramAddressToFrequencyMapAndFilter(const int32_t *prevWord, const int prevWordLength,

View File

@ -59,9 +59,8 @@ class Dictionary {
}
int getBigrams(const int32_t *word, int length, int *codes, int codesSize,
unsigned short *outWords, int *frequencies, int maxWordLength, int maxBigrams) const {
return mBigramDictionary->getBigrams(word, length, codes, codesSize, outWords, frequencies,
maxWordLength, maxBigrams);
unsigned short *outWords, int *frequencies) const {
return mBigramDictionary->getBigrams(word, length, codes, codesSize, outWords, frequencies);
}
int getFrequency(const int32_t *word, int length) const;