index
Class BucketScan

java.lang.Object
  extended by index.BucketScan
All Implemented Interfaces:
GlobalConst

public class BucketScan
extends java.lang.Object
implements GlobalConst

Scans an entire hash index file, bucket by bucket; created only through the openScan() method in the HashIndex class.


Field Summary
 
Fields inherited from interface global.GlobalConst
EMPTY_SLOT, FIRST_PAGEID, INVALID_PAGEID, MAX_COLSIZE, MAX_TUPSIZE, NAME_MAXLEN, PAGE_SIZE, PIN_DISKIO, PIN_MEMCPY, UNPIN_CLEAN, UNPIN_DIRTY
 
Constructor Summary
protected BucketScan(HashIndex index)
          Constructs a bucket scan by initializing the iterator state.
 
Method Summary
 void close()
          Closes the index scan, releasing any pinned pages.
protected  void finalize()
          Called by the garbage collector when there are no more references to the object; closes the scan if it's still open.
 SearchKey getLastKey()
          Gets the key of the last RID returned.
 RID getNext()
          Gets the next entry's record in the index scan.
 int getNextHash()
          Returns the hash value for the bucket containing the next RID, or maximum number of buckets if none.
 boolean hasNext()
          Returns true if there are more entries to scan, false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BucketScan

protected BucketScan(HashIndex index)
Constructs a bucket scan by initializing the iterator state.

Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Called by the garbage collector when there are no more references to the object; closes the scan if it's still open.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

close

public void close()
Closes the index scan, releasing any pinned pages.


hasNext

public boolean hasNext()
Returns true if there are more entries to scan, false otherwise.


getNext

public RID getNext()
Gets the next entry's record in the index scan.

Throws:
java.lang.IllegalStateException - if the scan has no more entries

getLastKey

public SearchKey getLastKey()
Gets the key of the last RID returned.


getNextHash

public int getNextHash()
Returns the hash value for the bucket containing the next RID, or maximum number of buckets if none.