Class RecordIterator

java.lang.Object
  extended by RecordIterator

public class RecordIterator
extends java.lang.Object

Record iterator. This class does not implement the Iterator interface because of the potential I/O exceptions. While they could be appropriately handled, it seemed more straightforward just to pass them on through.

Author:
Dave Musicant, with considerable material reused from the UW-Madison Minibase project

Constructor Summary
RecordIterator(BufferManager buf, int firstId, java.lang.String file)
          Constructs a record iterator.
 
Method Summary
 boolean hasNext()
          Returns true if the iterator has more records.
 RID next()
          Returns the next RID in the iteration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecordIterator

public RecordIterator(BufferManager buf,
                      int firstId,
                      java.lang.String file)
               throws java.io.IOException
Constructs a record iterator.

Parameters:
buf - a buffer manager to use for managing pages in memory.
firstId - the page id of the starting page.
file - the name of the file that the page are drawn from.
Throws:
java.io.IOException - passed through from underlying file system.
Method Detail

hasNext

public boolean hasNext()
                throws java.io.IOException
Returns true if the iterator has more records.

Returns:
true if the iterator has more records.
Throws:
java.io.IOException - passed through from underlying file system.

next

public RID next()
         throws java.io.IOException
Returns the next RID in the iteration.

Returns:
the next RID.
Throws:
java.io.IOException - passed through from underlying file system.
NoSuchElementException - iteration has no more pages.