// Path: src/com/hughes/android/dictionary/DictionaryInfo.java
// public class DictionaryInfo implements Serializable {
// 
//     private static final long serialVersionUID = -6850863377577700388L;
// 
//     public static final class IndexInfo implements Serializable {
//         private static final long serialVersionUID = 6524751236198309438L;
// 
//         static final int NUM_CSV_FIELDS = 3;
// 
//         public final String shortName; // Often LangISO.
//         final int allTokenCount;
//         public final int mainTokenCount;
// 
//         public IndexInfo(String shortName, int allTokenCount, int mainTokenCount) {
//             this.shortName = shortName;
//             this.allTokenCount = allTokenCount;
//             this.mainTokenCount = mainTokenCount;
//         }
// 
//         void append(StringBuilder result) {
//             result.append(shortName);
//             result.append("\t").append(allTokenCount);
//             result.append("\t").append(mainTokenCount);
//         }
// 
//         public IndexInfo(final String[] fields, int i) {
//             shortName = fields[i++];
//             allTokenCount = Integer.parseInt(fields[i++]);
//             mainTokenCount = Integer.parseInt(fields[i++]);
//         }
//     }
// 
//     // Stuff populated from the text file.
//     public String uncompressedFilename; // used as a key throughout the program.
//     public String downloadUrl;
//     public long uncompressedBytes;
//     public long zipBytes;
//     public long creationMillis;
//     public final ArrayList<IndexInfo> indexInfos = new ArrayList<>();
//     public String dictInfo;
// 
//     public DictionaryInfo() {
//         // Blank object.
//     }
// 
//     public boolean isValid() {
//         return !indexInfos.isEmpty();
//     }
// 
//     public StringBuilder append(final StringBuilder result) {
//         result.append(uncompressedFilename);
//         result.append("\t").append(downloadUrl);
//         result.append("\t").append(creationMillis);
//         result.append("\t").append(uncompressedBytes);
//         result.append("\t").append(zipBytes);
//         result.append("\t").append(indexInfos.size());
//         for (final IndexInfo indexInfo : indexInfos) {
//             indexInfo.append(result.append("\t"));
//         }
//         result.append("\t").append(dictInfo.replace("\n", "\\\\n"));
//         return result;
//     }
// 
//     public DictionaryInfo(final String line) {
//         final String[] fields = line.split("\t");
//         int i = 0;
//         uncompressedFilename = fields[i++];
//         downloadUrl = fields[i++];
//         creationMillis = Long.parseLong(fields[i++]);
//         uncompressedBytes = Long.parseLong(fields[i++]);
//         zipBytes = Long.parseLong(fields[i++]);
//         final int size = Integer.parseInt(fields[i++]);
//         indexInfos.ensureCapacity(size);
//         for (int j = 0; j < size; ++j) {
//             indexInfos.add(new IndexInfo(fields, i));
//             i += IndexInfo.NUM_CSV_FIELDS;
//         }
//         dictInfo = fields[i++].replace("\\\\n", "\n");
//     }
// 
//     @Override
//     public String toString() {
//         return uncompressedFilename;
//     }
// 
// }


import com.hughes.util.DataInputBuffer;
import com.hughes.util.raf.RAFList;
import com.hughes.util.raf.RAFListSerializer;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.io.RandomAccessFile;
import java.nio.BufferUnderflowException;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.hughes.android.dictionary.DictionaryInfo;
import com.hughes.util.CachingList;
        public void write(DataOutput raf, Index t) throws IOException {
            t.write(raf);
        }
    }

    final RAFListSerializer<HtmlEntry> htmlEntryIndexSerializer = new RAFListSerializer<HtmlEntry>() {
        @Override
        public void write(DataOutput raf, HtmlEntry t) {
            assert false;
        }

        @Override
        public HtmlEntry read(DataInput raf, int readIndex) throws IOException {
            return htmlEntries.get(raf.readInt());
        }
    };

    public void print(final PrintStream out) {
        out.println("dictInfo=" + dictInfo);
        for (final EntrySource entrySource : sources) {
            out.printf("EntrySource: %s %d\n", entrySource.name, entrySource.numEntries);
        }
        out.println();
        for (final Index index : indices) {
            out.printf("Index: %s %s\n", index.shortName, index.longName);
            index.print(out);
            out.println();
        }
    }

