public class SliceIterator extends IndexIterator
SliceIterator
class is use to run over a Slice of a Dataset.
This is an Iterator thats allows the programmer to traverse the elements of a sliced Dataset and obtain the current position, the starts, steps,
shapes.
Moreover, there is possibilities to set the start point to begin at the wanted position.index
Constructor and Description |
---|
SliceIterator(int[] shape,
int length,
int[] sshape)
Constructs an SliceIterator Object, which can iterate over sliced
Datasets elements, by default the start set to 0 and with a step of 1.
|
SliceIterator(int[] shape,
int length,
int[] sshape,
int isize)
Constructs an SliceIterator Object, which can iterate over sliced
Datasets elements, by default the start set to 0 and with a step of 1.
|
SliceIterator(int[] shape,
int length,
int[] start,
int[] sshape)
Constructs an SliceIterator Object, which can iterate over sliced
Datasets elements, by default the start set to 0 and with a step of 1.
|
SliceIterator(int[] shape,
int length,
int[] start,
int[] sshape,
int isize)
Constructs an SliceIterator Object, which can iterate over sliced
Datasets elements, by default the start set to 0 and with a step of 1.
|
SliceIterator(int[] shape,
int length,
int[] start,
int[] step,
int[] sshape)
Constructs an SliceIterator Object, which can iterate over sliced
Datasets elements, by default the start set to 0 and with a step of 1.
|
SliceIterator(int[] shape,
int length,
int[] start,
int[] step,
int[] sshape,
int isize)
Constructs an SliceIterator Object, which can iterate over sliced
Datasets elements, by default the start set to 0 and with a step of 1.
|
SliceIterator(int[] shape,
int length,
int isize,
SliceND slice)
Constructs an SliceIterator Object, which can iterate over sliced
Datasets elements, by default the start set to 0 and with a step of 1.
|
SliceIterator(int[] shape,
int length,
SliceND slice)
Constructs an SliceIterator Object, which can iterate over sliced
Datasets elements, by default the start set to 0 and with a step of 1.
|
Modifier and Type | Method and Description |
---|---|
int[] |
getPos()
Returns the current position of the iterator.
|
int[] |
getShape()
Returns an array of the Slices shapes.
|
int[] |
getStart()
Returns an array of starts indexes.
|
int[] |
getStep()
Returns an array of steps
|
boolean |
hasNext()
Returns
true if there is an other element after the current
Slice. |
void |
reset()
Reset the Iterator to the first Slice.
|
void |
setStart(int... newStart)
Set the starts indexes to new positions,
if null the start index
is set by default to 0 |
public SliceIterator(int[] shape, int length, int[] sshape)
shape
- Array of shapes of the Datasetlength
- Length of entire data arraysshape
- Shape of the new dataset, i.e. slicepublic SliceIterator(int[] shape, int length, int[] start, int[] sshape)
shape
- Array of shapes of the Datasetlength
- Length of entire data arraystart
- Array of starts indexes, may be null
sshape
- Shape of the new dataset, i.e. slicepublic SliceIterator(int[] shape, int length, int[] sshape, int isize)
shape
- Array of shapes of the Datasetlength
- Length of entire data arraysshape
- Shape of the new dataset, i.e. sliceisize
- Number of elements in an itempublic SliceIterator(int[] shape, int length, int[] start, int[] sshape, int isize)
shape
- Array of shapes of the Datasetlength
- Length of entire data arraystart
- Array of starts indexes, may be null
sshape
- Shape of the new dataset, i.e. sliceisize
- Number of elements in an itempublic SliceIterator(int[] shape, int length, int[] start, int[] step, int[] sshape)
shape
- Array of shapes of the Datasetlength
- Length of entire data arraystart
- Array of starts indexes, may be null
step
- Array of steps, may be null
, but can't be 0sshape
- shape of new dataset, i.e. slicepublic SliceIterator(int[] shape, int length, SliceND slice)
shape
- Array of shapes of the Datasetlength
- Length of entire data arrayslice
- SliceND to iterate onpublic SliceIterator(int[] shape, int length, int isize, SliceND slice)
shape
- Array of shapes of the Datasetlength
- Length of entire data arrayisize
- Number of elements in an itemslice
- SliceND to iterate onpublic SliceIterator(int[] shape, int length, int[] start, int[] step, int[] sshape, int isize)
shape
- Array of shapes of the Datasetlength
- Length of entire data arraystart
- Array of starts indexes, may be null
step
- Array of steps, may be null
, but can't be 0sshape
- Shape of the new dataset, i.e. sliceisize
- Number of elements in an itempublic void setStart(int... newStart)
if null
the start index
is set by default to 0newStart
- Array of new starts indexes (prefix with zeros if necessary),
may be null
public void reset()
reset
in class IndexIterator
public boolean hasNext()
true
if there is an other element after the current
Slice.hasNext
in class IndexIterator
true
if the iteration has more Slice, false
in
the other casepublic int[] getStart()
public int[] getPos()
getPos
in class IndexIterator
public int[] getStep()
public int[] getShape()
getShape
in class IndexIterator
Copyright © 2014–2019 Eclipse Foundation. All rights reserved.