aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-05-15 11:37:51 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-05-15 11:37:51 -0700
commitbc740afba3478a6c447e8812895cee096510936b (patch)
treef8c9adbdd63c88315fe88a7cfbe6b9e001876e1a /java
parent47fedb89930c7450885040ab4192f29df8d1f252 (diff)
parentb1120fe79ac40717b2b91ba60608b2c9f735c368 (diff)
downloadlatinime-bc740afba3478a6c447e8812895cee096510936b.tar.gz
latinime-bc740afba3478a6c447e8812895cee096510936b.tar.xz
latinime-bc740afba3478a6c447e8812895cee096510936b.zip
am b1120fe7: Merge "Small optimizations" into jb-dev
* commit 'b1120fe79ac40717b2b91ba60608b2c9f735c368': Small optimizations
Diffstat (limited to 'java')
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
index bb1042324..522573d07 100644
--- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
+++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictInputOutput.java
@@ -40,6 +40,8 @@ import java.util.TreeMap;
*/
public class BinaryDictInputOutput {
+ final static boolean DBG = MakedictLog.DBG;
+
/* Node layout is as follows:
* | addressType xx : mask with MASK_GROUP_ADDRESS_TYPE
* 2 bits, 00 = no children : FLAG_GROUP_ADDRESS_TYPE_NOADDRESS
@@ -715,13 +717,13 @@ public class BinaryDictInputOutput {
}
}
if (null != group.mShortcutTargets) {
- if (0 == group.mShortcutTargets.size()) {
+ if (DBG && 0 == group.mShortcutTargets.size()) {
throw new RuntimeException("0-sized shortcut list must be null");
}
flags |= FLAG_HAS_SHORTCUT_TARGETS;
}
if (null != group.mBigrams) {
- if (0 == group.mBigrams.size()) {
+ if (DBG && 0 == group.mBigrams.size()) {
throw new RuntimeException("0-sized bigram list must be null");
}
flags |= FLAG_HAS_BIGRAMS;
@@ -830,7 +832,7 @@ public class BinaryDictInputOutput {
+ index + " <> " + group.mCachedAddress);
groupAddress += GROUP_FLAGS_SIZE + getGroupCharactersSize(group);
// Sanity checks.
- if (group.mFrequency > MAX_TERMINAL_FREQUENCY) {
+ if (DBG && group.mFrequency > MAX_TERMINAL_FREQUENCY) {
throw new RuntimeException("A node has a frequency > " + MAX_TERMINAL_FREQUENCY
+ " : " + group.mFrequency);
}
@@ -1037,7 +1039,7 @@ public class BinaryDictInputOutput {
MakedictLog.i("Computing addresses...");
computeAddresses(dict, flatNodes);
MakedictLog.i("Checking array...");
- checkFlatNodeArray(flatNodes);
+ if (DBG) checkFlatNodeArray(flatNodes);
// Create a buffer that matches the final dictionary size.
final Node lastNode = flatNodes.get(flatNodes.size() - 1);