aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android')
-rw-r--r--java/src/com/android/inputmethod/latin/BinaryDictionary.java6
-rw-r--r--java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java5
-rw-r--r--java/src/com/android/inputmethod/latin/ExpandableDictionary.java16
-rw-r--r--java/src/com/android/inputmethod/latin/LastComposedWord.java3
-rw-r--r--java/src/com/android/inputmethod/latin/RichInputConnection.java2
-rw-r--r--java/src/com/android/inputmethod/latin/UserHistoryDictionary.java8
-rw-r--r--java/src/com/android/inputmethod/latin/WordComposer.java14
7 files changed, 27 insertions, 27 deletions
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
index 6048a3308..448d25c73 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
@@ -41,9 +41,9 @@ public final class BinaryDictionary extends Dictionary {
* It is necessary to keep it at this value because some languages e.g. German have
* really long words.
*/
- public static final int MAX_WORD_LENGTH = Constants.Dictionary.MAX_WORD_LENGTH;
- public static final int MAX_WORDS = 18;
- public static final int MAX_SPACES = 16;
+ private static final int MAX_WORD_LENGTH = Constants.Dictionary.MAX_WORD_LENGTH;
+ private static final int MAX_WORDS = 18;
+ private static final int MAX_SPACES = 16;
private static final int MAX_PREDICTIONS = 60;
private static final int MAX_RESULTS = Math.max(MAX_PREDICTIONS, MAX_WORDS);
diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
index 159867ade..47adaa8ed 100644
--- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
@@ -51,10 +51,9 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
private static boolean DEBUG = false;
/**
- * The maximum length of a word in this dictionary. This is the same value as the binary
- * dictionary.
+ * The maximum length of a word in this dictionary.
*/
- protected static final int MAX_WORD_LENGTH = BinaryDictionary.MAX_WORD_LENGTH;
+ protected static final int MAX_WORD_LENGTH = Constants.Dictionary.MAX_WORD_LENGTH;
/**
* A static map of locks, each of which controls access to a single binary dictionary file. They
diff --git a/java/src/com/android/inputmethod/latin/ExpandableDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableDictionary.java
index fa0d5497b..ae2ee577f 100644
--- a/java/src/com/android/inputmethod/latin/ExpandableDictionary.java
+++ b/java/src/com/android/inputmethod/latin/ExpandableDictionary.java
@@ -40,7 +40,7 @@ public class ExpandableDictionary extends Dictionary {
protected static final int BIGRAM_MAX_FREQUENCY = 255;
private Context mContext;
- private char[] mWordBuilder = new char[BinaryDictionary.MAX_WORD_LENGTH];
+ private char[] mWordBuilder = new char[Constants.Dictionary.MAX_WORD_LENGTH];
private int mMaxDepth;
private int mInputLength;
@@ -158,7 +158,7 @@ public class ExpandableDictionary extends Dictionary {
super(dictType);
mContext = context;
clearDictionary();
- mCodes = new int[BinaryDictionary.MAX_WORD_LENGTH][];
+ mCodes = new int[Constants.Dictionary.MAX_WORD_LENGTH][];
}
public void loadDictionary() {
@@ -195,11 +195,11 @@ public class ExpandableDictionary extends Dictionary {
}
public int getMaxWordLength() {
- return BinaryDictionary.MAX_WORD_LENGTH;
+ return Constants.Dictionary.MAX_WORD_LENGTH;
}
public void addWord(final String word, final String shortcutTarget, final int frequency) {
- if (word.length() >= BinaryDictionary.MAX_WORD_LENGTH) {
+ if (word.length() >= Constants.Dictionary.MAX_WORD_LENGTH) {
return;
}
addWordRec(mRoots, word, 0, shortcutTarget, frequency, null);
@@ -254,7 +254,7 @@ public class ExpandableDictionary extends Dictionary {
final String prevWord, final ProximityInfo proximityInfo) {
if (reloadDictionaryIfRequired()) return null;
if (composer.size() > 1) {
- if (composer.size() >= BinaryDictionary.MAX_WORD_LENGTH) {
+ if (composer.size() >= Constants.Dictionary.MAX_WORD_LENGTH) {
return null;
}
final ArrayList<SuggestedWordInfo> suggestions =
@@ -620,7 +620,7 @@ public class ExpandableDictionary extends Dictionary {
}
// Local to reverseLookUp, but do not allocate each time.
- private final char[] mLookedUpString = new char[BinaryDictionary.MAX_WORD_LENGTH];
+ private final char[] mLookedUpString = new char[Constants.Dictionary.MAX_WORD_LENGTH];
/**
* reverseLookUp retrieves the full word given a list of terminal nodes and adds those words
@@ -635,7 +635,7 @@ public class ExpandableDictionary extends Dictionary {
for (NextWord nextWord : terminalNodes) {
node = nextWord.getWordNode();
freq = nextWord.getFrequency();
- int index = BinaryDictionary.MAX_WORD_LENGTH;
+ int index = Constants.Dictionary.MAX_WORD_LENGTH;
do {
--index;
mLookedUpString[index] = node.mCode;
@@ -647,7 +647,7 @@ public class ExpandableDictionary extends Dictionary {
// to ignore the word in this case.
if (freq >= 0 && node == null) {
suggestions.add(new SuggestedWordInfo(new String(mLookedUpString, index,
- BinaryDictionary.MAX_WORD_LENGTH - index),
+ Constants.Dictionary.MAX_WORD_LENGTH - index),
freq, SuggestedWordInfo.KIND_CORRECTION, mDictType));
}
}
diff --git a/java/src/com/android/inputmethod/latin/LastComposedWord.java b/java/src/com/android/inputmethod/latin/LastComposedWord.java
index 44ef01204..488a6fcf2 100644
--- a/java/src/com/android/inputmethod/latin/LastComposedWord.java
+++ b/java/src/com/android/inputmethod/latin/LastComposedWord.java
@@ -45,7 +45,8 @@ public final class LastComposedWord {
public final String mCommittedWord;
public final String mSeparatorString;
public final String mPrevWord;
- public final InputPointers mInputPointers = new InputPointers(BinaryDictionary.MAX_WORD_LENGTH);
+ public final InputPointers mInputPointers =
+ new InputPointers(Constants.Dictionary.MAX_WORD_LENGTH);
private boolean mActive;
diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java
index d1d920698..48ea43ea0 100644
--- a/java/src/com/android/inputmethod/latin/RichInputConnection.java
+++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java
@@ -46,7 +46,7 @@ public final class RichInputConnection {
private static final boolean DEBUG_PREVIOUS_TEXT = false;
private static final boolean DEBUG_BATCH_NESTING = false;
// Provision for a long word pair and a separator
- private static final int LOOKBACK_CHARACTER_NUM = BinaryDictionary.MAX_WORD_LENGTH * 2 + 1;
+ private static final int LOOKBACK_CHARACTER_NUM = Constants.Dictionary.MAX_WORD_LENGTH * 2 + 1;
private static final Pattern spaceRegex = Pattern.compile("\\s+");
private static final int INVALID_CURSOR_POSITION = -1;
diff --git a/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java b/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java
index f30a60af2..31a0f83f1 100644
--- a/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java
@@ -147,8 +147,8 @@ public final class UserHistoryDictionary extends ExpandableDictionary {
* The second word may not be null (a NullPointerException would be thrown).
*/
public int addToUserHistory(final String word1, final String word2, final boolean isValid) {
- if (word2.length() >= BinaryDictionary.MAX_WORD_LENGTH ||
- (word1 != null && word1.length() >= BinaryDictionary.MAX_WORD_LENGTH)) {
+ if (word2.length() >= Constants.Dictionary.MAX_WORD_LENGTH ||
+ (word1 != null && word1.length() >= Constants.Dictionary.MAX_WORD_LENGTH)) {
return -1;
}
if (mBigramListLock.tryLock()) {
@@ -239,8 +239,8 @@ public final class UserHistoryDictionary extends ExpandableDictionary {
@Override
public void setBigram(final String word1, final String word2, final int frequency) {
- if (word1.length() < BinaryDictionary.MAX_WORD_LENGTH
- && word2.length() < BinaryDictionary.MAX_WORD_LENGTH) {
+ if (word1.length() < Constants.Dictionary.MAX_WORD_LENGTH
+ && word2.length() < Constants.Dictionary.MAX_WORD_LENGTH) {
profTotal++;
if (DBG_SAVE_RESTORE) {
Log.d(TAG, "load bigram: " + word1 + "," + word2 + "," + frequency);
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java
index daff442f3..4f1759079 100644
--- a/java/src/com/android/inputmethod/latin/WordComposer.java
+++ b/java/src/com/android/inputmethod/latin/WordComposer.java
@@ -25,7 +25,7 @@ import java.util.Arrays;
* A place to store the currently composing word with information such as adjacent key codes as well
*/
public final class WordComposer {
- private static final int N = BinaryDictionary.MAX_WORD_LENGTH;
+ private static final int MAX_WORD_LENGTH = Constants.Dictionary.MAX_WORD_LENGTH;
public static final int CAPS_MODE_OFF = 0;
// 1 is shift bit, 2 is caps bit, 4 is auto bit but this is just a convention as these bits
@@ -36,7 +36,7 @@ public final class WordComposer {
public static final int CAPS_MODE_AUTO_SHIFT_LOCKED = 0x7;
private int[] mPrimaryKeyCodes;
- private final InputPointers mInputPointers = new InputPointers(N);
+ private final InputPointers mInputPointers = new InputPointers(MAX_WORD_LENGTH);
private final StringBuilder mTypedWord;
private String mAutoCorrection;
private boolean mIsResumed;
@@ -55,8 +55,8 @@ public final class WordComposer {
private boolean mIsFirstCharCapitalized;
public WordComposer() {
- mPrimaryKeyCodes = new int[N];
- mTypedWord = new StringBuilder(N);
+ mPrimaryKeyCodes = new int[MAX_WORD_LENGTH];
+ mTypedWord = new StringBuilder(MAX_WORD_LENGTH);
mAutoCorrection = null;
mTrailingSingleQuotesCount = 0;
mIsResumed = false;
@@ -111,7 +111,7 @@ public final class WordComposer {
// TODO: make sure that the index should not exceed MAX_WORD_LENGTH
public int getCodeAt(int index) {
- if (index >= BinaryDictionary.MAX_WORD_LENGTH) {
+ if (index >= MAX_WORD_LENGTH) {
return -1;
}
return mPrimaryKeyCodes[index];
@@ -134,7 +134,7 @@ public final class WordComposer {
final int newIndex = size();
mTypedWord.appendCodePoint(primaryCode);
refreshSize();
- if (newIndex < BinaryDictionary.MAX_WORD_LENGTH) {
+ if (newIndex < MAX_WORD_LENGTH) {
mPrimaryKeyCodes[newIndex] = primaryCode >= Constants.CODE_SPACE
? Character.toLowerCase(primaryCode) : primaryCode;
// In the batch input mode, the {@code mInputPointers} holds batch input points and
@@ -347,7 +347,7 @@ public final class WordComposer {
// or a DECIDED_WORD we may cancel the commit later; otherwise, we should deactivate
// the last composed word to ensure this does not happen.
final int[] primaryKeyCodes = mPrimaryKeyCodes;
- mPrimaryKeyCodes = new int[N];
+ mPrimaryKeyCodes = new int[MAX_WORD_LENGTH];
final LastComposedWord lastComposedWord = new LastComposedWord(primaryKeyCodes,
mInputPointers, mTypedWord.toString(), committedWord, separatorString,
prevWord);