From ee456af9d4c7ce4fe2dc0513a8b2cf08c21b5f21 Mon Sep 17 00:00:00 2001
From: Ken Wakasa <kwakasa@google.com>
Date: Fri, 1 Feb 2013 19:59:40 +0900
Subject: [PATCH] Cleanup in ProximityInfoParams

Change-Id: I4302e3cb2470cee32f9ac2f04e0837fff67ce0cd
---
 native/jni/src/dictionary.h              | 18 +++++++++---------
 native/jni/src/proximity_info.cpp        |  7 +++----
 native/jni/src/proximity_info_params.cpp |  1 +
 native/jni/src/proximity_info_params.h   |  1 +
 4 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/native/jni/src/dictionary.h b/native/jni/src/dictionary.h
index 83676b2048..ecdddd771c 100644
--- a/native/jni/src/dictionary.h
+++ b/native/jni/src/dictionary.h
@@ -31,15 +31,15 @@ class UnigramDictionary;
 class Dictionary {
  public:
     // Taken from SuggestedWords.java
-    const static int KIND_TYPED = 0; // What user typed
-    const static int KIND_CORRECTION = 1; // Simple correction/suggestion
-    const static int KIND_COMPLETION = 2; // Completion (suggestion with appended chars)
-    const static int KIND_WHITELIST = 3; // Whitelisted word
-    const static int KIND_BLACKLIST = 4; // Blacklisted word
-    const static int KIND_HARDCODED = 5; // Hardcoded suggestion, e.g. punctuation
-    const static int KIND_APP_DEFINED = 6; // Suggested by the application
-    const static int KIND_SHORTCUT = 7; // A shortcut
-    const static int KIND_PREDICTION = 8; // A prediction (== a suggestion with no input)
+    static const int KIND_TYPED = 0; // What user typed
+    static const int KIND_CORRECTION = 1; // Simple correction/suggestion
+    static const int KIND_COMPLETION = 2; // Completion (suggestion with appended chars)
+    static const int KIND_WHITELIST = 3; // Whitelisted word
+    static const int KIND_BLACKLIST = 4; // Blacklisted word
+    static const int KIND_HARDCODED = 5; // Hardcoded suggestion, e.g. punctuation
+    static const int KIND_APP_DEFINED = 6; // Suggested by the application
+    static const int KIND_SHORTCUT = 7; // A shortcut
+    static const int KIND_PREDICTION = 8; // A prediction (== a suggestion with no input)
 
     Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust);
 
diff --git a/native/jni/src/proximity_info.cpp b/native/jni/src/proximity_info.cpp
index 3979cfa9a4..d812745ca5 100644
--- a/native/jni/src/proximity_info.cpp
+++ b/native/jni/src/proximity_info.cpp
@@ -24,6 +24,7 @@
 #include "geometry_utils.h"
 #include "jni.h"
 #include "proximity_info.h"
+#include "proximity_info_params.h"
 
 namespace latinime {
 
@@ -127,17 +128,15 @@ bool ProximityInfo::hasSpaceProximity(const int x, const int y) const {
 
 float ProximityInfo::getNormalizedSquaredDistanceFromCenterFloatG(
         const int keyId, const int x, const int y) const {
-    const static float verticalSweetSpotScaleForGeometric = 1.1f;
     const bool correctTouchPosition = hasTouchPositionCorrectionData();
-    const float centerX = static_cast<float>(correctTouchPosition
-            ? getSweetSpotCenterXAt(keyId)
+    const float centerX = static_cast<float>(correctTouchPosition ? getSweetSpotCenterXAt(keyId)
             : getKeyCenterXOfKeyIdG(keyId));
     const float visualKeyCenterY = static_cast<float>(getKeyCenterYOfKeyIdG(keyId));
     float centerY;
     if (correctTouchPosition) {
         const float sweetSpotCenterY = static_cast<float>(getSweetSpotCenterYAt(keyId));
         const float gapY = sweetSpotCenterY - visualKeyCenterY;
-        centerY = visualKeyCenterY + gapY * verticalSweetSpotScaleForGeometric;
+        centerY = visualKeyCenterY + gapY * ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE_G;
     } else {
         centerY = visualKeyCenterY;
     }
diff --git a/native/jni/src/proximity_info_params.cpp b/native/jni/src/proximity_info_params.cpp
index 8cdd2b8017..1410ab5759 100644
--- a/native/jni/src/proximity_info_params.cpp
+++ b/native/jni/src/proximity_info_params.cpp
@@ -20,6 +20,7 @@
 namespace latinime {
 const float ProximityInfoParams::NOT_A_DISTANCE_FLOAT = -1.0f;
 const int ProximityInfoParams::MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE = 5;
+const float ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE_G = 1.1f;
 
 /* Per method constants */
 // Used by ProximityInfoStateUtils::initGeometricDistanceInfos()
diff --git a/native/jni/src/proximity_info_params.h b/native/jni/src/proximity_info_params.h
index c8e0bf7f7f..7c26208a8e 100644
--- a/native/jni/src/proximity_info_params.h
+++ b/native/jni/src/proximity_info_params.h
@@ -25,6 +25,7 @@ class ProximityInfoParams {
  public:
     static const float NOT_A_DISTANCE_FLOAT;
     static const int MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE;
+    static const float VERTICAL_SWEET_SPOT_SCALE_G;
 
     // Used by ProximityInfoStateUtils::initGeometricDistanceInfos()
     static const float NEAR_KEY_NORMALIZED_SQUARED_THRESHOLD;
-- 
GitLab