]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - src/com/hughes/android/dictionary/engine/RowBase.java
go
[Dictionary.git] / src / com / hughes / android / dictionary / engine / RowBase.java
index 64500585e4b9716c78a300346bbac4b5a1ba849e..7ac86d0bc9e502dd59ba840891a2822937ea5d80 100644 (file)
@@ -41,6 +41,7 @@ public abstract class RowBase extends IndexedObject {
   public TokenRow getTokenRow(final boolean search) {
     if (tokenRow == null && search) {
       int r = index() - 1;
+      int rUp = index() + 1;
       while (r >= 0) {
         final RowBase row = index.rows.get(r);
         final TokenRow candidate = row.getTokenRow(false);
@@ -50,6 +51,17 @@ public abstract class RowBase extends IndexedObject {
           }
           break;
         }
+        if (rUp < index.rows.size()) {
+          final RowBase rowUp = index.rows.get(rUp);
+          final TokenRow candidateUp = rowUp.getTokenRow(false);
+          if (candidateUp != null) {
+            for (--rUp; rUp >= index(); --rUp) {
+              index.rows.get(rUp).setTokenRow(candidateUp);
+            }
+            break;
+          }
+          rUp++;
+        }
         --r;
       }
       assert tokenRow != null;
@@ -64,7 +76,9 @@ public abstract class RowBase extends IndexedObject {
   }
 
   public abstract void print(PrintStream out);
-  
+
+  public abstract String getRawText(final boolean compact);
+
   // RowBase must manage "disk-based" polymorphism.  All other polymorphism is
   // dealt with in the normal manner.
   static class Serializer implements RAFListSerializer<RowBase> {