am 34ab0384: Merge "Stop new BigramDictionary."

* commit '34ab0384148205a21a9e7c8c775e097fa8a25662':
  Stop new BigramDictionary.
main
Keisuke Kuroyanagi 2014-03-11 02:39:55 -07:00 committed by Android Git Automerger
commit 022d0414a9
2 changed files with 4 additions and 5 deletions

View File

@ -37,7 +37,7 @@ const int Dictionary::HEADER_ATTRIBUTE_BUFFER_SIZE = 32;
Dictionary::Dictionary(JNIEnv *env, DictionaryStructureWithBufferPolicy::StructurePolicyPtr Dictionary::Dictionary(JNIEnv *env, DictionaryStructureWithBufferPolicy::StructurePolicyPtr
dictionaryStructureWithBufferPolicy) dictionaryStructureWithBufferPolicy)
: mDictionaryStructureWithBufferPolicy(std::move(dictionaryStructureWithBufferPolicy)), : mDictionaryStructureWithBufferPolicy(std::move(dictionaryStructureWithBufferPolicy)),
mBigramDictionary(new BigramDictionary(mDictionaryStructureWithBufferPolicy.get())), mBigramDictionary(mDictionaryStructureWithBufferPolicy.get()),
mGestureSuggest(new Suggest(GestureSuggestPolicyFactory::getGestureSuggestPolicy())), mGestureSuggest(new Suggest(GestureSuggestPolicyFactory::getGestureSuggestPolicy())),
mTypingSuggest(new Suggest(TypingSuggestPolicyFactory::getTypingSuggestPolicy())) { mTypingSuggest(new Suggest(TypingSuggestPolicyFactory::getTypingSuggestPolicy())) {
logDictionaryInfo(env); logDictionaryInfo(env);
@ -78,7 +78,7 @@ void Dictionary::getPredictions(const int *word, int length,
SuggestionResults *const outSuggestionResults) const { SuggestionResults *const outSuggestionResults) const {
TimeKeeper::setCurrentTime(); TimeKeeper::setCurrentTime();
if (length <= 0) return; if (length <= 0) return;
mBigramDictionary->getPredictions(word, length, outSuggestionResults); mBigramDictionary.getPredictions(word, length, outSuggestionResults);
} }
int Dictionary::getProbability(const int *word, int length) const { int Dictionary::getProbability(const int *word, int length) const {
@ -94,7 +94,7 @@ int Dictionary::getProbability(const int *word, int length) const {
int Dictionary::getBigramProbability(const int *word0, int length0, const int *word1, int Dictionary::getBigramProbability(const int *word0, int length0, const int *word1,
int length1) const { int length1) const {
TimeKeeper::setCurrentTime(); TimeKeeper::setCurrentTime();
return mBigramDictionary->getBigramProbability(word0, length0, word1, length1); return mBigramDictionary.getBigramProbability(word0, length0, word1, length1);
} }
void Dictionary::addUnigramWord(const int *const word, const int length, const int probability, void Dictionary::addUnigramWord(const int *const word, const int length, const int probability,

View File

@ -109,14 +109,13 @@ class Dictionary {
private: private:
DISALLOW_IMPLICIT_CONSTRUCTORS(Dictionary); DISALLOW_IMPLICIT_CONSTRUCTORS(Dictionary);
typedef std::unique_ptr<BigramDictionary> BigramDictionaryPtr;
typedef std::unique_ptr<SuggestInterface> SuggestInterfacePtr; typedef std::unique_ptr<SuggestInterface> SuggestInterfacePtr;
static const int HEADER_ATTRIBUTE_BUFFER_SIZE; static const int HEADER_ATTRIBUTE_BUFFER_SIZE;
const DictionaryStructureWithBufferPolicy::StructurePolicyPtr const DictionaryStructureWithBufferPolicy::StructurePolicyPtr
mDictionaryStructureWithBufferPolicy; mDictionaryStructureWithBufferPolicy;
const BigramDictionaryPtr mBigramDictionary; const BigramDictionary mBigramDictionary;
const SuggestInterfacePtr mGestureSuggest; const SuggestInterfacePtr mGestureSuggest;
const SuggestInterfacePtr mTypingSuggest; const SuggestInterfacePtr mTypingSuggest;