am 7ead070d: Merge "Calculate isContinuationPossible for typing"

* commit '7ead070db5ed717daf7ea482cc4340f2a17ae556':
  Calculate isContinuationPossible for typing
main
Satoshi Kataoka 2012-12-10 23:25:53 -08:00 committed by Android Git Automerger
commit 0be1651f95
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 #define MIN_USER_TYPED_LENGTH_FOR_EXCESSIVE_CHARACTER_SUGGESTION 3
// TODO: Remove // TODO: Remove
#define MAX_POINTER_COUNT 1
#define MAX_POINTER_COUNT_FOR_G 2 #define MAX_POINTER_COUNT_FOR_G 2
// Size, in bytes, of the bloom filter index for bigrams // 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 ProximityInfo *proximityInfo, const int *const inputCodes, 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 *const pointerIds, const bool isGeometric) { const int *const pointerIds, const bool isGeometric) {
if (isGeometric) { mIsContinuationPossible = checkAndReturnIsContinuationPossible(
mIsContinuationPossible = checkAndReturnIsContinuationPossible( inputSize, xCoordinates, yCoordinates, times, isGeometric);
inputSize, xCoordinates, yCoordinates, times);
} else {
mIsContinuationPossible = false;
}
mProximityInfo = proximityInfo; mProximityInfo = proximityInfo;
mHasTouchPositionCorrectionData = proximityInfo->hasTouchPositionCorrectionData(); mHasTouchPositionCorrectionData = proximityInfo->hasTouchPositionCorrectionData();
@ -466,13 +462,27 @@ float ProximityInfoState::calculateBeelineSpeedRate(
} }
bool ProximityInfoState::checkAndReturnIsContinuationPossible(const int inputSize, 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,
for (int i = 0; i < mSampledInputSize; ++i) { const bool isGeometric) const {
const int index = mInputIndice[i]; if (isGeometric) {
if (index > inputSize || xCoordinates[index] != mSampledInputXs[i] || for (int i = 0; i < mSampledInputSize; ++i) {
yCoordinates[index] != mSampledInputYs[i] || times[index] != mTimes[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; 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; return true;
} }

View File

@ -242,7 +242,7 @@ class ProximityInfoState {
const NearKeysDistanceMap *const prevNearKeysDistances, const NearKeysDistanceMap *const prevNearKeysDistances,
const NearKeysDistanceMap *const prevPrevNearKeysDistances) const; const NearKeysDistanceMap *const prevPrevNearKeysDistances) const;
bool checkAndReturnIsContinuationPossible(const int inputSize, const int *const xCoordinates, 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 popInputData();
void updateAlignPointProbabilities(const int start); void updateAlignPointProbabilities(const int start);
bool suppressCharProbabilities(const int index1, const int index2); bool suppressCharProbabilities(const int index1, const int index2);