From: thadh Date: Mon, 16 Feb 2009 19:04:06 +0000 (-0800) Subject: go X-Git-Url: http://gitweb.fperrin.net/?a=commitdiff_plain;h=02e472d515152911bd15b8a3b88923854322941b;p=DictionaryPC.git go --- diff --git a/src/com/hughes/android/dictionary/IndexBuilder.java b/src/com/hughes/android/dictionary/IndexBuilder.java index 6e7eca7..13dc1db 100755 --- a/src/com/hughes/android/dictionary/IndexBuilder.java +++ b/src/com/hughes/android/dictionary/IndexBuilder.java @@ -36,7 +36,7 @@ public class IndexBuilder { rootBuilder.forEachNode(new Function() { @Override public void invoke(final Node node) { - for (final List entryDescriptors : node.entries.values()) { + for (final List entryDescriptors : node.entryDescriptorsMap.values()) { Collections.sort(entryDescriptors); } }}); @@ -78,7 +78,7 @@ public class IndexBuilder { final String normalizedWord; final TreeMap children = new TreeMap(); - final TreeMap> entries = new TreeMap>(); + final TreeMap> entryDescriptorsMap = new TreeMap>(); // final List offsets = new ArrayList(); @@ -198,7 +198,7 @@ public class IndexBuilder { @Override public String toString() { - return normalizedWord + ":" + offsets.size(); + return normalizedWord; } void dump(final RandomAccessFile file) throws IOException { @@ -215,9 +215,12 @@ public class IndexBuilder { file.writeInt(child.getValue().indexFileLocation); } - // Offsets. - file.writeInt(offsets.size()); - for (int i = 0; i < offsets.size(); i++) { + // Entries. + file.writeInt(entryDescriptorsMap.size()); + for (final Map.Entry> entry : entryDescriptorsMap.entrySet()) { + file.writeUTF(entry.getKey()); + file.writeInt(entry.getValue().size()); + file.writeInt(offsets.get(i).offset); }