Stop new BigramDictionary.

BigramDictionary is allocated inside of Dictionary.

Change-Id: If224b4c408403f43eb3d2e292c0e0ecb86429290
main
Keisuke Kuroyanagi 2014-03-06 20:12:47 +09:00
parent e137ec0a91
commit 66cc9dec55
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
dictionaryStructureWithBufferPolicy)
: mDictionaryStructureWithBufferPolicy(std::move(dictionaryStructureWithBufferPolicy)),
mBigramDictionary(new BigramDictionary(mDictionaryStructureWithBufferPolicy.get())),
mBigramDictionary(mDictionaryStructureWithBufferPolicy.get()),
mGestureSuggest(new Suggest(GestureSuggestPolicyFactory::getGestureSuggestPolicy())),
mTypingSuggest(new Suggest(TypingSuggestPolicyFactory::getTypingSuggestPolicy())) {
logDictionaryInfo(env);
@ -78,7 +78,7 @@ void Dictionary::getPredictions(const int *word, int length,
SuggestionResults *const outSuggestionResults) const {
TimeKeeper::setCurrentTime();
if (length <= 0) return;
mBigramDictionary->getPredictions(word, length, outSuggestionResults);
mBigramDictionary.getPredictions(word, length, outSuggestionResults);
}
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 length1) const {
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,

View File

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