From a72e8f1ede3dc11fb60bd1346e6c7cb07c5d126e Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Thu, 5 Dec 2013 18:02:20 +0900 Subject: [RF3] Cleanups Make the version number a single number on native and java side. Also, remove the hasValidContents method. It's useless since the native code already checks this when creating the dictionary (I wish I had known that when I added it). Bug: 11281748 Change-Id: I572d37429972b2f280e4bdb748b709e5d0d7737e --- .../inputmethod/latin/ExpandableBinaryDictionary.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java') diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java index 98a18f6d3..41661573d 100644 --- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java @@ -63,7 +63,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { */ protected static final int MAX_WORD_LENGTH = Constants.DICTIONARY_MAX_WORD_LENGTH; - private static final int DICTIONARY_FORMAT_VERSION = 4; + private static final int DICTIONARY_FORMAT_VERSION = FormatSpec.VERSION4; /** * A static map of update controllers, each of which records the time of accesses to a single @@ -139,8 +139,8 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { return formatVersion == 2; } - public boolean hasValidContents() { - return mBinaryDictionary.hasValidContents(); + public boolean isValidDictionary() { + return mBinaryDictionary.isValidDictionary(); } protected String getFileNameExtentionToOpenDict() { @@ -563,8 +563,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { loadDictionaryAsync(); mDictionaryWriter.write(mFilename, getHeaderAttributeMap()); } else { - if (mBinaryDictionary == null || !mBinaryDictionary.isValidDictionary() - || !hasValidContents() + if (mBinaryDictionary == null || !isValidDictionary() // TODO: remove the check below || !matchesExpectedBinaryDictFormatVersionForThisType( mBinaryDictionary.getFormatVersion())) { @@ -665,8 +664,7 @@ abstract public class ExpandableBinaryDictionary extends Dictionary { // load the shared dictionary. loadBinaryDictionary(); } - if (mBinaryDictionary != null && !(mBinaryDictionary.isValidDictionary() - && hasValidContents() + if (mBinaryDictionary != null && !(isValidDictionary() // TODO: remove the check below && matchesExpectedBinaryDictFormatVersionForThisType( mBinaryDictionary.getFormatVersion()))) { -- cgit v1.2.3-83-g751a