All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class heap.HFPage

java.lang.Object
   |
   +----diskmgr.Page
           |
           +----heap.HFPage

public class HFPage
extends Page
implements ConstSlot, GlobalConst
Class heap file page. The design assumes that records are kept compacted when deletions are performed.


Variable Index

 o CUR_PAGE
 o DPFIXED
 o FREE_SPACE
 o NEXT_PAGE
 o PREV_PAGE
 o SIZE_OF_SLOT
 o SLOT_CNT
 o TYPE
 o USED_PTR

Constructor Index

 o HFPage()
Default constructor
 o HFPage(Page)
Constructor of class HFPage open a HFPage and make this HFpage piont to the given page

Method Index

 o available_space()
returns the amount of available space on the page.
 o deleteRecord(RID)
delete the record with the specified rid
 o dumpPage()
Dump contents of a page
 o empty()
Determining if the page is empty
 o firstRecord()
 o getCurPage()
 o getHFpageArray()
 o getNextPage()
 o getPrevPage()
 o getRecord(RID)
copies out record with RID rid into record pointer.
 o getSlotCnt()
 o getSlotLength(int)
 o getSlotOffset(int)
 o getType()
 o init(PageId, Page)
Constructor of class HFPage initialize a new page
 o insertRecord(byte[])
inserts a new record onto the page, returns RID of this record
 o nextRecord(RID)
 o openHFpage(Page)
Constructor of class HFPage open a existed hfpage
 o returnRecord(RID)
returns a tuple in a byte array[pageSize] with given RID rid.
 o setCurPage(PageId)
sets value of curPage to pageNo
 o setNextPage(PageId)
sets value of nextPage to pageNo
 o setPrevPage(PageId)
sets value of prevPage to pageNo
 o setSlot(int, int, int)
sets slot contents
 o setType(short)
sets value of type

Variables

 o SIZE_OF_SLOT
 public static final int SIZE_OF_SLOT
 o DPFIXED
 public static final int DPFIXED
 o SLOT_CNT
 public static final int SLOT_CNT
 o USED_PTR
 public static final int USED_PTR
 o FREE_SPACE
 public static final int FREE_SPACE
 o TYPE
 public static final int TYPE
 o PREV_PAGE
 public static final int PREV_PAGE
 o NEXT_PAGE
 public static final int NEXT_PAGE
 o CUR_PAGE
 public static final int CUR_PAGE

Constructors

 o HFPage
 public HFPage()
Default constructor

 o HFPage
 public HFPage(Page page)
Constructor of class HFPage open a HFPage and make this HFpage piont to the given page

Parameters:
page - the given page in Page type

Methods

 o openHFpage
 public void openHFpage(Page apage)
Constructor of class HFPage open a existed hfpage

Parameters:
apage - a page in buffer pool
 o init
 public void init(PageId pageNo,
                  Page apage) throws IOException
Constructor of class HFPage initialize a new page

Parameters:
pageNo - the page number of a new page to be initialized
apage - the Page to be initialized
Throws: IOException
I/O errors
See Also:
Page
 o getHFpageArray
 public byte[] getHFpageArray()
Returns:
byte array
 o dumpPage
 public void dumpPage() throws IOException
Dump contents of a page

Throws: IOException
I/O errors
 o getPrevPage
 public PageId getPrevPage() throws IOException
Returns:
PageId of previous page
Throws: IOException
I/O errors
 o setPrevPage
 public void setPrevPage(PageId pageNo) throws IOException
sets value of prevPage to pageNo

Parameters:
pageNo - page number for previous page
Throws: IOException
I/O errors
 o getNextPage
 public PageId getNextPage() throws IOException
Returns:
page number of next page
Throws: IOException
I/O errors
 o setNextPage
 public void setNextPage(PageId pageNo) throws IOException
sets value of nextPage to pageNo

Parameters:
pageNo - page number for next page
Throws: IOException
I/O errors
 o getCurPage
 public PageId getCurPage() throws IOException
Returns:
page number of current page
Throws: IOException
I/O errors
 o setCurPage
 public void setCurPage(PageId pageNo) throws IOException
sets value of curPage to pageNo

Parameters:
pageNo - page number for current page
Throws: IOException
I/O errors
 o getType
 public short getType() throws IOException
Returns:
the ype
Throws: IOException
I/O errors
 o setType
 public void setType(short valtype) throws IOException
sets value of type

Parameters:
valtype - an arbitrary value
Throws: IOException
I/O errors
 o getSlotCnt
 public short getSlotCnt() throws IOException
Returns:
slotCnt used in this page
Throws: IOException
I/O errors
 o setSlot
 public void setSlot(int slotno,
                     int length,
                     int offset) throws IOException
sets slot contents

Parameters:
slotno - the slot number
length - length of record the slot contains
offset - offset of record
Throws: IOException
I/O errors
 o getSlotLength
 public short getSlotLength(int slotno) throws IOException
Parameters:
slotno - slot number
Returns:
the length of record the given slot contains
Throws: IOException
I/O errors
 o getSlotOffset
 public short getSlotOffset(int slotno) throws IOException
Parameters:
slotno - slot number
Returns:
the offset of record the given slot contains
Throws: IOException
I/O errors
 o insertRecord
 public RID insertRecord(byte record[]) throws IOException
inserts a new record onto the page, returns RID of this record

Parameters:
record - a record to be inserted
Returns:
RID of record, null if sufficient space does not exist
Throws: IOException
I/O errors in C++ Status insertRecord(char *recPtr, int recLen, RID& rid)
 o deleteRecord
 public void deleteRecord(RID rid) throws IOException, InvalidSlotNumberException
delete the record with the specified rid

Parameters:
rid - the record ID
Throws: InvalidSlotNumberException
Invalid slot number
Throws: IOException
I/O errors in C++ Status deleteRecord(const RID& rid)
 o firstRecord
 public RID firstRecord() throws IOException
Returns:
RID of first record on page, null if page contains no records.
Throws: IOException
I/O errors in C++ Status firstRecord(RID& firstRid)
 o nextRecord
 public RID nextRecord(RID curRid) throws IOException
Parameters:
curRid - current record ID
Returns:
RID of next record on the page, null if no more records exist on the page
Throws: IOException
I/O errors in C++ Status nextRecord (RID curRid, RID& nextRid)
 o getRecord
 public Tuple getRecord(RID rid) throws IOException, InvalidSlotNumberException
copies out record with RID rid into record pointer.
Status getRecord(RID rid, char *recPtr, int& recLen)

Parameters:
rid - the record ID
Returns:
a tuple contains the record
Throws: InvalidSlotNumberException
Invalid slot number
Throws: IOException
I/O errors
See Also:
Tuple
 o returnRecord
 public Tuple returnRecord(RID rid) throws IOException, InvalidSlotNumberException
returns a tuple in a byte array[pageSize] with given RID rid.
in C++ Status returnRecord(RID rid, char*& recPtr, int& recLen)

Parameters:
rid - the record ID
Returns:
a tuple with its length and offset in the byte array
Throws: InvalidSlotNumberException
Invalid slot number
Throws: IOException
I/O errors
See Also:
Tuple
 o available_space
 public int available_space() throws IOException
returns the amount of available space on the page.

Returns:
the amount of available space on the page
Throws: IOException
I/O errors
 o empty
 public boolean empty() throws IOException
Determining if the page is empty

Returns:
true if the HFPage is has no records in it, false otherwise
Throws: IOException
I/O errors

All Packages  Class Hierarchy  This Package  Previous  Next  Index