1 package com.hughes.android.dictionary.engine;
3 import java.io.IOException;
4 import java.io.RandomAccessFile;
6 import com.hughes.util.raf.RAFListSerializer;
10 public void write(RandomAccessFile raf) throws IOException;
13 * @return the TokenRow that this row is "filed under".
15 public TokenRow getTokenRow(final boolean search);
17 public void setTokenRow(final TokenRow tokenRow);
19 public Object draw(final String searchText);
22 // Row must manage "disk-based" polymorphism. All other polymorphism is
23 // dealt with in the normal manner.
24 static class Serializer implements RAFListSerializer<Row> {
28 Serializer(final Index index) {
33 public Row read(RandomAccessFile raf, final int listIndex) throws IOException {
34 final byte rowType = raf.readByte();
36 return new PairEntry.Row(raf, listIndex, index);
37 } else if (rowType == 1) {
38 return new TokenRow(raf, listIndex, index);
40 throw new RuntimeException("Invalid rowType:" + rowType);
44 public void write(RandomAccessFile raf, Row t) throws IOException {
45 if (t instanceof PairEntry.Row) {
47 } else if (t instanceof TokenRow) {