|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectneustore.base.DBIndex
test.naiveheapfile.NaiveHeapFile
public class NaiveHeapFile
A naive version of the heap file. It stores a list of integers. The only update is to append an integer at the end of the file. The only search is to tell whether an integer exists in the file or not. This file is not meant to be used. Rather, it shows an example of using the NEU Storage Package.
NaiveHeapFilePage
Field Summary |
---|
Fields inherited from class neustore.base.DBIndex |
---|
buffer, CREATE, file, firstEmpty, numPages, OPEN, OVERHEAD, pageSize |
Constructor Summary | |
---|---|
NaiveHeapFile(DBBuffer _buffer,
java.lang.String filename,
boolean isCreate)
|
Method Summary | |
---|---|
protected void |
initIndexHead()
Initializes index head information. |
void |
insert(int key)
Appends a new integer to the end of the file. |
protected NaiveHeapFilePage |
myReadPage(int pageID)
Reads a page from buffer and parse it if not parsed already. |
protected void |
readIndexHead(byte[] head)
Reads index head information from a byte array. |
boolean |
search(int key)
Searches for an integer. |
protected void |
writeIndexHead(byte[] head)
Writes index head information to a byte array. |
Methods inherited from class neustore.base.DBIndex |
---|
allocate, close, freePage |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NaiveHeapFile(DBBuffer _buffer, java.lang.String filename, boolean isCreate) throws java.io.IOException
java.io.IOException
Method Detail |
---|
protected void initIndexHead()
DBIndex
initIndexHead
in class DBIndex
protected NaiveHeapFilePage myReadPage(int pageID) throws java.io.IOException
pageID
-
java.io.IOException
protected void readIndexHead(byte[] head)
DBIndex
readIndexHead
in class DBIndex
head
- the byte array of length pageSize-OVERHEADprotected void writeIndexHead(byte[] head)
DBIndex
writeIndexHead
in class DBIndex
head
- the byte array of length pageSize-OVERHEADpublic void insert(int key) throws java.io.IOException
key
- the integer to be appended
java.io.IOException
public boolean search(int key) throws java.io.IOException
key
- the integer to search for
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |