diff options
author | Peng Wu <alexepico@gmail.com> | 2016-03-15 13:14:51 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2016-03-15 13:14:51 +0800 |
commit | 8f3603807183cbe4c05f5f3d926c809698aacb9d (patch) | |
tree | 7cc5b82ea83e5b2a231cd92b9fb943bc19d6b725 /src/storage/chewing_large_table2_bdb.cpp | |
parent | aedbe291325b62efee3307699107c9594e23d394 (diff) | |
download | libpinyin-8f3603807183cbe4c05f5f3d926c809698aacb9d.tar.gz libpinyin-8f3603807183cbe4c05f5f3d926c809698aacb9d.tar.xz libpinyin-8f3603807183cbe4c05f5f3d926c809698aacb9d.zip |
refactor code
Diffstat (limited to 'src/storage/chewing_large_table2_bdb.cpp')
-rw-r--r-- | src/storage/chewing_large_table2_bdb.cpp | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/src/storage/chewing_large_table2_bdb.cpp b/src/storage/chewing_large_table2_bdb.cpp index 2ecfced..1c7c97b 100644 --- a/src/storage/chewing_large_table2_bdb.cpp +++ b/src/storage/chewing_large_table2_bdb.cpp @@ -204,23 +204,6 @@ int ChewingLargeTable2::search_internal(int phrase_length, return SEARCH_NONE; } -/* search method */ -int ChewingLargeTable2::search(int phrase_length, - /* in */ const ChewingKey keys[], - /* out */ PhraseIndexRanges ranges) const { - ChewingKey index[MAX_PHRASE_LENGTH]; - assert(NULL != m_db); - - if (contains_incomplete_pinyin(keys, phrase_length)) { - compute_incomplete_chewing_index(keys, index, phrase_length); - return search_internal(phrase_length, index, keys, ranges); - } else { - compute_chewing_index(keys, index, phrase_length); - return search_internal(phrase_length, index, keys, ranges); - } - - return SEARCH_NONE; -} template<int phrase_length> int ChewingLargeTable2::add_index_internal(/* in */ const ChewingKey index[], @@ -328,27 +311,6 @@ int ChewingLargeTable2::add_index_internal(int phrase_length, return ERROR_FILE_CORRUPTION; } -/* add/remove index method */ -int ChewingLargeTable2::add_index(int phrase_length, - /* in */ const ChewingKey keys[], - /* in */ phrase_token_t token) { - ChewingKey index[MAX_PHRASE_LENGTH]; - assert(NULL != m_db); - int result = ERROR_OK; - - /* for in-complete chewing index */ - compute_incomplete_chewing_index(keys, index, phrase_length); - result = add_index_internal(phrase_length, index, keys, token); - assert(ERROR_OK == result || ERROR_INSERT_ITEM_EXISTS == result); - if (ERROR_OK != result) - return result; - - /* for chewing index */ - compute_chewing_index(keys, index, phrase_length); - result = add_index_internal(phrase_length, index, keys, token); - assert(ERROR_OK == result || ERROR_INSERT_ITEM_EXISTS == result); - return result; -} template<int phrase_length> int ChewingLargeTable2::remove_index_internal(/* in */ const ChewingKey index[], @@ -423,27 +385,6 @@ int ChewingLargeTable2::remove_index_internal(int phrase_length, return ERROR_FILE_CORRUPTION; } -int ChewingLargeTable2::remove_index(int phrase_length, - /* in */ const ChewingKey keys[], - /* in */ phrase_token_t token) { - ChewingKey index[MAX_PHRASE_LENGTH]; - assert(NULL != m_db); - int result = ERROR_OK; - - /* for in-complete chewing index */ - compute_incomplete_chewing_index(keys, index, phrase_length); - result = remove_index_internal(phrase_length, index, keys, token); - assert(ERROR_OK == result || ERROR_REMOVE_ITEM_DONOT_EXISTS == result); - if (ERROR_OK != result) - return result; - - /* for chewing index */ - compute_chewing_index(keys, index, phrase_length); - result = remove_index_internal(phrase_length, index, keys, token); - assert(ERROR_OK == result || ERROR_REMOVE_ITEM_DONOT_EXISTS == result); - return result; -} - /* mask out method */ /* assume it is in-memory dbm. */ bool ChewingLargeTable2::mask_out(phrase_token_t mask, |