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);
20 // Row must manage "disk-based" polymorphism. All other polymorphism is
21 // dealt with in the normal manner.
22 static class Serializer implements RAFListSerializer<Row> {
24 final Dictionary.Index index;
26 Serializer(final Dictionary.Index index) {
31 public Row read(RandomAccessFile raf, final int listIndex) throws IOException {
32 final byte rowType = raf.readByte();
34 return new PairEntry.Row(raf, listIndex, index);
35 } else if (rowType == 1) {
36 return new TokenRow(raf, listIndex, index);
38 throw new RuntimeException("Invalid rowType:" + rowType);
42 public void write(RandomAccessFile raf, Row t) throws IOException {
43 if (t instanceof PairEntry.Row) {
45 } else if (t instanceof TokenRow) {