aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/src/com/android/inputmethod/latin/ExpandableDictionary.java3
-rw-r--r--java/src/com/android/inputmethod/latin/utils/UserHistoryForgettingCurveUtils.java9
2 files changed, 12 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/ExpandableDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableDictionary.java
index 95c9bcab9..8fdff8f7e 100644
--- a/java/src/com/android/inputmethod/latin/ExpandableDictionary.java
+++ b/java/src/com/android/inputmethod/latin/ExpandableDictionary.java
@@ -33,6 +33,7 @@ import java.util.LinkedList;
* be searched for suggestions and valid words.
*/
// TODO: Remove after binary dictionary supports dynamic update.
+@UsedForTesting
public class ExpandableDictionary extends Dictionary {
private static final String TAG = ExpandableDictionary.class.getSimpleName();
/**
@@ -146,6 +147,7 @@ public class ExpandableDictionary extends Dictionary {
private int[][] mCodes;
+ @UsedForTesting
public ExpandableDictionary(final String dictType) {
super(dictType);
clearDictionary();
@@ -164,6 +166,7 @@ public class ExpandableDictionary extends Dictionary {
* @param shortcutFreq The frequency of the shortcut (0~15, with 15 = whitelist). Ignored
* if shortcutTarget is null.
*/
+ @UsedForTesting
public void addWord(final String word, final String shortcutTarget, final int frequency,
final int shortcutFreq) {
if (word.length() >= Constants.DICTIONARY_MAX_WORD_LENGTH) {
diff --git a/java/src/com/android/inputmethod/latin/utils/UserHistoryForgettingCurveUtils.java b/java/src/com/android/inputmethod/latin/utils/UserHistoryForgettingCurveUtils.java
index 1992b2f5d..677035ed6 100644
--- a/java/src/com/android/inputmethod/latin/utils/UserHistoryForgettingCurveUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/UserHistoryForgettingCurveUtils.java
@@ -20,6 +20,9 @@ import android.util.Log;
import java.util.concurrent.TimeUnit;
+import com.android.inputmethod.annotations.UsedForTesting;
+
+@UsedForTesting
public final class UserHistoryForgettingCurveUtils {
private static final String TAG = UserHistoryForgettingCurveUtils.class.getSimpleName();
private static final boolean DEBUG = false;
@@ -118,18 +121,22 @@ public final class UserHistoryForgettingCurveUtils {
}
}
+ @UsedForTesting
/* package */ static int fcToElapsedTime(byte fc) {
return fc & 0x0F;
}
+ @UsedForTesting
/* package */ static int fcToCount(byte fc) {
return (fc >> 4) & 0x03;
}
+ @UsedForTesting
/* package */ static int fcToLevel(byte fc) {
return (fc >> 6) & 0x03;
}
+ @UsedForTesting
private static int calcFreq(int elapsedTime, int count, int level) {
if (level <= 0) {
// Reserved words, just return -1
@@ -158,6 +165,7 @@ public final class UserHistoryForgettingCurveUtils {
return calcFreq(elapsedTime, count, level);
}
+ @UsedForTesting
public static byte pushElapsedTime(byte fc) {
int elapsedTime = fcToElapsedTime(fc);
int count = fcToCount(fc);
@@ -173,6 +181,7 @@ public final class UserHistoryForgettingCurveUtils {
return calcFc(elapsedTime, count, level);
}
+ @UsedForTesting
public static byte pushCount(byte fc, boolean isValid) {
final int elapsedTime = fcToElapsedTime(fc);
int count = fcToCount(fc);