aboutsummaryrefslogtreecommitdiffstats
path: root/native/src/words_priority_queue_pool.h
diff options
context:
space:
mode:
authorsatok <satok@google.com>2012-01-23 16:52:37 +0900
committersatok <satok@google.com>2012-01-25 22:30:37 +0900
commit8330b488e9534afe8f5775ad9416c904d01bb665 (patch)
treea15199bc0aecd0a46f2a9f2e2f0aa1a491ad18d4 /native/src/words_priority_queue_pool.h
parentf9521c6f378e3f2aa13d9e382ae13708e3ae6317 (diff)
downloadlatinime-8330b488e9534afe8f5775ad9416c904d01bb665.tar.gz
latinime-8330b488e9534afe8f5775ad9416c904d01bb665.tar.xz
latinime-8330b488e9534afe8f5775ad9416c904d01bb665.zip
Do other error correction for the second word of two word correction
result: I4e0b68a12190933f9 Change-Id: I98afce6fe4d5bde97392146d204370ba31a72566
Diffstat (limited to 'native/src/words_priority_queue_pool.h')
-rw-r--r--native/src/words_priority_queue_pool.h26
1 files changed, 22 insertions, 4 deletions
diff --git a/native/src/words_priority_queue_pool.h b/native/src/words_priority_queue_pool.h
index 5fa254852..599b89711 100644
--- a/native/src/words_priority_queue_pool.h
+++ b/native/src/words_priority_queue_pool.h
@@ -45,15 +45,21 @@ class WordsPriorityQueuePool {
// TODO: Come up with more generic pool
WordsPriorityQueue* getSubQueue1(const int id) {
- if (DEBUG_WORDS_PRIORITY_QUEUE) {
- assert(id >= 0 && id < SUB_QUEUE_MAX_COUNT);
+ if (id < 0 || id >= SUB_QUEUE_MAX_COUNT) {
+ if (DEBUG_WORDS_PRIORITY_QUEUE) {
+ assert(false);
+ }
+ return 0;
}
return mSubQueues1[id];
}
WordsPriorityQueue* getSubQueue2(const int id) {
- if (DEBUG_WORDS_PRIORITY_QUEUE) {
- assert(id >= 0 && id < SUB_QUEUE_MAX_COUNT);
+ if (id < 0 || id >= SUB_QUEUE_MAX_COUNT) {
+ if (DEBUG_WORDS_PRIORITY_QUEUE) {
+ assert(false);
+ }
+ return 0;
}
return mSubQueues2[id];
}
@@ -66,6 +72,18 @@ class WordsPriorityQueuePool {
}
}
+ inline void clearSubQueue1() {
+ for (int i = 0; i < SUB_QUEUE_MAX_COUNT; ++i) {
+ mSubQueues1[i]->clear();
+ }
+ }
+
+ inline void clearSubQueue2() {
+ for (int i = 0; i < SUB_QUEUE_MAX_COUNT; ++i) {
+ mSubQueues2[i]->clear();
+ }
+ }
+
void dumpSubQueue1TopSuggestions() {
AKLOGI("DUMP SUBQUEUE1 TOP SUGGESTIONS");
for (int i = 0; i < SUB_QUEUE_MAX_COUNT; ++i) {