Calculate isContinuationPossible for typing

Change-Id: I11edb1e5155e5048a6c95f84b36e2ef34572178c
main
Satoshi Kataoka 2012-12-10 17:17:52 +09:00
parent 082507e1da
commit fe4f1ce26c
3 changed files with 23 additions and 12 deletions

View File

@ -376,6 +376,7 @@ static inline void prof_out(void) {
#define MIN_USER_TYPED_LENGTH_FOR_EXCESSIVE_CHARACTER_SUGGESTION 3
// TODO: Remove
#define MAX_POINTER_COUNT 1
#define MAX_POINTER_COUNT_FOR_G 2
// Size, in bytes, of the bloom filter index for bigrams

View File

@ -39,12 +39,8 @@ void ProximityInfoState::initInputParams(const int pointerId, const float maxPoi
const ProximityInfo *proximityInfo, const int *const inputCodes, const int inputSize,
const int *const xCoordinates, const int *const yCoordinates, const int *const times,
const int *const pointerIds, const bool isGeometric) {
if (isGeometric) {
mIsContinuationPossible = checkAndReturnIsContinuationPossible(
inputSize, xCoordinates, yCoordinates, times);
} else {
mIsContinuationPossible = false;
}
inputSize, xCoordinates, yCoordinates, times, isGeometric);
mProximityInfo = proximityInfo;
mHasTouchPositionCorrectionData = proximityInfo->hasTouchPositionCorrectionData();
@ -466,7 +462,9 @@ float ProximityInfoState::calculateBeelineSpeedRate(
}
bool ProximityInfoState::checkAndReturnIsContinuationPossible(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 bool isGeometric) const {
if (isGeometric) {
for (int i = 0; i < mSampledInputSize; ++i) {
const int index = mInputIndice[i];
if (index > inputSize || xCoordinates[index] != mSampledInputXs[i] ||
@ -474,6 +472,18 @@ bool ProximityInfoState::checkAndReturnIsContinuationPossible(const int inputSiz
return false;
}
}
} else {
if (inputSize < mSampledInputSize) {
// Assuming the cache is invalid if the previous input size is larger than the new one.
return false;
}
for (int i = 0; i < mSampledInputSize && i < MAX_WORD_LENGTH_INTERNAL; ++i) {
if (xCoordinates[i] != mSampledInputXs[i]
|| yCoordinates[i] != mSampledInputYs[i]) {
return false;
}
}
}
return true;
}

View File

@ -242,7 +242,7 @@ class ProximityInfoState {
const NearKeysDistanceMap *const prevNearKeysDistances,
const NearKeysDistanceMap *const prevPrevNearKeysDistances) const;
bool checkAndReturnIsContinuationPossible(const int inputSize, const int *const xCoordinates,
const int *const yCoordinates, const int *const times);
const int *const yCoordinates, const int *const times, const bool isGeometric) const;
void popInputData();
void updateAlignPointProbabilities(const int start);
bool suppressCharProbabilities(const int index1, const int index2);