net.windward.datasource
Interface DataSourceIterator

All Superinterfaces:
java.util.Iterator

public interface DataSourceIterator
extends java.util.Iterator

This iterates through the nodes that match a <wr:forEach tag. It will handle the tag's begin, step, and end attributes.

Version:
2.0 2 January 2004

Method Summary
 void close()
          We are done with this iterator.
 int getCount()
          Return the count the iteration is on.
 int getIndex()
          Return the index the iteration is on.
 DataSourceNode getNode(int index)
          Returns the requested node from the set of nodes presently on.
 ForEachTag getTag()
          Return the forEach tag in use for this iterator.
 boolean hasNext()
          Returns true if the iteration has more nodes.
 boolean isFirst()
          Return true if on the first node returned.
 boolean isLast()
          Return true if on the last node returned.
 java.lang.Object next()
          Returns the next node in the iteration.
 void remove()
          This will throw an UnsupportedOperationException.
 

Method Detail

hasNext

public boolean hasNext()
Returns true if the iteration has more nodes. (In other words, returns true if next would return a node rather than throwing an exception.)
Specified by:
hasNext in interface java.util.Iterator
Returns:
true if the iterator has more elements.

next

public java.lang.Object next()
Returns the next node in the iteration. This will always return an object of type DataSourceNode.
Specified by:
next in interface java.util.Iterator
Returns:
the next element in the iteration.

getNode

public DataSourceNode getNode(int index)
                       throws java.util.NoSuchElementException
Returns the requested node from the set of nodes presently on. Index must be less than the step size. Unlike next() calling this method does not advance the dataset.
Parameters:
index - The offset from the base node on. A value of 0 is identical to the value returned by next.
Returns:
The node at this offset.
Throws:
java.util.NoSuchElementException - thrown if past the end of the list.

remove

public void remove()
            throws java.lang.UnsupportedOperationException
This will throw an UnsupportedOperationException.
Specified by:
remove in interface java.util.Iterator

getTag

public ForEachTag getTag()
                  throws DataSourceException
Return the forEach tag in use for this iterator. This is the tag that is the start of a block in the report that this iterator is iterating through.
Returns:
the forEach tag in use for this iterator.
Throws:
DataSourceException - Could not retrieve the data. Generally wraps a SqlException or XpathException.

getIndex

public int getIndex()
             throws DataSourceException
Return the index the iteration is on. This is a 0-based number of the index into the node list and counts all nodes including those skipped if step > 1. This is undefined before the first call to next and is 0 after the first call to next.
Returns:
The index presently on.
Throws:
DataSourceException - Could not retrieve the data. Generally wraps a SqlException or XpathException.

getCount

public int getCount()
             throws DataSourceException
Return the count the iteration is on. This is a 1-based number of the number of nodes returned so far. It only counts nodes returned. This is undefined before the first call to next and is 1 after the first call to next.
Returns:
The number of nodes returned so far..
Throws:
DataSourceException - Could not retrieve the data. Generally wraps a SqlException or XpathException.

isFirst

public boolean isFirst()
                throws DataSourceException
Return true if on the first node returned. This is undefined before the first call to next and is true after the first call to next.
Returns:
true if on the first node, false otherwise.
Throws:
DataSourceException - Could not retrieve the data. Generally wraps a SqlException or XpathException.

isLast

public boolean isLast()
               throws DataSourceException
Return true if on the last node returned. This is undefined before the first call to next and is true after the call to next which returns the last node that will be returned.
Returns:
true if on the last node, false otherwise.
Throws:
DataSourceException - Could not retrieve the data. Generally wraps a SqlException or XpathException.

close

public void close()
           throws DataSourceException
We are done with this iterator. Used to close any resources opened by this object.
Throws:
DataSourceException - Could not retrieve the data.


Copyright © 2002 - 2008 Windward Reports - All Rights Reserved. java reporting software