Class PageIterator

java.lang.Object
  extended by PageIterator

public class PageIterator
extends java.lang.Object

HFPage 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
PageIterator(BufferManager buf, int firstId, java.lang.String file)
          Constructs a page iterator.
 
Method Summary
 boolean hasNext()
          Returns true if the iterator has more pages.
 int next()
          Returns the next page id in the iteration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageIterator

public PageIterator(BufferManager buf,
                    int firstId,
                    java.lang.String file)
Constructs a page 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 pages.

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

next

public int next()
         throws java.io.IOException
Returns the next page id in the iteration.

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