diff options
author | 2014-10-24 17:12:30 +0900 | |
---|---|---|
committer | 2014-10-29 12:27:24 +0900 | |
commit | ecab6aff5908bfd5b34670d2e2bb3696627fa47c (patch) | |
tree | 3573d2f3c91f217b1c7e629cd41ece24ebdb540f /java/src/com/android/inputmethod/latin/WordComposer.java | |
parent | 36799b2aa2982ec17341cd2c5ed81e608bcee8c6 (diff) | |
download | latinime-ecab6aff5908bfd5b34670d2e2bb3696627fa47c.tar.gz latinime-ecab6aff5908bfd5b34670d2e2bb3696627fa47c.tar.xz latinime-ecab6aff5908bfd5b34670d2e2bb3696627fa47c.zip |
Remove Dict dependency on WordComposer and ProximityInfo
Bug: 18108776
Change-Id: I9b399a44241e05a7add9bb8094263aa76de37880
Diffstat (limited to 'java/src/com/android/inputmethod/latin/WordComposer.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/WordComposer.java | 37 |
1 files changed, 5 insertions, 32 deletions
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index 0b77f2ce3..fa55319d2 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -19,6 +19,7 @@ package com.android.inputmethod.latin; import com.android.inputmethod.event.CombinerChain; import com.android.inputmethod.event.Event; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; +import com.android.inputmethod.latin.common.ComposedData; import com.android.inputmethod.latin.common.Constants; import com.android.inputmethod.latin.common.InputPointers; import com.android.inputmethod.latin.common.StringUtils; @@ -90,6 +91,10 @@ public final class WordComposer { refreshTypedWordCache(); } + public ComposedData getComposedDataSnapshot() { + return new ComposedData(getInputPointers(), isBatchMode(), mTypedWordCache.toString()); + } + /** * Restart the combiners, possibly with a new spec. * @param combiningSpec The spec string for combining. This is found in the extra value. @@ -134,38 +139,6 @@ public final class WordComposer { return mCodePointSize; } - /** - * Copy the code points in the typed word to a destination array of ints. - * - * If the array is too small to hold the code points in the typed word, nothing is copied and - * -1 is returned. - * - * @param destination the array of ints. - * @return the number of copied code points. - */ - public int copyCodePointsExceptTrailingSingleQuotesAndReturnCodePointCount( - final int[] destination) { - // This method can be called on a separate thread and mTypedWordCache can change while we - // are executing this method. - final String typedWord = mTypedWordCache.toString(); - // lastIndex is exclusive - final int lastIndex = typedWord.length() - - StringUtils.getTrailingSingleQuotesCount(typedWord); - if (lastIndex <= 0) { - // The string is empty or contains only single quotes. - return 0; - } - - // The following function counts the number of code points in the text range which begins - // at index 0 and extends to the character at lastIndex. - final int codePointSize = Character.codePointCount(typedWord, 0, lastIndex); - if (codePointSize > destination.length) { - return -1; - } - return StringUtils.copyCodePointsAndReturnCodePointCount(destination, typedWord, 0, - lastIndex, true /* downCase */); - } - public boolean isSingleLetter() { return size() == 1; } |