heap
Class Scan

java.lang.Object
  extended byheap.Scan
All Implemented Interfaces:
GlobalConst

public class Scan
extends java.lang.Object
implements GlobalConst

A Scan object is created ONLY through the function openScan of a HeapFile. It supports the getNext interface which will simply retrieve the next record in the heapfile. An object of type scan will always have pinned one directory page of the heapfile.


Field Summary
 
Fields inherited from interface global.GlobalConst
INVALID_PAGE, MAX_NAME, MAX_SPACE, MAXATTRNAME, MAXFILENAME, MAXINDEXNAME, MINIBASE_BUFFER_POOL_SIZE, MINIBASE_DB_SIZE, MINIBASE_DEFAULT_SHAREDMEM_SIZE, MINIBASE_MAX_TRANSACTIONS, MINIBASE_MAXARRSIZE, MINIBASE_PAGESIZE, NUMBUF
 
Constructor Summary
Scan(Heapfile hf)
          The constructor pins the first directory page in the file and initializes its private data members from the private data member from hf
 
Method Summary
 void closescan()
          Closes the Scan object
 Tuple getNext(RID rid)
          Retrieve the next record in a sequential scan
 boolean position(RID rid)
          Position the scan cursor to the record with the given rid.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scan

public Scan(Heapfile hf)
     throws InvalidTupleSizeException,
            java.io.IOException
The constructor pins the first directory page in the file and initializes its private data members from the private data member from hf

Parameters:
hf - A HeapFile object
Throws:
InvalidTupleSizeException - Invalid tuple size
java.io.IOException - I/O errors
Method Detail

getNext

public Tuple getNext(RID rid)
              throws InvalidTupleSizeException,
                     java.io.IOException
Retrieve the next record in a sequential scan

Parameters:
rid - Record ID of the record
Returns:
the Tuple of the retrieved record.
Throws:
InvalidTupleSizeException - Invalid tuple size
java.io.IOException - I/O errors

position

public boolean position(RID rid)
                 throws InvalidTupleSizeException,
                        java.io.IOException
Position the scan cursor to the record with the given rid.

Parameters:
rid - Record ID of the given record
Returns:
true if successful, false otherwise.
Throws:
InvalidTupleSizeException - Invalid tuple size
java.io.IOException - I/O errors

closescan

public void closescan()
Closes the Scan object