1 5 package org.h2.index; 6 7 import java.sql.SQLException ; 8 9 import org.h2.store.DataPage; 10 import org.h2.store.Record; 11 12 public class BtreeHead extends Record { 13 14 private int rootPosition; 15 private boolean consistent; 16 17 public BtreeHead() { 18 } 20 21 public BtreeHead(DataPage s) throws SQLException { 22 rootPosition = s.readInt(); 23 consistent = s.readInt() == 1; 24 } 25 26 public boolean getConsistent() { 27 return consistent; 28 } 29 30 public void setConsistent(boolean b) { 31 this.consistent = b; 32 } 33 34 public int getByteCount(DataPage dummy) throws SQLException { 35 return 1 + dummy.getIntLen(); 36 } 37 38 public void write(DataPage buff) throws SQLException { 39 buff.writeByte((byte) 'H'); 40 buff.writeInt(rootPosition); 41 buff.writeInt(consistent ? 1 : 0); 42 } 43 44 void setRootPosition(int rootPosition) { 45 this.rootPosition = rootPosition; 46 } 47 48 int getRootPosition() { 49 return rootPosition; 50 } 51 52 public boolean isPinned() { 53 return true; 54 } 55 56 } 57 | Popular Tags |