Class PlotServlet.CFResultIterator
java.lang.Object
net.sf.basedb.clients.web.servlet.PlotServlet.CFResultIterator
- All Implemented Interfaces:
AutoCloseable
,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
Fields Modifier and Type Field Description private SqlResultIterator
child
private PlotServlet.CFSqlResult
next
private SqlResultIterator
parent
-
Constructor Summary
Constructors Constructor Description CFResultIterator(SqlResultIterator parent, SqlResultIterator child)
-
Method Summary
Modifier and Type Method Description 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 byQuery.setFirstResult(int)
andQuery.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
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
parent
-
child
-
next
-
-
Constructor Details
-
CFResultIterator
CFResultIterator(SqlResultIterator parent, SqlResultIterator child)
-
-
Method Details
-
hasNext
public boolean hasNext() -
next
-
remove
public void remove()Not supported.- Specified by:
remove
in interfaceIterator<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 byQuery.setFirstResult(int)
andQuery.setMaxResults(int)
. If theQuery.setReturnTotalCount(boolean)
hasn't been enabled this method may not return a correct value.- Specified by:
getTotalCount
in interfaceQueryResult
- 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 interfaceAutoCloseable
- Specified by:
close
in interfaceResultIterator<SqlResult>
-
isClosed
public boolean isClosed()Description copied from interface:ResultIterator
Check if the iterator has been closed.- Specified by:
isClosed
in interfaceResultIterator<SqlResult>
-
getIndex
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 theSqlResult.getXxx(index)
methods to get the value of that column.- Specified by:
getIndex
in interfaceSqlResultIterator
- Parameters:
name
- The name of a selected column- Returns:
- The index number
- Throws:
SQLException
- If there is an error
-