aboutsummaryrefslogtreecommitdiffstats
path: root/native/jni/src/suggest/policyimpl/dictionary/header/header_policy.cpp
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-01-30 18:15:35 +0900
committerJean Chalard <jchalard@google.com>2014-01-30 18:19:21 +0900
commita137c21c9cc45e28af9b72f72f99cefb9bf12a3d (patch)
tree6e620fe9338bd22ba44f13807c8bef20bfbccfc1 /native/jni/src/suggest/policyimpl/dictionary/header/header_policy.cpp
parent324adefca3f2608dcf1385dca31132c1f9dddf8f (diff)
downloadlatinime-a137c21c9cc45e28af9b72f72f99cefb9bf12a3d.tar.gz
latinime-a137c21c9cc45e28af9b72f72f99cefb9bf12a3d.tar.xz
latinime-a137c21c9cc45e28af9b72f72f99cefb9bf12a3d.zip
[HD02] Make the date header attribute mandatory.
Bug: 11281748 Change-Id: I48a6f3d95ca89ced0c51335527201ecabfb7998e
Diffstat (limited to 'native/jni/src/suggest/policyimpl/dictionary/header/header_policy.cpp')
-rw-r--r--native/jni/src/suggest/policyimpl/dictionary/header/header_policy.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/native/jni/src/suggest/policyimpl/dictionary/header/header_policy.cpp b/native/jni/src/suggest/policyimpl/dictionary/header/header_policy.cpp
index 37a5b3fe4..7504524f0 100644
--- a/native/jni/src/suggest/policyimpl/dictionary/header/header_policy.cpp
+++ b/native/jni/src/suggest/policyimpl/dictionary/header/header_policy.cpp
@@ -24,7 +24,7 @@ const char *const HeaderPolicy::REQUIRES_GERMAN_UMLAUT_PROCESSING_KEY =
"REQUIRES_GERMAN_UMLAUT_PROCESSING";
// TODO: Change attribute string to "IS_DECAYING_DICT".
const char *const HeaderPolicy::IS_DECAYING_DICT_KEY = "USES_FORGETTING_CURVE";
-const char *const HeaderPolicy::LAST_UPDATED_TIME_KEY = "date";
+const char *const HeaderPolicy::DATE_KEY = "date";
const char *const HeaderPolicy::LAST_DECAYED_TIME_KEY = "LAST_DECAYED_TIME";
const char *const HeaderPolicy::UNIGRAM_COUNT_KEY = "UNIGRAM_COUNT";
const char *const HeaderPolicy::BIGRAM_COUNT_KEY = "BIGRAM_COUNT";
@@ -73,13 +73,13 @@ bool HeaderPolicy::readRequiresGermanUmlautProcessing() const {
REQUIRES_GERMAN_UMLAUT_PROCESSING_KEY, false);
}
-bool HeaderPolicy::fillInAndWriteHeaderToBuffer(const bool updatesLastUpdatedTime,
- const bool updatesLastDecayedTime, const int unigramCount, const int bigramCount,
+bool HeaderPolicy::fillInAndWriteHeaderToBuffer(const bool updatesLastDecayedTime,
+ const int unigramCount, const int bigramCount,
const int extendedRegionSize, BufferWithExtendableBuffer *const outBuffer) const {
int writingPos = 0;
HeaderReadWriteUtils::AttributeMap attributeMapToWrite(mAttributeMap);
- fillInHeader(updatesLastDecayedTime, updatesLastDecayedTime,
- unigramCount, bigramCount, extendedRegionSize, &attributeMapToWrite);
+ fillInHeader(updatesLastDecayedTime, unigramCount, bigramCount,
+ extendedRegionSize, &attributeMapToWrite);
if (!HeaderReadWriteUtils::writeDictionaryVersion(outBuffer, mDictFormatVersion,
&writingPos)) {
return false;
@@ -106,18 +106,16 @@ bool HeaderPolicy::fillInAndWriteHeaderToBuffer(const bool updatesLastUpdatedTim
return true;
}
-void HeaderPolicy::fillInHeader(const bool updatesLastUpdatedTime,
- const bool updatesLastDecayedTime, const int unigramCount, const int bigramCount,
- const int extendedRegionSize, HeaderReadWriteUtils::AttributeMap *outAttributeMap) const {
+void HeaderPolicy::fillInHeader(const bool updatesLastDecayedTime, const int unigramCount,
+ const int bigramCount, const int extendedRegionSize,
+ HeaderReadWriteUtils::AttributeMap *outAttributeMap) const {
HeaderReadWriteUtils::setIntAttribute(outAttributeMap, UNIGRAM_COUNT_KEY, unigramCount);
HeaderReadWriteUtils::setIntAttribute(outAttributeMap, BIGRAM_COUNT_KEY, bigramCount);
HeaderReadWriteUtils::setIntAttribute(outAttributeMap, EXTENDED_REGION_SIZE_KEY,
extendedRegionSize);
- if (updatesLastUpdatedTime) {
- // Set current time as the last updated time.
- HeaderReadWriteUtils::setIntAttribute(outAttributeMap, LAST_UPDATED_TIME_KEY,
- TimeKeeper::peekCurrentTime());
- }
+ // Set the current time as the generation time.
+ HeaderReadWriteUtils::setIntAttribute(outAttributeMap, DATE_KEY,
+ TimeKeeper::peekCurrentTime());
if (updatesLastDecayedTime) {
// Set current time as the last updated time.
HeaderReadWriteUtils::setIntAttribute(outAttributeMap, LAST_DECAYED_TIME_KEY,