aboutsummaryrefslogtreecommitdiffstats
path: root/native/src/words_priority_queue_pool.h
diff options
context:
space:
mode:
authorsatok <satok@google.com>2012-01-25 05:48:15 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-01-25 05:48:15 -0800
commit61b31a646ea5c65f55891354dfd0485cbbcbc997 (patch)
treeffa112b9635296bc6df1d044424cb6e6940c1e56 /native/src/words_priority_queue_pool.h
parent09f8b126e532ca2ac6bbe00c0d78bf03e44b78a2 (diff)
parent8330b488e9534afe8f5775ad9416c904d01bb665 (diff)
downloadlatinime-61b31a646ea5c65f55891354dfd0485cbbcbc997.tar.gz
latinime-61b31a646ea5c65f55891354dfd0485cbbcbc997.tar.xz
latinime-61b31a646ea5c65f55891354dfd0485cbbcbc997.zip
Merge "Do other error correction for the second word of two word correction"
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) {