Merge "Some more obvious optimizations" into jb-dev
This commit is contained in:
commit
f184e73dd7
1 changed files with 3 additions and 3 deletions
|
@ -507,21 +507,21 @@ public class FusionDictionary implements Iterable<Word> {
|
||||||
*/
|
*/
|
||||||
public static CharGroup findWordInTree(Node node, final String s) {
|
public static CharGroup findWordInTree(Node node, final String s) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
final StringBuilder checker = new StringBuilder();
|
final StringBuilder checker = DBG ? new StringBuilder() : null;
|
||||||
|
|
||||||
CharGroup currentGroup;
|
CharGroup currentGroup;
|
||||||
do {
|
do {
|
||||||
int indexOfGroup = findIndexOfChar(node, s.codePointAt(index));
|
int indexOfGroup = findIndexOfChar(node, s.codePointAt(index));
|
||||||
if (CHARACTER_NOT_FOUND == indexOfGroup) return null;
|
if (CHARACTER_NOT_FOUND == indexOfGroup) return null;
|
||||||
currentGroup = node.mData.get(indexOfGroup);
|
currentGroup = node.mData.get(indexOfGroup);
|
||||||
checker.append(new String(currentGroup.mChars, 0, currentGroup.mChars.length));
|
if (DBG) checker.append(new String(currentGroup.mChars, 0, currentGroup.mChars.length));
|
||||||
index += currentGroup.mChars.length;
|
index += currentGroup.mChars.length;
|
||||||
if (index < s.length()) {
|
if (index < s.length()) {
|
||||||
node = currentGroup.mChildren;
|
node = currentGroup.mChildren;
|
||||||
}
|
}
|
||||||
} while (null != node && index < s.length());
|
} while (null != node && index < s.length());
|
||||||
|
|
||||||
if (!s.equals(checker.toString())) return null;
|
if (DBG && !s.equals(checker.toString())) return null;
|
||||||
return currentGroup;
|
return currentGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue