aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/Suggest.java
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2010-04-28 18:12:58 -0700
committerAmith Yamasani <yamasani@google.com>2010-05-07 13:40:20 -0700
commite4e1130d003a75e3b5cbea1678755d2b71d7cb1d (patch)
tree7a55da5d4c9923c0392438237561026fe347f765 /java/src/com/android/inputmethod/latin/Suggest.java
parentf53d0da540d4aca9c0b78938094e13a828ab1bd6 (diff)
downloadlatinime-e4e1130d003a75e3b5cbea1678755d2b71d7cb1d.tar.gz
latinime-e4e1130d003a75e3b5cbea1678755d2b71d7cb1d.tar.xz
latinime-e4e1130d003a75e3b5cbea1678755d2b71d7cb1d.zip
Tests and some new constructors to help in testing.
Added tests for the dictionary lookup and correction logic on the primary dictionary. This exercises part of the Suggest class and the native dictionary lookup code.
Diffstat (limited to 'java/src/com/android/inputmethod/latin/Suggest.java')
-rwxr-xr-xjava/src/com/android/inputmethod/latin/Suggest.java21
1 files changed, 14 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index a70bea003..010913d6d 100755
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -16,18 +16,17 @@
package com.android.inputmethod.latin;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
import android.content.Context;
import android.text.AutoText;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import com.android.inputmethod.latin.WordComposer;
-
/**
* This class loads a dictionary and provides a list of suggestions for a given sequence of
* characters. This includes corrections and completions.
@@ -69,9 +68,17 @@ public class Suggest implements Dictionary.WordCallback {
private int mCorrectionMode = CORRECTION_BASIC;
-
public Suggest(Context context, int dictionaryResId) {
mMainDict = new BinaryDictionary(context, dictionaryResId);
+ initPool();
+ }
+
+ public Suggest(Context context, ByteBuffer byteBuffer) {
+ mMainDict = new BinaryDictionary(context, byteBuffer);
+ initPool();
+ }
+
+ private void initPool() {
for (int i = 0; i < mPrefMaxSuggestions; i++) {
StringBuilder sb = new StringBuilder(32);
mStringPool.add(sb);