Package dap4.core.util
Class Odometer
- java.lang.Object
-
- dap4.core.util.Odometer
-
- Direct Known Subclasses:
MultiOdometer,ScalarOdometer
public class Odometer extends Object implements Iterator<Index>
A classic implementation of an odometer taken from the netcdf-c code. Extended to provide iterator interface
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classOdometer.STATE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Odometerfactory(List<Slice> slices)static Odometerfactory(List<Slice> slices, List<DapDimension> dimset)static OdometerfactoryScalar()List<Slice>getSlices()List<Odometer>getSubOdometers()booleanhasNext()longindex()Compute the linear index from the current odometer indices.Indexindices()Return current set of indicesbooleanisMulti()Indexnext()intrank()Return odometer rankvoidremove()protected voidreset()Sliceslice(int i)Return ith sliceintstep(int firstpos, int lastpos)StringtoString()longtotalSize()Compute the total number of elements.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Field Detail
-
state
protected Odometer.STATE state
-
ismulti
protected boolean ismulti
-
rank
protected int rank
-
dimset
protected List<DapDimension> dimset
-
index
protected Index index
-
endpoint
protected long[] endpoint
-
-
Constructor Detail
-
Odometer
public Odometer()
-
Odometer
public Odometer(List<Slice> set) throws DapException
- Throws:
DapException
-
Odometer
public Odometer(List<Slice> set, List<DapDimension> dimset) throws DapException
- Throws:
DapException
-
-
Method Detail
-
factoryScalar
public static Odometer factoryScalar()
-
factory
public static Odometer factory(List<Slice> slices) throws DapException
- Throws:
DapException
-
factory
public static Odometer factory(List<Slice> slices, List<DapDimension> dimset) throws DapException
- Throws:
DapException
-
reset
protected void reset()
-
rank
public int rank()
Return odometer rank
-
slice
public Slice slice(int i)
Return ith slice
-
index
public long index()
Compute the linear index from the current odometer indices.
-
indices
public Index indices()
Return current set of indices
-
totalSize
public long totalSize()
Compute the total number of elements.
-
step
public int step(int firstpos, int lastpos)
-
isMulti
public boolean isMulti()
-
-