am c980b1bf: Move NOT_A_TIMESTAMP to defines.h

* commit 'c980b1bfa71bb6876e1f0887be187cb253dc8ba3':
  Move NOT_A_TIMESTAMP to defines.h
main
Keisuke Kuroyanagi 2013-12-08 19:09:39 -08:00 committed by Android Git Automerger
commit ee6be09e6d
6 changed files with 10 additions and 6 deletions

View File

@ -298,6 +298,7 @@ static inline void prof_out(void) {
#define NOT_AN_INDEX (-1) #define NOT_AN_INDEX (-1)
#define NOT_A_PROBABILITY (-1) #define NOT_A_PROBABILITY (-1)
#define NOT_A_DICT_POS (S_INT_MIN) #define NOT_A_DICT_POS (S_INT_MIN)
#define NOT_A_TIMESTAMP (-1)
// A special value to mean the first word confidence makes no sense in this case, // A special value to mean the first word confidence makes no sense in this case,
// e.g. this is not a multi-word suggestion. // e.g. this is not a multi-word suggestion.

View File

@ -27,7 +27,7 @@ const BigramEntry BigramDictContent::getBigramEntryAndAdvancePosition(
Ver4DictConstants::BIGRAM_FLAGS_FIELD_SIZE, bigramEntryPos); Ver4DictConstants::BIGRAM_FLAGS_FIELD_SIZE, bigramEntryPos);
const bool hasNext = (bigramFlags & Ver4DictConstants::BIGRAM_HAS_NEXT_MASK) != 0; const bool hasNext = (bigramFlags & Ver4DictConstants::BIGRAM_HAS_NEXT_MASK) != 0;
int probability = NOT_A_PROBABILITY; int probability = NOT_A_PROBABILITY;
int timestamp = Ver4DictConstants::NOT_A_TIME_STAMP; int timestamp = NOT_A_TIMESTAMP;
int level = 0; int level = 0;
int count = 0; int count = 0;
if (mHasHistoricalInfo) { if (mHasHistoricalInfo) {

View File

@ -32,7 +32,7 @@ class BigramEntry {
// Entry with historical information. // Entry with historical information.
BigramEntry(const bool hasNext, const int probability, const int targetTerminalId) BigramEntry(const bool hasNext, const int probability, const int targetTerminalId)
: mHasNext(hasNext), mProbability(probability), : mHasNext(hasNext), mProbability(probability),
mTimestamp(Ver4DictConstants::NOT_A_TIME_STAMP), mLevel(0), mCount(0), mTimestamp(NOT_A_TIMESTAMP), mLevel(0), mCount(0),
mTargetTerminalId(targetTerminalId) {} mTargetTerminalId(targetTerminalId) {}
// Entry with historical information. // Entry with historical information.

View File

@ -32,12 +32,12 @@ class ProbabilityEntry {
// Dummy entry // Dummy entry
ProbabilityEntry() ProbabilityEntry()
: mFlags(0), mProbability(NOT_A_PROBABILITY), : mFlags(0), mProbability(NOT_A_PROBABILITY),
mTimestamp(Ver4DictConstants::NOT_A_TIME_STAMP), mLevel(0), mCount(0) {} mTimestamp(NOT_A_TIMESTAMP), mLevel(0), mCount(0) {}
// Entry without historical information // Entry without historical information
ProbabilityEntry(const int flags, const int probability) ProbabilityEntry(const int flags, const int probability)
: mFlags(flags), mProbability(probability), : mFlags(flags), mProbability(probability),
mTimestamp(Ver4DictConstants::NOT_A_TIME_STAMP), mLevel(0), mCount(0) {} mTimestamp(NOT_A_TIMESTAMP), mLevel(0), mCount(0) {}
// Entry with historical information. // Entry with historical information.
ProbabilityEntry(const int flags, const int probability, const int timestamp, ProbabilityEntry(const int flags, const int probability, const int timestamp,
@ -49,6 +49,11 @@ class ProbabilityEntry {
return ProbabilityEntry(mFlags, probability, mTimestamp, mLevel, mCount); return ProbabilityEntry(mFlags, probability, mTimestamp, mLevel, mCount);
} }
const ProbabilityEntry createEntryWithUpdatedHistoricalInfo(const int timestamp,
const int level, const int count) const {
return ProbabilityEntry(mFlags, mProbability, timestamp, level, count);
}
int getFlags() const { int getFlags() const {
return mFlags; return mFlags;
} }

View File

@ -38,7 +38,6 @@ const int Ver4DictConstants::MAX_DICTIONARY_SIZE = 2 * 1024 * 1024;
const int Ver4DictConstants::MAX_DICT_EXTENDED_REGION_SIZE = 1 * 1024 * 1024; const int Ver4DictConstants::MAX_DICT_EXTENDED_REGION_SIZE = 1 * 1024 * 1024;
const int Ver4DictConstants::NOT_A_TERMINAL_ID = -1; const int Ver4DictConstants::NOT_A_TERMINAL_ID = -1;
const int Ver4DictConstants::NOT_A_TIME_STAMP = -1;
const int Ver4DictConstants::PROBABILITY_SIZE = 1; const int Ver4DictConstants::PROBABILITY_SIZE = 1;
const int Ver4DictConstants::FLAGS_IN_PROBABILITY_FILE_SIZE = 1; const int Ver4DictConstants::FLAGS_IN_PROBABILITY_FILE_SIZE = 1;
const int Ver4DictConstants::TERMINAL_ADDRESS_TABLE_ADDRESS_SIZE = 3; const int Ver4DictConstants::TERMINAL_ADDRESS_TABLE_ADDRESS_SIZE = 3;

View File

@ -38,7 +38,6 @@ class Ver4DictConstants {
static const int MAX_DICT_EXTENDED_REGION_SIZE; static const int MAX_DICT_EXTENDED_REGION_SIZE;
static const int NOT_A_TERMINAL_ID; static const int NOT_A_TERMINAL_ID;
static const int NOT_A_TIME_STAMP;
static const int PROBABILITY_SIZE; static const int PROBABILITY_SIZE;
static const int FLAGS_IN_PROBABILITY_FILE_SIZE; static const int FLAGS_IN_PROBABILITY_FILE_SIZE;
static const int TERMINAL_ADDRESS_TABLE_ADDRESS_SIZE; static const int TERMINAL_ADDRESS_TABLE_ADDRESS_SIZE;