Refactor
Change-Id: Ie50fdd1081d306e520300245498a605e79e03818
This commit is contained in:
parent
48d8d8d0ae
commit
394b0bd345
4 changed files with 21 additions and 19 deletions
|
@ -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 pointerIds, const bool isGeometric) {
|
||||
ASSERT(isGeometric || (inputSize < MAX_WORD_LENGTH));
|
||||
mIsContinuationPossible = ProximityInfoStateUtils::checkAndReturnIsContinuationPossible(
|
||||
inputSize, xCoordinates, yCoordinates, times, mSampledInputSize, &mSampledInputXs,
|
||||
&mSampledInputYs, &mSampledTimes, &mSampledInputIndice);
|
||||
mIsContinuousSuggestionPossible =
|
||||
ProximityInfoStateUtils::checkAndReturnIsContinuousSuggestionPossible(
|
||||
inputSize, xCoordinates, yCoordinates, times, mSampledInputSize,
|
||||
&mSampledInputXs, &mSampledInputYs, &mSampledTimes, &mSampledInputIndice);
|
||||
if (DEBUG_DICT) {
|
||||
AKLOGI("isContinuationPossible = %s", (mIsContinuationPossible ? "true" : "false"));
|
||||
AKLOGI("isContinuousSuggestionPossible = %s",
|
||||
(mIsContinuousSuggestionPossible ? "true" : "false"));
|
||||
}
|
||||
|
||||
mProximityInfo = proximityInfo;
|
||||
|
@ -64,7 +66,7 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi
|
|||
mSampledInputSize = 0;
|
||||
mMostProbableStringProbability = 0.0f;
|
||||
|
||||
if (mIsContinuationPossible && mSampledInputIndice.size() > 1) {
|
||||
if (mIsContinuousSuggestionPossible && mSampledInputIndice.size() > 1) {
|
||||
// Just update difference.
|
||||
// Previous two points are never skipped. Thus, we pop 2 input point data here.
|
||||
pushTouchPointStartIndex = ProximityInfoStateUtils::trimLastTwoTouchPoints(
|
||||
|
|
|
@ -47,12 +47,12 @@ class ProximityInfoState {
|
|||
: mProximityInfo(0), mMaxPointToKeyLength(0.0f), mAverageSpeed(0.0f),
|
||||
mHasTouchPositionCorrectionData(false), mMostCommonKeyWidthSquare(0),
|
||||
mKeyCount(0), mCellHeight(0), mCellWidth(0), mGridHeight(0), mGridWidth(0),
|
||||
mIsContinuationPossible(false), mSampledInputXs(), mSampledInputYs(), mSampledTimes(),
|
||||
mSampledInputIndice(), mSampledLengthCache(), mBeelineSpeedPercentiles(),
|
||||
mSampledDistanceCache_G(), mSpeedRates(), mDirections(), mCharProbabilities(),
|
||||
mSampledNearKeySets(), mSampledSearchKeySets(), mSampledSearchKeyVectors(),
|
||||
mTouchPositionCorrectionEnabled(false), mSampledInputSize(0),
|
||||
mMostProbableStringProbability(0.0f) {
|
||||
mIsContinuousSuggestionPossible(false), mSampledInputXs(), mSampledInputYs(),
|
||||
mSampledTimes(), mSampledInputIndice(), mSampledLengthCache(),
|
||||
mBeelineSpeedPercentiles(), mSampledDistanceCache_G(), mSpeedRates(), mDirections(),
|
||||
mCharProbabilities(), mSampledNearKeySets(), mSampledSearchKeySets(),
|
||||
mSampledSearchKeyVectors(), mTouchPositionCorrectionEnabled(false),
|
||||
mSampledInputSize(0), mMostProbableStringProbability(0.0f) {
|
||||
memset(mInputProximities, 0, sizeof(mInputProximities));
|
||||
memset(mNormalizedSquaredDistances, 0, sizeof(mNormalizedSquaredDistances));
|
||||
memset(mPrimaryInputWord, 0, sizeof(mPrimaryInputWord));
|
||||
|
@ -143,8 +143,8 @@ class ProximityInfoState {
|
|||
return mSampledLengthCache[index];
|
||||
}
|
||||
|
||||
bool isContinuationPossible() const {
|
||||
return mIsContinuationPossible;
|
||||
bool isContinuousSuggestionPossible() const {
|
||||
return mIsContinuousSuggestionPossible;
|
||||
}
|
||||
|
||||
float getPointToKeyByIdLength(const int inputIndex, const int keyId) const;
|
||||
|
@ -223,7 +223,7 @@ class ProximityInfoState {
|
|||
int mCellWidth;
|
||||
int mGridHeight;
|
||||
int mGridWidth;
|
||||
bool mIsContinuationPossible;
|
||||
bool mIsContinuousSuggestionPossible;
|
||||
|
||||
std::vector<int> mSampledInputXs;
|
||||
std::vector<int> mSampledInputYs;
|
||||
|
|
|
@ -968,10 +968,10 @@ namespace latinime {
|
|||
return true;
|
||||
}
|
||||
|
||||
/* static */ bool ProximityInfoStateUtils::checkAndReturnIsContinuationPossible(const int inputSize,
|
||||
const int *const xCoordinates, const int *const yCoordinates, const int *const times,
|
||||
const int sampledInputSize, const std::vector<int> *const sampledInputXs,
|
||||
const std::vector<int> *const sampledInputYs,
|
||||
/* static */ bool ProximityInfoStateUtils::checkAndReturnIsContinuousSuggestionPossible(
|
||||
const int inputSize, const int *const xCoordinates, const int *const yCoordinates,
|
||||
const int *const times, const int sampledInputSize,
|
||||
const std::vector<int> *const sampledInputXs, const std::vector<int> *const sampledInputYs,
|
||||
const std::vector<int> *const sampledTimes,
|
||||
const std::vector<int> *const sampledInputIndices) {
|
||||
if (inputSize < sampledInputSize) {
|
||||
|
|
|
@ -101,7 +101,7 @@ class ProximityInfoStateUtils {
|
|||
const std::vector<int> *const sampledTimes,
|
||||
const std::vector<float> *const sampledSpeedRates,
|
||||
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 sampledInputSize, const std::vector<int> *const sampledInputXs,
|
||||
const std::vector<int> *const sampledInputYs,
|
||||
|
|
Loading…
Reference in a new issue