Merge "Calculate isContinuationPossible for typing"

main
Satoshi Kataoka 2012-12-10 23:24:36 -08:00 committed by Android (Google) Code Review
commit 7ead070db5
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;
}
mIsContinuationPossible = checkAndReturnIsContinuationPossible(
inputSize, xCoordinates, yCoordinates, times, isGeometric);
mProximityInfo = proximityInfo;
mHasTouchPositionCorrectionData = proximityInfo->hasTouchPositionCorrectionData();
@ -466,13 +462,27 @@ float ProximityInfoState::calculateBeelineSpeedRate(
}
bool ProximityInfoState::checkAndReturnIsContinuationPossible(const int inputSize,
const int *const xCoordinates, const int *const yCoordinates, const int *const times) {
for (int i = 0; i < mSampledInputSize; ++i) {
const int index = mInputIndice[i];
if (index > inputSize || xCoordinates[index] != mSampledInputXs[i] ||
yCoordinates[index] != mSampledInputYs[i] || times[index] != mTimes[i]) {
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] ||
yCoordinates[index] != mSampledInputYs[i] || times[index] != mTimes[i]) {
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);