org.knime.core.data
Class RowIterator

java.lang.Object
  extended by org.knime.core.data.RowIterator
All Implemented Interfaces:
Iterator<DataRow>
Direct Known Subclasses:
AffineTransRowIterator, AppendedColumnRowIterator, AppendedRowsIterator, ARFFRowIterator, BasisFunctionIterator, BasisFunctionPredictorRowIterator, CloseableRowIterator, DefaultRowIterator, FileReaderPreviewRowIterator, FileRowIterator, FilterColumnRowIterator, FilterRowIterator, InMemoryIterator, JoinedTableRowIterator, MissingValueHandlingTableIterator, ReplacedColumnsRowIterator, RowFilterIterator

public abstract class RowIterator
extends Object
implements Iterator<DataRow>

Classes extending this class iterate over the rows of a DataTable. Each DataTable has its specific RowIterator, which returns the rows one by one. A RowIterator must return the rows always in the same order.

Use RowIterators as follows:

     DataTable table = ...;
     for (RowIterator it = table.getRowIterator(); it.hasNext();) {
         DataRow row = it.next();
         ...
     }
 

or, if you don't need access to the iterator:

     DataTable table =...;
     for (DataRow row : table) {
       // access the row here
     }
 

Note, the difference of this class to a generic Iterator<DataRow> is that it does not allow to remove elements.

Author:
Thomas Gabriel, University of Konstanz
See Also:
DataRow

Constructor Summary
RowIterator()
           
 
Method Summary
abstract  boolean hasNext()
          Returns true if there are more rows and false otherwise.
abstract  DataRow next()
          Returns the next DataRow.
 void remove()
          NOT supported by the DataTable iterator! DataTables are immutable read-only objects after their creation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RowIterator

public RowIterator()
Method Detail

hasNext

public abstract boolean hasNext()
Returns true if there are more rows and false otherwise.

Specified by:
hasNext in interface Iterator<DataRow>
Returns:
true if the iterator has more elements, otherwise false
See Also:
next()

next

public abstract DataRow next()
Returns the next DataRow.

Specified by:
next in interface Iterator<DataRow>
Returns:
the next row in the DataTable
Throws:
NoSuchElementException - if there are no more rows

remove

public final void remove()
NOT supported by the DataTable iterator! DataTables are immutable read-only objects after their creation. Do not call this method, it will throw an exception.

Specified by:
remove in interface Iterator<DataRow>
Throws:
UnsupportedOperationException - if the remove operation is not supported by this Iterator.


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.