com.metamatrix.query.sql.util
Interface ValueIterator

All Known Implementing Classes:
CollectionValueIterator

public interface ValueIterator

Interface for interating through Expressions or values. It may return instances of Expression (which then have to be evaluated) or it may return some Object constant value - this should be checked for after calling next

This interface is meant to abstract the details of how the values are stored and retrieved, if they are even stored in memory or not, etc. etc. An implementation instance may or may not be resettable and therefore reusable - see reset.


Method Summary
 boolean hasNext()
          Returns true if the iteration has more values.
 java.lang.Object next()
          Returns the next Expression or Object value in the interation.
 void reset()
          Optional reset method - allows a single instance of a ValueIterator implementation to be resettable, such that the next call to next returns the first element in the iteration (if any).
 

Method Detail

hasNext

boolean hasNext()
                throws MetaMatrixComponentException
Returns true if the iteration has more values. (In other words, returns true if next would return a value rather than throwing an exception.)

Returns:
true if this ValueIterator has more values.
Throws:
MetaMatrixComponentException - indicating a non business- related Exception such as a service or bean being unavailable, or a communication failure.

next

java.lang.Object next()
                      throws MetaMatrixComponentException
Returns the next Expression or Object value in the interation.

Returns:
the next Expression or Object value in the iteration.
Throws:
MetaMatrixComponentException - indicating a non business- related Exception such as a service or bean being unavailable, or a communication failure.
NoSuchElementException - if iteration has no more elements.

reset

void reset()
Optional reset method - allows a single instance of a ValueIterator implementation to be resettable, such that the next call to next returns the first element in the iteration (if any). This method should be able to be called at any point during the lifecycle of a ValueIterator instance.

Throws:
java.lang.UnsupportedOperationException - if this method is not implemented


Copyright © 2009. All Rights Reserved.