aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-01-15 19:24:35 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2012-01-15 19:24:35 -0800
commit1eece82fe5cd368c59a011dc84a351befe01810f (patch)
tree8b34aec9d60b014b954a88bdba387f833d7183fe
parent2f7952c58ec68b0bc867e29873d02c95675a8865 (diff)
parenteddfbb68dcff55c85b3d5b82d406f543bd038825 (diff)
downloadlatinime-1eece82fe5cd368c59a011dc84a351befe01810f.tar.gz
latinime-1eece82fe5cd368c59a011dc84a351befe01810f.tar.xz
latinime-1eece82fe5cd368c59a011dc84a351befe01810f.zip
am eddfbb68: Add a helper method
* commit 'eddfbb68dcff55c85b3d5b82d406f543bd038825': Add a helper method
-rw-r--r--tools/makedict/src/com/android/inputmethod/latin/FusionDictionary.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/makedict/src/com/android/inputmethod/latin/FusionDictionary.java b/tools/makedict/src/com/android/inputmethod/latin/FusionDictionary.java
index 2327e1972..3ab206d80 100644
--- a/tools/makedict/src/com/android/inputmethod/latin/FusionDictionary.java
+++ b/tools/makedict/src/com/android/inputmethod/latin/FusionDictionary.java
@@ -435,6 +435,16 @@ public class FusionDictionary implements Iterable<Word> {
}
/**
+ * Helper method to find out whether a word is in the dict or not.
+ */
+ public boolean hasWord(final String s) {
+ if (null == s || "".equals(s)) {
+ throw new RuntimeException("Can't search for a null or empty string");
+ }
+ return null != findWordInTree(mRoot, s);
+ }
+
+ /**
* Recursively count the number of character groups in a given branch of the trie.
*
* @param node the parent node.