javatools.db
Class DbCachedIterator

java.lang.Object
  |
  +--javatools.db.DbIterator
        |
        +--javatools.db.DbCachedIterator
All Implemented Interfaces:
java.util.Iterator

public class DbCachedIterator
extends DbIterator

A class to represent a "cached" DbIterator, that is an iterator that can be called more than once.


Constructor Summary
DbCachedIterator(DbCachedTable table)
          Creates new DbCachedIterator
 
Method Summary
 boolean hasNext()
          Checks if this iterator has a value after the current one.
 boolean hasNextRow()
          Are there more rows to iterator through?
 java.lang.Object next()
          Takes the next object from the iterator.
 DbRow nextRow()
          Get the next DbRow in the table.
 void remove()
          Removes the current element in the iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbCachedIterator

public DbCachedIterator(DbCachedTable table)
Creates new DbCachedIterator

Parameters:
table - The table to point the iterator to.
Method Detail

hasNext

public boolean hasNext()
Checks if this iterator has a value after the current one.

Specified by:
hasNext in interface java.util.Iterator
Overrides:
hasNext in class DbIterator
Returns:
true: if there is another value; false: otherwise.

hasNextRow

public boolean hasNextRow()
                   throws DbException
Are there more rows to iterator through?

Overrides:
hasNextRow in class DbIterator
Returns:
true: if there is another row; false: otherwise.
Throws:
DbException - If something goes wrong.

next

public java.lang.Object next()
Takes the next object from the iterator.

Specified by:
next in interface java.util.Iterator
Overrides:
next in class DbIterator
Returns:
The needed object.

nextRow

public DbRow nextRow()
              throws DbException
Get the next DbRow in the table.

Overrides:
nextRow in class DbIterator
Returns:
The needed row.
Throws:
DbException - If something goes wrong.

remove

public void remove()
Removes the current element in the iterator.

Specified by:
remove in interface java.util.Iterator
Overrides:
remove in class DbIterator