Cleanup in ProximityInfoParams

Change-Id: I4302e3cb2470cee32f9ac2f04e0837fff67ce0cd
This commit is contained in:
Ken Wakasa 2013-02-01 19:59:40 +09:00
parent 0ae5b07b3b
commit ee456af9d4
4 changed files with 14 additions and 13 deletions

View file

@ -31,15 +31,15 @@ class UnigramDictionary;
class Dictionary { class Dictionary {
public: public:
// Taken from SuggestedWords.java // Taken from SuggestedWords.java
const static int KIND_TYPED = 0; // What user typed static const int KIND_TYPED = 0; // What user typed
const static int KIND_CORRECTION = 1; // Simple correction/suggestion static const int KIND_CORRECTION = 1; // Simple correction/suggestion
const static int KIND_COMPLETION = 2; // Completion (suggestion with appended chars) static const int KIND_COMPLETION = 2; // Completion (suggestion with appended chars)
const static int KIND_WHITELIST = 3; // Whitelisted word static const int KIND_WHITELIST = 3; // Whitelisted word
const static int KIND_BLACKLIST = 4; // Blacklisted word static const int KIND_BLACKLIST = 4; // Blacklisted word
const static int KIND_HARDCODED = 5; // Hardcoded suggestion, e.g. punctuation static const int KIND_HARDCODED = 5; // Hardcoded suggestion, e.g. punctuation
const static int KIND_APP_DEFINED = 6; // Suggested by the application static const int KIND_APP_DEFINED = 6; // Suggested by the application
const static int KIND_SHORTCUT = 7; // A shortcut static const int KIND_SHORTCUT = 7; // A shortcut
const static int KIND_PREDICTION = 8; // A prediction (== a suggestion with no input) static const int KIND_PREDICTION = 8; // A prediction (== a suggestion with no input)
Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust); Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust);

View file

@ -24,6 +24,7 @@
#include "geometry_utils.h" #include "geometry_utils.h"
#include "jni.h" #include "jni.h"
#include "proximity_info.h" #include "proximity_info.h"
#include "proximity_info_params.h"
namespace latinime { namespace latinime {
@ -127,17 +128,15 @@ bool ProximityInfo::hasSpaceProximity(const int x, const int y) const {
float ProximityInfo::getNormalizedSquaredDistanceFromCenterFloatG( float ProximityInfo::getNormalizedSquaredDistanceFromCenterFloatG(
const int keyId, const int x, const int y) const { const int keyId, const int x, const int y) const {
const static float verticalSweetSpotScaleForGeometric = 1.1f;
const bool correctTouchPosition = hasTouchPositionCorrectionData(); const bool correctTouchPosition = hasTouchPositionCorrectionData();
const float centerX = static_cast<float>(correctTouchPosition const float centerX = static_cast<float>(correctTouchPosition ? getSweetSpotCenterXAt(keyId)
? getSweetSpotCenterXAt(keyId)
: getKeyCenterXOfKeyIdG(keyId)); : getKeyCenterXOfKeyIdG(keyId));
const float visualKeyCenterY = static_cast<float>(getKeyCenterYOfKeyIdG(keyId)); const float visualKeyCenterY = static_cast<float>(getKeyCenterYOfKeyIdG(keyId));
float centerY; float centerY;
if (correctTouchPosition) { if (correctTouchPosition) {
const float sweetSpotCenterY = static_cast<float>(getSweetSpotCenterYAt(keyId)); const float sweetSpotCenterY = static_cast<float>(getSweetSpotCenterYAt(keyId));
const float gapY = sweetSpotCenterY - visualKeyCenterY; const float gapY = sweetSpotCenterY - visualKeyCenterY;
centerY = visualKeyCenterY + gapY * verticalSweetSpotScaleForGeometric; centerY = visualKeyCenterY + gapY * ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE_G;
} else { } else {
centerY = visualKeyCenterY; centerY = visualKeyCenterY;
} }

View file

@ -20,6 +20,7 @@
namespace latinime { namespace latinime {
const float ProximityInfoParams::NOT_A_DISTANCE_FLOAT = -1.0f; const float ProximityInfoParams::NOT_A_DISTANCE_FLOAT = -1.0f;
const int ProximityInfoParams::MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE = 5; const int ProximityInfoParams::MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE = 5;
const float ProximityInfoParams::VERTICAL_SWEET_SPOT_SCALE_G = 1.1f;
/* Per method constants */ /* Per method constants */
// Used by ProximityInfoStateUtils::initGeometricDistanceInfos() // Used by ProximityInfoStateUtils::initGeometricDistanceInfos()

View file

@ -25,6 +25,7 @@ class ProximityInfoParams {
public: public:
static const float NOT_A_DISTANCE_FLOAT; static const float NOT_A_DISTANCE_FLOAT;
static const int MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE; static const int MIN_DOUBLE_LETTER_BEELINE_SPEED_PERCENTILE;
static const float VERTICAL_SWEET_SPOT_SCALE_G;
// Used by ProximityInfoStateUtils::initGeometricDistanceInfos() // Used by ProximityInfoStateUtils::initGeometricDistanceInfos()
static const float NEAR_KEY_NORMALIZED_SQUARED_THRESHOLD; static const float NEAR_KEY_NORMALIZED_SQUARED_THRESHOLD;