/**
* the Index owning this RowBase.
*/
- final Index index;
+ public final Index index;
/**
* Where this RowBase points to.
*/
- int referenceIndex;
+ public final int referenceIndex;
/**
* the TokenRow above this RowBase, populated on demand.
*/
- TokenRow tokenRow = null;
+ private TokenRow tokenRow = null;
RowBase(final RandomAccessFile raf, final int thisRowIndex, final Index index) throws IOException {
super(thisRowIndex);
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);
for (++r; r <= index(); ++r) {
index.rows.get(r).setTokenRow(candidate);
}
+ 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;
}
this.tokenRow = tokenRow;
}
-
public abstract void print(PrintStream out);
-
- public abstract Object draw(final String searchText);
+ public abstract String getRawText(final boolean compact);
// RowBase must manage "disk-based" polymorphism. All other polymorphism is
// dealt with in the normal manner.
}
}
-
}