From 2aa02b84a4fcfaf5554c278d2b25cf9414eecf8b Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Thu, 22 Mar 2012 02:40:45 +0900 Subject: [PATCH] Revive the Makefile for makedict Follow up to I4d2ef504. Address a compiler warning and a small optimization as well. bug: 6188977 bug: 6209651 Change-Id: Ibc9da51d48ebf0b8815ad0bb2f697242970ba8f7 --- .../latin/makedict/FusionDictionary.java | 12 ++------ tools/makedict/Android.mk | 29 ++++++++++--------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java b/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java index d19672181..e88ab685a 100644 --- a/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java +++ b/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java @@ -21,7 +21,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.LinkedList; -import java.util.List; /** * A dictionary that can fusion heads and tails of words for more compression. @@ -400,16 +399,11 @@ public class FusionDictionary implements Iterable { * is ignored. * This comparator imposes orderings that are inconsistent with equals. */ - static private class CharGroupComparator implements java.util.Comparator { - public int compare(Object o1, Object o2) { - final CharGroup c1 = (CharGroup)o1; - final CharGroup c2 = (CharGroup)o2; + static private class CharGroupComparator implements java.util.Comparator { + public int compare(CharGroup c1, CharGroup c2) { if (c1.mChars[0] == c2.mChars[0]) return 0; return c1.mChars[0] < c2.mChars[0] ? -1 : 1; } - public boolean equals(Object o) { - return o instanceof CharGroupComparator; - } } final static private CharGroupComparator CHARGROUP_COMPARATOR = new CharGroupComparator(); @@ -417,7 +411,7 @@ public class FusionDictionary implements Iterable { * Finds the insertion index of a character within a node. */ private static int findInsertionIndex(final Node node, int character) { - final List data = node.mData; + final ArrayList data = node.mData; final CharGroup reference = new CharGroup(new int[] { character }, null, null, 0, false /* isShortcutOnly */); int result = Collections.binarySearch(data, reference, CHARGROUP_COMPARATOR); diff --git a/tools/makedict/Android.mk b/tools/makedict/Android.mk index facbbf7b8..dcfad19f0 100644 --- a/tools/makedict/Android.mk +++ b/tools/makedict/Android.mk @@ -12,16 +12,19 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -#LOCAL_PATH := $(call my-dir) -#include $(CLEAR_VARS) -# -#LOCAL_SRC_FILES := $(call all-java-files-under,src) -#LOCAL_SRC_FILES += $(call all-java-files-under,tests) -#LOCAL_JAR_MANIFEST := etc/manifest.txt -#LOCAL_MODULE_TAGS := eng -#LOCAL_MODULE := makedict -#LOCAL_JAVA_LIBRARIES := junit -# -#include $(BUILD_HOST_JAVA_LIBRARY) -#include $(LOCAL_PATH)/etc/Android.mk + +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +MAKEDICT_CORE_SOURCE_DIRECTORY := ../../java/src/com/android/inputmethod/latin/makedict + +LOCAL_SRC_FILES := $(call all-java-files-under,$(MAKEDICT_CORE_SOURCE_DIRECTORY)) +LOCAL_SRC_FILES += $(call all-java-files-under,src) +LOCAL_SRC_FILES += $(call all-java-files-under,tests) +LOCAL_JAR_MANIFEST := etc/manifest.txt +LOCAL_MODULE_TAGS := eng +LOCAL_MODULE := makedict +LOCAL_JAVA_LIBRARIES := junit + +include $(BUILD_HOST_JAVA_LIBRARY) +include $(LOCAL_PATH)/etc/Android.mk