]> gitweb.fperrin.net Git - Dictionary.git/commitdiff
Added WholeSection entry type.
authorthadh <thadh@thadh-macbookpro>
Sat, 21 Jul 2012 17:42:25 +0000 (10:42 -0700)
committerthadh <thadh@thadh-macbookpro>
Sat, 21 Jul 2012 17:42:25 +0000 (10:42 -0700)
src/com/hughes/android/dictionary/engine/AbstractEntry.java
src/com/hughes/android/dictionary/engine/EntryTypeName.java
src/com/hughes/android/dictionary/engine/HtmlEntry.java
src/com/hughes/android/dictionary/engine/PairEntry.java
src/com/hughes/android/dictionary/engine/TextEntry.java

index 24a1d82afb26e8ede46aca8f42cde3f1eac02370..7bae09b342f5a572a85096f77463e03df307f533 100644 (file)
@@ -39,6 +39,11 @@ public abstract class AbstractEntry {
     raf.writeShort(entrySource.index());
   }
 
+  /**
+   * @return this entry's position within the list just added to.
+   */
   public abstract int addToDictionary(final Dictionary dictionary);
 
+  public abstract RowBase CreateRow(int entryIndex, int rowIndex, Index dictionaryIndex);
+
 }
index 356a4339e31f3f37cf386a3b46d98cf9784c96ad..737ddbb4ee026728a17f25f65345e691adfe7f76 100644 (file)
@@ -17,6 +17,7 @@ package com.hughes.android.dictionary.engine;
 
 public enum EntryTypeName {
 
+  WIKTIONARY_TITLE_SINGLE_DETAIL(true, true, null),
   WIKTIONARY_TITLE_SINGLE(true, true, null),
   WIKTIONARY_INFLECTD_FORM_SINGLE(false, true, null),
 
@@ -25,6 +26,7 @@ public enum EntryTypeName {
   MULTIROW_HEAD_ONE_WORD(true, true, null),
   MULTIROW_TAIL_ONE_WORD(false, true, null),
 
+  WIKTIONARY_TITLE_MULTI_DETAIL(false, true, WIKTIONARY_TITLE_SINGLE_DETAIL),
   WIKTIONARY_TITLE_MULTI(false, true, WIKTIONARY_TITLE_SINGLE),
   WIKTIONARY_TRANSLITERATION(),
   WIKTIONARY_INFLECTED_FORM_MULTI(false, true, WIKTIONARY_INFLECTD_FORM_SINGLE),
index d158ddf0643a7035b8578f0f73677f0c8fceb0a5..3278be6b5dfaade8ec7c950eedc9a3dc674ff6e1 100644 (file)
@@ -15,7 +15,15 @@ public class HtmlEntry extends AbstractEntry implements RAFSerializable<HtmlEntr
   
   final String title;
   final String html;
+  
+  
 
+  public HtmlEntry(final EntrySource entrySource, String title, String html) {
+    super(entrySource);
+    this.title = title;
+    this.html = html;
+  }
+  
   public HtmlEntry(Dictionary dictionary, RandomAccessFile raf) throws IOException {
     super(dictionary, raf);
     title = raf.readUTF();
@@ -34,6 +42,12 @@ public class HtmlEntry extends AbstractEntry implements RAFSerializable<HtmlEntr
     return dictionary.htmlEntries.size() - 1;
   }
   
+  @Override
+  public RowBase CreateRow(int entryIndex, int rowIndex, Index dictionaryIndex) {
+    return new Row(entryIndex, rowIndex, dictionaryIndex);
+  }
+
+  
   static final class Serializer implements RAFSerializer<HtmlEntry> {
     
     final Dictionary dictionary;
index 02d72b92e9ead7f83e88aa381a458256a190939f..c48298af2283d3ad8230fc9727c4e13af774bbf3 100644 (file)
@@ -21,6 +21,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.regex.Pattern;
 
+import com.hughes.android.dictionary.engine.HtmlEntry.Row;
 import com.hughes.util.raf.RAFSerializable;
 import com.hughes.util.raf.RAFSerializer;
 import com.ibm.icu.text.Transliterator;
@@ -84,6 +85,11 @@ public class PairEntry extends AbstractEntry implements RAFSerializable<PairEntr
     return dictionary.pairEntries.size() - 1;
   }
   
+  @Override
+  public RowBase CreateRow(int entryIndex, int rowIndex, Index dictionaryIndex) {
+    return new Row(entryIndex, rowIndex, dictionaryIndex);
+  }
+
 
   // --------------------------------------------------------------------
   
index 8d878dd87a35a5dd00c8d9623fbbaf76a00c6eee..d08b450ed92a100ec518f11b0c0a6c3e0a328aea 100644 (file)
@@ -20,6 +20,7 @@ import java.io.RandomAccessFile;
 import java.util.List;
 import java.util.regex.Pattern;
 
+import com.hughes.android.dictionary.engine.HtmlEntry.Row;
 import com.hughes.util.raf.RAFSerializable;
 import com.hughes.util.raf.RAFSerializer;
 import com.ibm.icu.text.Transliterator;
@@ -64,6 +65,11 @@ public class TextEntry extends AbstractEntry implements RAFSerializable<TextEntr
     dictionary.textEntries.add(this);
     return dictionary.textEntries.size() - 1;
   }
+  
+  @Override
+  public RowBase CreateRow(int entryIndex, int rowIndex, Index dictionaryIndex) {
+    throw new UnsupportedOperationException("TextEntry's don't really exist.");
+  }
 
   public static class Row extends RowBase {