public class PositionIterator extends IndexIterator
Class to provide iteration through a dataset
Instantiate an iterator and use it in a while loop:
Dataset ds = DatasetFactory.createLinearSpace(DoubleDataset.class, 0, 10, 0.25);
PositionIterator iter = ds.getPositionIterator();
int[] pos = iter.getPos()
while (iter.hasNext()) {
ds.set(1.2, pos);
}
index| Constructor and Description |
|---|
PositionIterator(int[] shape)
Constructor for an iterator over elements of a dataset that are within
the shape
|
PositionIterator(int[] shape,
int... axes)
Constructor for an iterator that misses out several axes
|
PositionIterator(int[] shape,
int[] start,
int[] stop,
int[] step,
int[] axes)
Constructor for an iterator that misses out several axes
|
PositionIterator(int[] shape,
Slice[] slice,
int[] axes)
Constructor for an iterator that misses out several axes
|
PositionIterator(int offset,
int[] shape)
Constructor for an iterator over a single item broadcasted to given shape
|
PositionIterator(int offset,
SliceND slice,
int... axes)
Constructor for an iterator that misses out several axes
|
PositionIterator(SliceND slice,
int... axes)
Constructor for an iterator that misses out several axes
|
| Modifier and Type | Method and Description |
|---|---|
boolean[] |
getOmit() |
int[] |
getPos() |
int[] |
getShape() |
int[] |
getStop() |
boolean |
hasNext() |
void |
reset()
Reset iterator
|
public PositionIterator(int[] shape)
shape - to usepublic PositionIterator(int offset, int[] shape)
offset - offset to single itemshape - to usepublic PositionIterator(int[] shape, int... axes)
shape - to useaxes - missing axes, can be null for full datasetpublic PositionIterator(int[] shape, Slice[] slice, int[] axes)
shape - to useslice - for each dimensionaxes - missing axespublic PositionIterator(int[] shape, int[] start, int[] stop, int[] step, int[] axes)
shape - to usestart - start point, may be nullstop - stop point, may be nullstep - step, may be nullaxes - missing axespublic PositionIterator(SliceND slice, int... axes)
slice - an n-D sliceaxes - missing axespublic PositionIterator(int offset, SliceND slice, int... axes)
offset - offset to start withslice - an n-D sliceaxes - missing axespublic boolean hasNext()
hasNext in class IndexIteratorpublic int[] getPos()
getPos in class IndexIteratorpublic boolean[] getOmit()
public void reset()
IndexIteratorreset in class IndexIteratorpublic int[] getShape()
getShape in class IndexIteratorpublic int[] getStop()
Copyright © 2014–2022 Eclipse Foundation. All rights reserved.