2.17.2: 2011-06-17

net.sf.basedb.clients.web.servlet
Class PlotServlet.CFResultIterator

java.lang.Object
  extended by net.sf.basedb.clients.web.servlet.PlotServlet.CFResultIterator
All Implemented Interfaces:
Iterator<SqlResult>, QueryResult, ResultIterator<SqlResult>, SqlResultIterator
Enclosing class:
PlotServlet

private static class PlotServlet.CFResultIterator
extends Object
implements SqlResultIterator

Special implementation of a SqlResultIterator that combines the result from the parent and child into one virtual iterator. The parent iterator must select the following columns in this order: postion, parent M, parent A. The child iterator must selected the following columns in this order: position, child M.

The we map our own columns like this: a --> parent A, m --> parent M, cf --> parent M - child M


Field Summary
private  SqlResultIterator child
           
private  PlotServlet.CFSqlResult next
           
private  SqlResultIterator parent
           
 
Constructor Summary
PlotServlet.CFResultIterator(SqlResultIterator parent, SqlResultIterator child)
           
 
Method Summary
 void close()
          Close the iterator and immediately release all resources associated with it.
 int getIndex(String name)
          Get the index number of a selected column.
 long getTotalCount()
          Get the total number of items returned by the query, ignoring any limits set by Query.setFirstResult(int) and Query.setMaxResults(int).
 boolean hasNext()
           
 boolean isClosed()
          Check if the iterator has been closed.
 SqlResult next()
           
 void remove()
          Not supported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

private final SqlResultIterator parent

child

private final SqlResultIterator child

next

private final PlotServlet.CFSqlResult next
Constructor Detail

PlotServlet.CFResultIterator

PlotServlet.CFResultIterator(SqlResultIterator parent,
                             SqlResultIterator child)
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<SqlResult>

next

public SqlResult next()
Specified by:
next in interface Iterator<SqlResult>

remove

public void remove()
Not supported.

Specified by:
remove in interface Iterator<SqlResult>
Throws:
UnsupportedOperationException - Always

getTotalCount

public long getTotalCount()
Description copied from interface: QueryResult
Get the total number of items returned by the query, ignoring any limits set by Query.setFirstResult(int) and Query.setMaxResults(int). If the Query.setReturnTotalCount(boolean) hasn't been enabled this method may not return a correct value.

Specified by:
getTotalCount in interface QueryResult
Returns:
The total number of items, or -1 if not known
See Also:
Query.setReturnTotalCount(boolean)

close

public void close()
Description copied from interface: ResultIterator
Close the iterator and immediately release all resources associated with it.

Specified by:
close in interface ResultIterator<SqlResult>

isClosed

public boolean isClosed()
Description copied from interface: ResultIterator
Check if the iterator has been closed.

Specified by:
isClosed in interface ResultIterator<SqlResult>

getIndex

public int getIndex(String name)
             throws SQLException
Description copied from interface: SqlResultIterator
Get the index number of a selected column. Use this method to find the index of a column and then use the SqlResult.getXxx(index) methods to get the value of that column.

Specified by:
getIndex in interface SqlResultIterator
Parameters:
name - The name of a selected column
Returns:
The index number
Throws:
SQLException - If there is an error

2.17.2: 2011-06-17