iterator
Class Iterator

java.lang.Object
  extended byiterator.Iterator
All Implemented Interfaces:
Flags
Direct Known Subclasses:
DuplElim, FileScan, NestedLoopsJoins, Sort, SortMerge

public abstract class Iterator
extends java.lang.Object
implements Flags

All the relational operators and access methods are iterators.


Field Summary
 boolean closeFlag
          a flag to indicate whether this iterator has been closed.
 
Fields inherited from interface global.Flags
DEBUG, TEST
 
Constructor Summary
Iterator()
           
 
Method Summary
abstract  void close()
           
 void free_buffer_pages(int n_pages, PageId[] PageIds)
          free all the buffer pages we requested earlier.
 void get_buffer_pages(int n_pages, PageId[] PageIds, byte[][] bufs)
          tries to get n_pages of buffer space
abstract  Tuple get_next()
          abstract method, every subclass must implement it.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

closeFlag

public boolean closeFlag
a flag to indicate whether this iterator has been closed. it is set to true the first time the close() function is called. multiple calls to the close() function will not be a problem.

Constructor Detail

Iterator

public Iterator()
Method Detail

get_next

public abstract Tuple get_next()
                        throws java.io.IOException,
                               JoinsException,
                               index.IndexException,
                               InvalidTupleSizeException,
                               InvalidTypeException,
                               PageNotReadException,
                               TupleUtilsException,
                               PredEvalException,
                               SortException,
                               LowMemException,
                               UnknowAttrType,
                               UnknownKeyTypeException,
                               java.lang.Exception
abstract method, every subclass must implement it.

Returns:
the result tuple
Throws:
java.io.IOException - I/O errors
JoinsException - some join exception
index.IndexException - exception from super class
InvalidTupleSizeException - invalid tuple size
InvalidTypeException - tuple type not valid
PageNotReadException - exception from lower layer
TupleUtilsException - exception from using tuple utilities
PredEvalException - exception from PredEval class
SortException - sort exception
LowMemException - memory error
UnknowAttrType - attribute type unknown
UnknownKeyTypeException - key type unknown
java.lang.Exception - other exceptions

close

public abstract void close()
                    throws java.io.IOException,
                           JoinsException,
                           SortException,
                           index.IndexException
Throws:
java.io.IOException - I/O errors
JoinsException - some join exception
index.IndexException - exception from Index class
SortException - exception Sort class

get_buffer_pages

public void get_buffer_pages(int n_pages,
                             PageId[] PageIds,
                             byte[][] bufs)
                      throws IteratorBMException
tries to get n_pages of buffer space

Parameters:
n_pages - the number of pages
PageIds - the corresponding PageId for each page
bufs - the buffer space
Throws:
IteratorBMException - exceptions from bufmgr layer

free_buffer_pages

public void free_buffer_pages(int n_pages,
                              PageId[] PageIds)
                       throws IteratorBMException
free all the buffer pages we requested earlier. should be called in the destructor

Parameters:
n_pages - the number of pages
PageIds - the corresponding PageId for each page
Throws:
IteratorBMException - exception from bufmgr class