## org.das2.qds.DataSetIterator

Iterator for accessing each value of a dataset. See https://jfaden.net/jenkins/job/autoplot-test037/ws/dataSetIterator.jy

## createEmptyDs

createEmptyDs( ) → org.das2.qds.DDataSet

return a dataset that will have the same geometry at the dataset implied by each dimension iterator. This is introduced to encapsulate this dangerous code to here where it could be done correctly. Right now this assumes QUBES. Do not pass the result of this into the putValue of this iterator, the result should have its own iterator.

### Returns:

a dataset that will have the same geometry at the dataset implied by each dimension iterator.

### See Also:

QubeDataSetIterator#createEmptyDs()
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getRank0Value

getRank0Value( QDataSet ds ) → QDataSet

get the rank 0 data set the current iterator position.

### Parameters

ds - a QDataSet

### Returns:

units
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getValue

getValue( QDataSet ds ) → double

get the value from ds at the current iterator position.

### Parameters

ds - a dataset with compatible geometry as the iterator's geometry.

### Returns:

the value of ds at the current iterator position.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## hasNext

hasNext( ) → boolean

return true while the iterator has a next element.

### Returns:

true while the iterator has a next element.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## index

index( int dim ) → int

return the current index for the dimension.

### Parameters

dim - the dimension number (0<=dim<inputRank)

### Returns:

the current index.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## length

length( int dim ) → int

return the length of the dimension, or the length reported by the iterator. Use caution, because this does not imply that the result of the iteration is a qube and does not account for slices. (TODO: does this mean that as we iterate through, the length depends on the current index?)

### Parameters

dim - the dimension number (0<=dim<inputRank)

### Returns:

the length of the dimension
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## next

next( ) → void

iterate to the next position.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## putRank0Value

putRank0Value( org.das2.qds.WritableDataSet ds, QDataSet v ) → void

replace the value in ds at the current iterator position.

### Parameters

ds - a writable dataset with compatible geometry as the iterator's geometry.
v - the rank 0 value to insert

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## putValue

putValue( org.das2.qds.WritableDataSet ds, double v ) → void

replace the value in ds at the current iterator position.

### Parameters

ds - a writable dataset with compatible geometry as the iterator's geometry.
v - the value to insert.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## rank

rank( ) → int

return the rank of the dataset which the iterator will walk through. Note this needn't be the same rank as the dataset! For example, when QubeDataSetIterator walks through ds[:,0,:], the rank is 2 even though ds is rank 3.

### Returns:

the rank of the dataset which the iterator will walk through.
[search for examples] [view on GitHub] [view on old javadoc] [view source]