package at.jku.sii.sqlitereader.btree;
import java.util.List;
import at.jku.sii.sqlitereader.SqliteDataBase;
import at.jku.sii.sqlitereader.btree.IndexLeafBTreePage.IndexLeafCell;
import at.jku.sii.sqlitereader.io.ArrayDataInput;
import at.jku.sii.sqlitereader.record.Record;
public final class IndexLeafBTreePage extends PayloadBTreePage<IndexLeafCell> {
public static final class IndexLeafCell extends PayloadCell implements IndexCell {
IndexLeafCell(ArrayDataInput in, SqliteDataBase db) {
super(in.readVarint("numPayloadBytes"), Type.INDEX_LEAF, in, db);
}
@Override
public String toString() {
return String.format("IndexLeafCell [%s]", this.toStringAttr());
}
}
IndexLeafBTreePage(int number, SqliteDataBase db, ArrayDataInput block) {
super(number, Type.INDEX_LEAF, db, block);
}
@Override
protected IndexLeafCell readCell(ArrayDataInput in, SqliteDataBase db) {
return new IndexLeafCell(in, db);
}
@Override
public void collectRecords(List<Record> records) {
for (IndexLeafCell cell : this)
records.add(cell.getRecord());
}
}