1 package com.hughes.android.dictionary.engine;
3 import java.io.IOException;
4 import java.io.PrintStream;
5 import java.io.RandomAccessFile;
7 import com.hughes.util.raf.RAFSerializable;
8 import com.hughes.util.raf.RAFSerializer;
10 public class TextEntry extends AbstractEntry implements RAFSerializable<TextEntry> {
14 public TextEntry(final RandomAccessFile raf) throws IOException {
18 public void write(RandomAccessFile raf) throws IOException {
22 static final RAFSerializer<TextEntry> SERIALIZER = new RAFSerializer<TextEntry>() {
24 public TextEntry read(RandomAccessFile raf) throws IOException {
25 return new TextEntry(raf);
29 public void write(RandomAccessFile raf, TextEntry t) throws IOException {
35 public int addToDictionary(final Dictionary dictionary) {
36 dictionary.textEntries.add(this);
37 return dictionary.textEntries.size() - 1;
40 public static class Row extends RowBase {
42 Row(final RandomAccessFile raf, final int thisRowIndex,
43 final Index index) throws IOException {
44 super(raf, thisRowIndex, index);
47 public TextEntry getEntry() {
48 return index.dict.textEntries.get(referenceIndex);
52 public void print(PrintStream out) {
53 out.println(" " + getEntry().text);
57 public String getRawText(boolean compact) {
58 return getEntry().text;