Cosmetic fixes and a bug fix in UnigramDictionary::testCharGroupForContinuedLikeness().

This change has actually been extracted from a change work in progress I4fe423834b8131fb122251892c98228a6e08ba25

Change-Id: I52568fa09da2ea22be7f8bfe9676b7cd73c31fa4
diff --git a/native/jni/src/proximity_info.cpp b/native/jni/src/proximity_info.cpp
index 765632e..7371726 100644
--- a/native/jni/src/proximity_info.cpp
+++ b/native/jni/src/proximity_info.cpp
@@ -29,7 +29,6 @@
 
 namespace latinime {
 
-/* static */ const int ProximityInfo::NOT_A_CODE = -1;
 /* static */ const float ProximityInfo::NOT_A_DISTANCE_FLOAT = -1.0f;
 
 static inline void safeGetOrFillZeroIntArrayRegion(JNIEnv *env, jintArray jArray, jsize len,
@@ -84,22 +83,22 @@
     safeGetOrFillZeroIntArrayRegion(env, keyYCoordinates, KEY_COUNT, mKeyYCoordinates);
     safeGetOrFillZeroIntArrayRegion(env, keyWidths, KEY_COUNT, mKeyWidths);
     safeGetOrFillZeroIntArrayRegion(env, keyHeights, KEY_COUNT, mKeyHeights);
-    safeGetOrFillZeroIntArrayRegion(env, keyCharCodes, KEY_COUNT, mKeyCharCodes);
+    safeGetOrFillZeroIntArrayRegion(env, keyCharCodes, KEY_COUNT, mKeyCodePoints);
     safeGetOrFillZeroFloatArrayRegion(env, sweetSpotCenterXs, KEY_COUNT, mSweetSpotCenterXs);
     safeGetOrFillZeroFloatArrayRegion(env, sweetSpotCenterYs, KEY_COUNT, mSweetSpotCenterYs);
     safeGetOrFillZeroFloatArrayRegion(env, sweetSpotRadii, KEY_COUNT, mSweetSpotRadii);
-    initializeCodeToKeyIndex();
+    initializeCodePointToKeyIndex();
     initializeG();
 }
 
 // Build the reversed look up table from the char code to the index in mKeyXCoordinates,
 // mKeyYCoordinates, mKeyWidths, mKeyHeights, mKeyCharCodes.
-void ProximityInfo::initializeCodeToKeyIndex() {
-    memset(mCodeToKeyIndex, -1, (MAX_CHAR_CODE + 1) * sizeof(mCodeToKeyIndex[0]));
+void ProximityInfo::initializeCodePointToKeyIndex() {
+    memset(mCodePointToKeyIndex, -1, sizeof(mCodePointToKeyIndex));
     for (int i = 0; i < KEY_COUNT; ++i) {
-        const int code = mKeyCharCodes[i];
+        const int code = mKeyCodePoints[i];
         if (0 <= code && code <= MAX_CHAR_CODE) {
-            mCodeToKeyIndex[code] = i;
+            mCodePointToKeyIndex[code] = i;
         }
     }
 }
@@ -117,7 +116,8 @@
     if (x < 0 || y < 0) {
         if (DEBUG_DICT) {
             AKLOGI("HasSpaceProximity: Illegal coordinates (%d, %d)", x, y);
-            assert(false);
+            // TODO: Enable this assertion.
+            //assert(false);
         }
         return false;
     }
@@ -145,8 +145,8 @@
 
 float ProximityInfo::getNormalizedSquaredDistanceFromCenterFloat(
         const int keyId, const int x, const int y) const {
-    const float centerX = static_cast<float>(getKeyCenterXOfIdG(keyId));
-    const float centerY = static_cast<float>(getKeyCenterYOfIdG(keyId));
+    const float centerX = static_cast<float>(getKeyCenterXOfKeyIdG(keyId));
+    const float centerY = static_cast<float>(getKeyCenterYOfKeyIdG(keyId));
     const float touchX = static_cast<float>(x);
     const float touchY = static_cast<float>(y);
     const float keyWidth = static_cast<float>(getMostCommonKeyWidth());
@@ -178,7 +178,7 @@
             if (c < KEYCODE_SPACE || c == primaryKey) {
                 continue;
             }
-            const int keyIndex = getKeyIndex(c);
+            const int keyIndex = getKeyIndexOf(c);
             const bool onKey = isOnKey(keyIndex, x, y);
             const int distance = squaredDistanceToEdge(keyIndex, x, y);
             if (onKey || distance < MOST_COMMON_KEY_WIDTH_SQUARE) {
@@ -208,7 +208,7 @@
                 const int32_t ac = additionalProximityChars[j];
                 int k = 0;
                 for (; k < insertPos; ++k) {
-                    if ((int)ac == inputCodes[k]) {
+                    if (static_cast<int>(ac) == inputCodes[k]) {
                         break;
                     }
                 }
@@ -227,11 +227,11 @@
     }
     // Add a delimiter for the proximity characters
     for (int i = insertPos; i < MAX_PROXIMITY_CHARS_SIZE; ++i) {
-        inputCodes[i] = NOT_A_CODE;
+        inputCodes[i] = NOT_A_CODE_POINT;
     }
 }
 
-int ProximityInfo::getKeyIndex(const int c) const {
+int ProximityInfo::getKeyIndexOf(const int c) const {
     if (KEY_COUNT == 0) {
         // We do not have the coordinate data
         return NOT_AN_INDEX;
@@ -240,28 +240,28 @@
     if (baseLowerC > MAX_CHAR_CODE) {
         return NOT_AN_INDEX;
     }
-    return mCodeToKeyIndex[baseLowerC];
+    return mCodePointToKeyIndex[baseLowerC];
 }
 
-int ProximityInfo::getKeyCode(const int keyIndex) const {
+int ProximityInfo::getCodePointOf(const int keyIndex) const {
     if (keyIndex < 0 || keyIndex >= KEY_COUNT) {
-        return NOT_AN_INDEX;
+        return NOT_A_CODE_POINT;
     }
-    return mKeyToCodeIndexG[keyIndex];
+    return mKeyIndexToCodePointG[keyIndex];
 }
 
 void ProximityInfo::initializeG() {
     // TODO: Optimize
     for (int i = 0; i < KEY_COUNT; ++i) {
-        const int code = mKeyCharCodes[i];
+        const int code = mKeyCodePoints[i];
         const int lowerCode = toBaseLowerCase(code);
         mCenterXsG[i] = mKeyXCoordinates[i] + mKeyWidths[i] / 2;
         mCenterYsG[i] = mKeyYCoordinates[i] + mKeyHeights[i] / 2;
         if (code != lowerCode && lowerCode >= 0 && lowerCode <= MAX_CHAR_CODE) {
-            mCodeToKeyIndex[lowerCode] = i;
-            mKeyToCodeIndexG[i] = lowerCode;
+            mCodePointToKeyIndex[lowerCode] = i;
+            mKeyIndexToCodePointG[i] = lowerCode;
         } else {
-            mKeyToCodeIndexG[i] = code;
+            mKeyIndexToCodePointG[i] = code;
         }
     }
     for (int i = 0; i < KEY_COUNT; i++) {
@@ -274,22 +274,22 @@
     }
 }
 
-float ProximityInfo::getKeyCenterXOfCharG(int charCode) const {
-    return getKeyCenterXOfIdG(getKeyIndex(charCode));
+float ProximityInfo::getKeyCenterXOfCodePointG(int charCode) const {
+    return getKeyCenterXOfKeyIdG(getKeyIndexOf(charCode));
 }
 
-float ProximityInfo::getKeyCenterYOfCharG(int charCode) const {
-    return getKeyCenterYOfIdG(getKeyIndex(charCode));
+float ProximityInfo::getKeyCenterYOfCodePointG(int charCode) const {
+    return getKeyCenterYOfKeyIdG(getKeyIndexOf(charCode));
 }
 
-float ProximityInfo::getKeyCenterXOfIdG(int keyId) const {
+float ProximityInfo::getKeyCenterXOfKeyIdG(int keyId) const {
     if (keyId >= 0) {
         return mCenterXsG[keyId];
     }
     return 0;
 }
 
-float ProximityInfo::getKeyCenterYOfIdG(int keyId) const {
+float ProximityInfo::getKeyCenterYOfKeyIdG(int keyId) const {
     if (keyId >= 0) {
         return mCenterYsG[keyId];
     }
@@ -297,8 +297,8 @@
 }
 
 int ProximityInfo::getKeyKeyDistanceG(int key0, int key1) const {
-    const int keyId0 = getKeyIndex(key0);
-    const int keyId1 = getKeyIndex(key1);
+    const int keyId0 = getKeyIndexOf(key0);
+    const int keyId1 = getKeyIndexOf(key1);
     if (keyId0 >= 0 && keyId1 >= 0) {
         return mKeyKeyDistancesG[keyId0][keyId1];
     }