Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 86fe8081 authored by Keisuke Kuroyanagi's avatar Keisuke Kuroyanagi Committed by Android (Google) Code Review
Browse files

Merge "Add removeUnigramEntry() to native dictionary policy."

parents 447c1936 f1298524
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -99,6 +99,11 @@ bool Dictionary::addUnigramEntry(const int *const word, const int length,
    return mDictionaryStructureWithBufferPolicy->addUnigramEntry(word, length, unigramProperty);
}

bool Dictionary::removeUnigramEntry(const int *const codePoints, const int codePointCount) {
    TimeKeeper::setCurrentTime();
    return mDictionaryStructureWithBufferPolicy->removeUnigramEntry(codePoints, codePointCount);
}

bool Dictionary::addNgramEntry(const PrevWordsInfo *const prevWordsInfo,
        const BigramProperty *const bigramProperty) {
    TimeKeeper::setCurrentTime();
+2 −0
Original line number Diff line number Diff line
@@ -81,6 +81,8 @@ class Dictionary {
    bool addUnigramEntry(const int *const codePoints, const int codePointCount,
            const UnigramProperty *const unigramProperty);

    bool removeUnigramEntry(const int *const codePoints, const int codePointCount);

    bool addNgramEntry(const PrevWordsInfo *const prevWordsInfo,
            const BigramProperty *const bigramProperty);

+3 −0
Original line number Diff line number Diff line
@@ -73,6 +73,9 @@ class DictionaryStructureWithBufferPolicy {
    virtual bool addUnigramEntry(const int *const word, const int length,
            const UnigramProperty *const unigramProperty) = 0;

    // Returns whether the update was success or not.
    virtual bool removeUnigramEntry(const int *const word, const int length) = 0;

    // Returns whether the update was success or not.
    virtual bool addNgramEntry(const PrevWordsInfo *const prevWordsInfo,
            const BigramProperty *const bigramProperty) = 0;
+5 −0
Original line number Diff line number Diff line
@@ -111,6 +111,11 @@ class Ver4PatriciaTriePolicy : public DictionaryStructureWithBufferPolicy {
    bool addUnigramEntry(const int *const word, const int length,
            const UnigramProperty *const unigramProperty);

    bool removeUnigramEntry(const int *const word, const int length) {
        // Removing unigram entry is not supported.
        return false;
    }

    bool addNgramEntry(const PrevWordsInfo *const prevWordsInfo,
            const BigramProperty *const bigramProperty);

+6 −0
Original line number Diff line number Diff line
@@ -88,6 +88,12 @@ class PatriciaTriePolicy : public DictionaryStructureWithBufferPolicy {
        return false;
    }

    bool removeUnigramEntry(const int *const word, const int length) {
        // This method should not be called for non-updatable dictionary.
        AKLOGI("Warning: removeUnigramEntry() is called for non-updatable dictionary.");
        return false;
    }

    bool addNgramEntry(const PrevWordsInfo *const prevWordsInfo,
            const BigramProperty *const bigramProperty) {
        // This method should not be called for non-updatable dictionary.
Loading