org.virbo.dataset
Class QubeDataSetIterator

java.lang.Object
  extended by org.virbo.dataset.QubeDataSetIterator
All Implemented Interfaces:
DataSetIterator

public class QubeDataSetIterator
extends java.lang.Object
implements DataSetIterator


Nested Class Summary
static interface QubeDataSetIterator.DimensionIterator
           
static interface QubeDataSetIterator.DimensionIteratorFactory
           
static class QubeDataSetIterator.IndexListIterator
           
static class QubeDataSetIterator.IndexListIteratorFactory
           
static class QubeDataSetIterator.SingletonIterator
           
static class QubeDataSetIterator.SingletonIteratorFactory
           
static class QubeDataSetIterator.StartStopStepIterator
           
static class QubeDataSetIterator.StartStopStepIteratorFactory
           
 
Constructor Summary
QubeDataSetIterator(QDataSet ds)
          dataset iterator to help in implementing the complex indexing types of python.
 
Method Summary
 double getValue(QDataSet ds)
          get the value from ds at the current iterator position.
 boolean hasNext()
           
 int index(int dim)
           
 int length(int dim)
           
 void next()
           
 void putValue(WritableDataSet ds, double v)
          replace the value in ds at the current iterator position.
 int rank()
          return the rank of the dataset which the iterator will walk through.
 void setIndexIteratorFactory(int dim, QubeDataSetIterator.DimensionIteratorFactory fit)
          reinitializes the iterator.
static QubeDataSetIterator sliceIterator(QDataSet ds, int sliceIndex)
          return an iterator for the slice of a dataset.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QubeDataSetIterator

public QubeDataSetIterator(QDataSet ds)
dataset iterator to help in implementing the complex indexing types of python. create a new iterator, set the index iterator factories, iterate.

Parameters:
ds -
Method Detail

sliceIterator

public static QubeDataSetIterator sliceIterator(QDataSet ds,
                                                int sliceIndex)
return an iterator for the slice of a dataset. This is introduced to improve performance by reducing the number of bounds checks, etc from the general case.

Parameters:
ds -
sliceIndex -
Returns:

setIndexIteratorFactory

public void setIndexIteratorFactory(int dim,
                                    QubeDataSetIterator.DimensionIteratorFactory fit)
reinitializes the iterator.

Parameters:
dim -
fit -

hasNext

public boolean hasNext()
Specified by:
hasNext in interface DataSetIterator

next

public void next()
Specified by:
next in interface DataSetIterator

index

public int index(int dim)
Specified by:
index in interface DataSetIterator

length

public int length(int dim)
Specified by:
length in interface DataSetIterator

rank

public int rank()
Description copied from interface: DataSetIterator
return the rank of the dataset which the iterator will walk through. Note this needn't be the same rank as the dataset!

Specified by:
rank in interface DataSetIterator
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getValue

public final double getValue(QDataSet ds)
get the value from ds at the current iterator position.

Specified by:
getValue in interface DataSetIterator
Parameters:
ds - a dataset with capatible geometry as the iterator's geometry.
Returns:
the value of ds at the current iterator position.

putValue

public final void putValue(WritableDataSet ds,
                           double v)
replace the value in ds at the current iterator position.

Specified by:
putValue in interface DataSetIterator
Parameters:
ds - a writable dataset with capatible geometry as the iterator's geometry.
v - the value to insert.