1 package com.hughes.android.dictionary.engine;
3 import java.io.IOException;
4 import java.io.RandomAccessFile;
5 import java.util.ArrayList;
8 import com.hughes.util.raf.RAFList;
9 import com.hughes.util.raf.RAFSerializer;
12 public class Dictionary {
15 final List<PairEntry> pairEntries;
18 final List<EntrySource> sources;
21 final List<Index> indices;
24 pairEntries = new ArrayList<PairEntry>();
25 sources = new ArrayList<EntrySource>();
26 indices = new ArrayList<Index>();
29 public Dictionary(final RandomAccessFile raf) throws IOException {
30 pairEntries = RAFList.create(raf, PairEntry.SERIALIZER, raf.getFilePointer());
31 sources = new ArrayList<EntrySource>();
33 final RAFSerializer<Index> indexSerializer = new RAFSerializer<Index>() {
36 public Index read(RandomAccessFile raf) throws IOException {
37 return new Index(Dictionary.this, raf);
41 public void write(RandomAccessFile raf, Index t) throws IOException {
45 indices = RAFList.create(raf, indexSerializer, raf.getFilePointer());