// Path: src/com/hughes/android/dictionary/DictionaryInfo.java
// public class DictionaryInfo implements Serializable {
// 
//     private static final long serialVersionUID = -6850863377577700388L;
// 
//     public static final class IndexInfo implements Serializable {
//         private static final long serialVersionUID = 6524751236198309438L;
// 
//         static final int NUM_CSV_FIELDS = 3;
// 
//         public final String shortName; // Often LangISO.
//         final int allTokenCount;
//         public final int mainTokenCount;
// 
//         public IndexInfo(String shortName, int allTokenCount, int mainTokenCount) {
//             this.shortName = shortName;
//             this.allTokenCount = allTokenCount;
//             this.mainTokenCount = mainTokenCount;
//         }
// 
//         void append(StringBuilder result) {
//             result.append(shortName);
//             result.append("\t").append(allTokenCount);
//             result.append("\t").append(mainTokenCount);
//         }
// 
//         public IndexInfo(final String[] fields, int i) {
//             shortName = fields[i++];
//             allTokenCount = Integer.parseInt(fields[i++]);
//             mainTokenCount = Integer.parseInt(fields[i++]);
//         }
//     }
// 
//     // Stuff populated from the text file.
//     public String uncompressedFilename; // used as a key throughout the program.
//     public String downloadUrl;
//     public long uncompressedBytes;
//     public long zipBytes;
//     public long creationMillis;
//     public final ArrayList<IndexInfo> indexInfos = new ArrayList<>();
//     public String dictInfo;
// 
//     public DictionaryInfo() {
//         // Blank object.
//     }
// 
//     public boolean isValid() {
//         return !indexInfos.isEmpty();
//     }
// 
//     public StringBuilder append(final StringBuilder result) {
//         result.append(uncompressedFilename);
//         result.append("\t").append(downloadUrl);
//         result.append("\t").append(creationMillis);
//         result.append("\t").append(uncompressedBytes);
//         result.append("\t").append(zipBytes);
//         result.append("\t").append(indexInfos.size());
//         for (final IndexInfo indexInfo : indexInfos) {
//             indexInfo.append(result.append("\t"));
//         }
//         result.append("\t").append(dictInfo.replace("\n", "\\\\n"));
//         return result;
//     }
// 
//     public DictionaryInfo(final String line) {
//         final String[] fields = line.split("\t");
//         int i = 0;
//         uncompressedFilename = fields[i++];
//         downloadUrl = fields[i++];
//         creationMillis = Long.parseLong(fields[i++]);
//         uncompressedBytes = Long.parseLong(fields[i++]);
//         zipBytes = Long.parseLong(fields[i++]);
//         final int size = Integer.parseInt(fields[i++]);
//         indexInfos.ensureCapacity(size);
//         for (int j = 0; j < size; ++j) {
//             indexInfos.add(new IndexInfo(fields, i));
//             i += IndexInfo.NUM_CSV_FIELDS;
//         }
//         dictInfo = fields[i++].replace("\\\\n", "\n");
//     }
// 
//     @Override
//     public String toString() {
//         return uncompressedFilename;
//     }
// 
// }


// Path: src/com/hughes/android/dictionary/engine/Dictionary.java
import com.hughes.util.DataInputBuffer;
import com.hughes.util.raf.RAFList;
import com.hughes.util.raf.RAFListSerializer;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.io.RandomAccessFile;
import java.nio.BufferUnderflowException;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.hughes.android.dictionary.DictionaryInfo;
import com.hughes.util.CachingList;

        public void write(DataOutput raf, Index t) throws IOException {
            t.write(raf);
        }
    }

    final RAFListSerializer<HtmlEntry> htmlEntryIndexSerializer = new RAFListSerializer<HtmlEntry>() {
        @Override
        public void write(DataOutput raf, HtmlEntry t) {
            assert false;
        }

        @Override
        public HtmlEntry read(DataInput raf, int readIndex) throws IOException {
            return htmlEntries.get(raf.readInt());
        }
    };

    public void print(final PrintStream out) {
        out.println("dictInfo=" + dictInfo);
        for (final EntrySource entrySource : sources) {
            out.printf("EntrySource: %s %d\n", entrySource.name, entrySource.numEntries);
        }
        out.println();
        for (final Index index : indices) {
            out.printf("Index: %s %s\n", index.shortName, index.longName);
            index.print(out);
            out.println();
        }
    }

    public DictionaryInfo getDictionaryInfo() {