Merge "Refactor"

main
Satoshi Kataoka 2013-03-29 10:57:45 +00:00 committed by Android (Google) Code Review
commit 97a3ce022c
4 changed files with 21 additions and 19 deletions

View File

@ -33,11 +33,13 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi
const int *const xCoordinates, const int *const yCoordinates, const int *const times, const int *const xCoordinates, const int *const yCoordinates, const int *const times,
const int *const pointerIds, const bool isGeometric) { const int *const pointerIds, const bool isGeometric) {
ASSERT(isGeometric || (inputSize < MAX_WORD_LENGTH)); ASSERT(isGeometric || (inputSize < MAX_WORD_LENGTH));
mIsContinuationPossible = ProximityInfoStateUtils::checkAndReturnIsContinuationPossible( mIsContinuousSuggestionPossible =
inputSize, xCoordinates, yCoordinates, times, mSampledInputSize, &mSampledInputXs, ProximityInfoStateUtils::checkAndReturnIsContinuousSuggestionPossible(
&mSampledInputYs, &mSampledTimes, &mSampledInputIndice); inputSize, xCoordinates, yCoordinates, times, mSampledInputSize,
&mSampledInputXs, &mSampledInputYs, &mSampledTimes, &mSampledInputIndice);
if (DEBUG_DICT) { if (DEBUG_DICT) {
AKLOGI("isContinuationPossible = %s", (mIsContinuationPossible ? "true" : "false")); AKLOGI("isContinuousSuggestionPossible = %s",
(mIsContinuousSuggestionPossible ? "true" : "false"));
} }
mProximityInfo = proximityInfo; mProximityInfo = proximityInfo;
@ -64,7 +66,7 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi
mSampledInputSize = 0; mSampledInputSize = 0;
mMostProbableStringProbability = 0.0f; mMostProbableStringProbability = 0.0f;
if (mIsContinuationPossible && mSampledInputIndice.size() > 1) { if (mIsContinuousSuggestionPossible && mSampledInputIndice.size() > 1) {
// Just update difference. // Just update difference.
// Previous two points are never skipped. Thus, we pop 2 input point data here. // Previous two points are never skipped. Thus, we pop 2 input point data here.
pushTouchPointStartIndex = ProximityInfoStateUtils::trimLastTwoTouchPoints( pushTouchPointStartIndex = ProximityInfoStateUtils::trimLastTwoTouchPoints(

View File

@ -47,12 +47,12 @@ class ProximityInfoState {
: mProximityInfo(0), mMaxPointToKeyLength(0.0f), mAverageSpeed(0.0f), : mProximityInfo(0), mMaxPointToKeyLength(0.0f), mAverageSpeed(0.0f),
mHasTouchPositionCorrectionData(false), mMostCommonKeyWidthSquare(0), mHasTouchPositionCorrectionData(false), mMostCommonKeyWidthSquare(0),
mKeyCount(0), mCellHeight(0), mCellWidth(0), mGridHeight(0), mGridWidth(0), mKeyCount(0), mCellHeight(0), mCellWidth(0), mGridHeight(0), mGridWidth(0),
mIsContinuationPossible(false), mSampledInputXs(), mSampledInputYs(), mSampledTimes(), mIsContinuousSuggestionPossible(false), mSampledInputXs(), mSampledInputYs(),
mSampledInputIndice(), mSampledLengthCache(), mBeelineSpeedPercentiles(), mSampledTimes(), mSampledInputIndice(), mSampledLengthCache(),
mSampledDistanceCache_G(), mSpeedRates(), mDirections(), mCharProbabilities(), mBeelineSpeedPercentiles(), mSampledDistanceCache_G(), mSpeedRates(), mDirections(),
mSampledNearKeySets(), mSampledSearchKeySets(), mSampledSearchKeyVectors(), mCharProbabilities(), mSampledNearKeySets(), mSampledSearchKeySets(),
mTouchPositionCorrectionEnabled(false), mSampledInputSize(0), mSampledSearchKeyVectors(), mTouchPositionCorrectionEnabled(false),
mMostProbableStringProbability(0.0f) { mSampledInputSize(0), mMostProbableStringProbability(0.0f) {
memset(mInputProximities, 0, sizeof(mInputProximities)); memset(mInputProximities, 0, sizeof(mInputProximities));
memset(mNormalizedSquaredDistances, 0, sizeof(mNormalizedSquaredDistances)); memset(mNormalizedSquaredDistances, 0, sizeof(mNormalizedSquaredDistances));
memset(mPrimaryInputWord, 0, sizeof(mPrimaryInputWord)); memset(mPrimaryInputWord, 0, sizeof(mPrimaryInputWord));
@ -143,8 +143,8 @@ class ProximityInfoState {
return mSampledLengthCache[index]; return mSampledLengthCache[index];
} }
bool isContinuationPossible() const { bool isContinuousSuggestionPossible() const {
return mIsContinuationPossible; return mIsContinuousSuggestionPossible;
} }
float getPointToKeyByIdLength(const int inputIndex, const int keyId) const; float getPointToKeyByIdLength(const int inputIndex, const int keyId) const;
@ -223,7 +223,7 @@ class ProximityInfoState {
int mCellWidth; int mCellWidth;
int mGridHeight; int mGridHeight;
int mGridWidth; int mGridWidth;
bool mIsContinuationPossible; bool mIsContinuousSuggestionPossible;
std::vector<int> mSampledInputXs; std::vector<int> mSampledInputXs;
std::vector<int> mSampledInputYs; std::vector<int> mSampledInputYs;

View File

@ -968,10 +968,10 @@ namespace latinime {
return true; return true;
} }
/* static */ bool ProximityInfoStateUtils::checkAndReturnIsContinuationPossible(const int inputSize, /* static */ bool ProximityInfoStateUtils::checkAndReturnIsContinuousSuggestionPossible(
const int *const xCoordinates, const int *const yCoordinates, const int *const times, const int inputSize, const int *const xCoordinates, const int *const yCoordinates,
const int sampledInputSize, const std::vector<int> *const sampledInputXs, const int *const times, const int sampledInputSize,
const std::vector<int> *const sampledInputYs, const std::vector<int> *const sampledInputXs, const std::vector<int> *const sampledInputYs,
const std::vector<int> *const sampledTimes, const std::vector<int> *const sampledTimes,
const std::vector<int> *const sampledInputIndices) { const std::vector<int> *const sampledInputIndices) {
if (inputSize < sampledInputSize) { if (inputSize < sampledInputSize) {

View File

@ -101,7 +101,7 @@ class ProximityInfoStateUtils {
const std::vector<int> *const sampledTimes, const std::vector<int> *const sampledTimes,
const std::vector<float> *const sampledSpeedRates, const std::vector<float> *const sampledSpeedRates,
const std::vector<int> *const sampledBeelineSpeedPercentiles); const std::vector<int> *const sampledBeelineSpeedPercentiles);
static bool checkAndReturnIsContinuationPossible(const int inputSize, static bool checkAndReturnIsContinuousSuggestionPossible(const int inputSize,
const int *const xCoordinates, const int *const yCoordinates, const int *const times, const int *const xCoordinates, const int *const yCoordinates, const int *const times,
const int sampledInputSize, const std::vector<int> *const sampledInputXs, const int sampledInputSize, const std::vector<int> *const sampledInputXs,
const std::vector<int> *const sampledInputYs, const std::vector<int> *const sampledInputYs,