// limitations under the License.
/**
- *
+ *
*/
package com.hughes.android.dictionary.engine;
*/
public synchronized Transliterator normalizer() {
if (normalizer == null) {
- normalizer = Transliterator
- .createFromRules("", normalizerRules, Transliterator.FORWARD);
+ normalizer = TransliteratorManager.get(normalizerRules);
}
return normalizer;
}
}
sortedIndexEntries = CachingList.create(
RAFList.create(raf, indexEntrySerializer, raf.getFilePointer(),
- dict.dictFileVersion), CACHE_SIZE);
+ dict.dictFileVersion, dict.dictInfo + " idx " + languageCode + ": "), CACHE_SIZE);
if (dict.dictFileVersion >= 7) {
int count = StringUtil.readVarInt(raf);
stoplist = new HashSet<String>(count);
};
public static final class IndexEntry implements RAFSerializable<Index.IndexEntry> {
- private final Index index;
public final String token;
private final String normalizedToken;
public final int startRow;
public final int numRows; // doesn't count the token row!
public List<HtmlEntry> htmlEntries;
- private int[] htmlEntryIndices;
public IndexEntry(final Index index, final String token, final String normalizedToken,
final int startRow, final int numRows) {
- this.index = index;
assert token.equals(token.trim());
assert token.length() > 0;
this.token = token;
}
public IndexEntry(final Index index, final DataInput raf) throws IOException {
- this.index = index;
token = raf.readUTF();
if (index.dict.dictFileVersion >= 7) {
startRow = StringUtil.readVarInt(raf);
}
final boolean hasNormalizedForm = raf.readBoolean();
normalizedToken = hasNormalizedForm ? raf.readUTF() : token;
- htmlEntryIndices = null;
if (index.dict.dictFileVersion >= 7) {
int size = StringUtil.readVarInt(raf);
- htmlEntryIndices = new int[size];
+ final int[] htmlEntryIndices = new int[size];
for (int i = 0; i < size; ++i) {
htmlEntryIndices[i] = StringUtil.readVarInt(raf);
}
} else if (index.dict.dictFileVersion >= 6) {
this.htmlEntries = CachingList.create(
RAFList.create((RandomAccessFile)raf, index.dict.htmlEntryIndexSerializer,
- ((RandomAccessFile)raf).getFilePointer(), index.dict.dictFileVersion), 1);
+ ((RandomAccessFile)raf).getFilePointer(), index.dict.dictFileVersion,
+ index.dict.dictInfo + " htmlEntries: "), 1);
} else {
this.htmlEntries = Collections.emptyList();
}
}
final IndexEntry midEntry = sortedIndexEntries.get(mid);
- int comp = NormalizeComparator.compareWithoutLeadingDash(token, midEntry.normalizedToken(), sortCollator, dict.dictFileVersion);
+ int comp = NormalizeComparator.compareWithoutDash(token, midEntry.normalizedToken(), sortCollator, dict.dictFileVersion);
if (comp == 0)
comp = sortCollator.compare(token, midEntry.normalizedToken());
if (comp == 0) {