Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 860a9f85 authored by Jean Chalard's avatar Jean Chalard
Browse files

Pull up some common code again (A99)

Change-Id: I9e9f5664bb12bb25d74c8a076a6ee1024c708145
parent 8eaeb60e
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -114,6 +114,15 @@ public class BinaryDictionary extends Dictionary {
        // TODO: toLowerCase in the native code
        final int[] prevWordCodePointArray = (null == prevWord)
                ? null : StringUtils.toCodePointArray(prevWord.toString());
        final int composerSize = composer.size();

        if (composerSize <= 1 || !composer.isBatchMode()) {
            if (composerSize > MAX_WORD_LENGTH - 1) return null;
            for (int i = 0; i < composerSize; i++) {
                mInputCodes[i] = composer.getCodeAt(i);
            }
        }

        final int count;
        if (composer.size() <= 1) {
            count = TextUtils.isEmpty(prevWord) ? -1 : getBigramsInternal(composer,
@@ -142,9 +151,6 @@ public class BinaryDictionary extends Dictionary {
    private int getBigramsInternal(final WordComposer codes,
            final int[] previousWord) {
        int codesSize = codes.size();
        if (codesSize > 0) {
            mInputCodes[0] = codes.getCodeAt(0);
        }

        int count = getBigramsNative(mNativeDict, previousWord, previousWord.length, mInputCodes,
                codesSize, mOutputChars, mOutputScores, MAX_WORD_LENGTH, MAX_BIGRAMS);
@@ -165,11 +171,6 @@ public class BinaryDictionary extends Dictionary {
            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(),