X-Git-Url: http://gitweb.fperrin.net/?p=Dictionary.git;a=blobdiff_plain;f=src%2Fcom%2Fhughes%2Fandroid%2Fdictionary%2Fengine%2FDictionary.java;h=c378f8d6edee7e34ae6eff490f5a756c7e2dcdee;hp=0eb8007f07f9307fe0f44306e980d3f4f546d57b;hb=83d9dc7cd871082a82c2dd0dbb7a0ceabd7c83a0;hpb=2a89cb08c7c36c78b2276ddc8d77e470dfe7ec78 diff --git a/src/com/hughes/android/dictionary/engine/Dictionary.java b/src/com/hughes/android/dictionary/engine/Dictionary.java index 0eb8007..c378f8d 100644 --- a/src/com/hughes/android/dictionary/engine/Dictionary.java +++ b/src/com/hughes/android/dictionary/engine/Dictionary.java @@ -16,7 +16,6 @@ package com.hughes.android.dictionary.engine; import com.hughes.android.dictionary.DictionaryInfo; import com.hughes.util.CachingList; -import com.hughes.util.StringUtil; import com.hughes.util.raf.RAFList; import com.hughes.util.raf.RAFListSerializer; import com.hughes.util.raf.RAFSerializable; @@ -36,14 +35,14 @@ import java.util.List; public class Dictionary implements RAFSerializable { - static final int CACHE_SIZE = 5000; + private static final int CACHE_SIZE = 5000; - static final int CURRENT_DICT_VERSION = 7; - static final String END_OF_DICTIONARY = "END OF DICTIONARY"; + private static final int CURRENT_DICT_VERSION = 7; + private static final String END_OF_DICTIONARY = "END OF DICTIONARY"; // persisted final int dictFileVersion; - final long creationMillis; + private final long creationMillis; public final String dictInfo; public final List pairEntries; public final List textEntries; @@ -61,12 +60,12 @@ public class Dictionary implements RAFSerializable { this.dictFileVersion = CURRENT_DICT_VERSION; this.creationMillis = System.currentTimeMillis(); this.dictInfo = dictInfo; - pairEntries = new ArrayList(); - textEntries = new ArrayList(); - htmlEntries = new ArrayList(); + pairEntries = new ArrayList<>(); + textEntries = new ArrayList<>(); + htmlEntries = new ArrayList<>(); htmlData = null; - sources = new ArrayList(); - indices = new ArrayList(); + sources = new ArrayList<>(); + indices = new ArrayList<>(); } public Dictionary(final FileChannel ch) throws IOException { @@ -83,7 +82,7 @@ public class Dictionary implements RAFSerializable { try { final RAFList rafSources = RAFList.create(ch, new EntrySource.Serializer( this), ch.position(), dictFileVersion, dictInfo + " sources: "); - sources = new ArrayList(rafSources); + sources = new ArrayList<>(rafSources); ch.position(rafSources.getEndOffset()); pairEntries = CachingList.create( @@ -107,8 +106,7 @@ public class Dictionary implements RAFSerializable { indices = CachingList.createFullyCached(RAFList.create(ch, new IndexSerializer(ch), ch.position(), dictFileVersion, dictInfo + " index: ")); } catch (RuntimeException e) { - final IOException ioe = new IOException("RuntimeException loading dictionary", e); - throw ioe; + throw new IOException("RuntimeException loading dictionary", e); } final String end = raf.readUTF(); if (!end.equals(END_OF_DICTIONARY)) { @@ -142,7 +140,7 @@ public class Dictionary implements RAFSerializable { private final class IndexSerializer implements RAFListSerializer { private final FileChannel ch; - public IndexSerializer(FileChannel ch) { + IndexSerializer(FileChannel ch) { this.ch = ch; }