public final class QubeDataSetIterator extends java.lang.Object implements DataSetIterator
Modifier and Type | Class and Description |
---|---|
static interface |
QubeDataSetIterator.DimensionIterator
DimensionIterator iterates over an index.
|
static interface |
QubeDataSetIterator.DimensionIteratorFactory
DimensionIteratorFactory creates DimensionIterators
|
static class |
QubeDataSetIterator.IndexListIterator
Iterator that goes through a list of indices.
|
static class |
QubeDataSetIterator.IndexListIteratorFactory
Factory for iterator that goes through a list of indices.
|
static class |
QubeDataSetIterator.SingletonIterator
Iterator for a single index.
|
static class |
QubeDataSetIterator.SingletonIteratorFactory
Factory for iterator for a single index, which can be negative indicating it is from the end of the array.
|
static class |
QubeDataSetIterator.StartStopStepIterator
Iterator for counting off indices.
|
static class |
QubeDataSetIterator.StartStopStepIteratorFactory
generates iterator for counting off indices.
|
Constructor and Description |
---|
QubeDataSetIterator(QDataSet ds)
dataset iterator to help in implementing the complex indexing
types of python.
|
Modifier and Type | Method and Description |
---|---|
static void |
checkValidIndexList(QDataSet ds,
int indexSize) |
DDataSet |
createEmptyDs()
return a dataset that will have the same geometry at the
dataset implied by each dimension iterator.
|
static java.lang.String |
currentJythonLine()
return the current line in the Jython script as <filename>:<linenum>
or ??? if this cannot be done.
|
QDataSet |
getRank0Value(QDataSet ds)
get the rank 0 data set the current iterator position.
|
double |
getValue(QDataSet ds)
get the value from ds at the current iterator position.
|
boolean |
hasNext()
true if there are more values.
|
int |
index(int dim)
return the current index for the dimension.
|
int |
length(int dim)
return the length of the dimension, or the length reported by the
iterator.
|
void |
next()
advance to the next index.
|
void |
putRank0Value(WritableDataSet ds,
QDataSet vds)
replace the value in ds at the current iterator position.
|
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.
|
void |
setMonitor(ProgressMonitor mon)
convenient method for monitoring long processes, this allows
clients to let the iterator manage the monitor.
|
static QubeDataSetIterator |
sliceIterator(QDataSet ds,
int sliceIndex)
return an iterator for the slice of a dataset (on the 0th index).
|
java.lang.String |
toString() |
public QubeDataSetIterator(QDataSet ds)
ds
- the dataset we will iterate over.public static java.lang.String currentJythonLine()
JythonOps#currentLine()
public static void checkValidIndexList(QDataSet ds, int indexSize)
public void setMonitor(ProgressMonitor mon)
mon
- the monitor, or null.public static QubeDataSetIterator sliceIterator(QDataSet ds, int sliceIndex)
ds
- the dataset.sliceIndex
- the index of the slice.QDataSet.slice(int)
public void setIndexIteratorFactory(int dim, QubeDataSetIterator.DimensionIteratorFactory fit)
dim
- the dimension index (0,...,rank-1)fit
- the iterator factory to use for the index.public boolean hasNext()
hasNext
in interface DataSetIterator
public void next()
next
in interface DataSetIterator
getValue(org.das2.qds.QDataSet)
public int index(int dim)
DataSetIterator
index
in interface DataSetIterator
dim
- the dimension number (0<=dim<inputRank)public int length(int dim)
DataSetIterator
length
in interface DataSetIterator
dim
- the dimension number (0<=dim<inputRank)public int rank()
DataSetIterator
rank
in interface DataSetIterator
public java.lang.String toString()
toString
in class java.lang.Object
public DDataSet createEmptyDs()
createEmptyDs
in interface DataSetIterator
createEmptyDs()
public final double getValue(QDataSet ds)
DataSetIterator
getValue
in interface DataSetIterator
ds
- a dataset with compatible geometry as the iterator's geometry.public final QDataSet getRank0Value(QDataSet ds)
DataSetIterator
getRank0Value
in interface DataSetIterator
public final void putValue(WritableDataSet ds, double v)
DataSetIterator
putValue
in interface DataSetIterator
ds
- a writable dataset with compatible geometry as the iterator's geometry.v
- the value to insert.public void putRank0Value(WritableDataSet ds, QDataSet vds)
DataSetIterator
putRank0Value
in interface DataSetIterator
ds
- a writable dataset with compatible geometry as the iterator's geometry.vds
- the rank 0 value to insert