Package dap4.dap4lib
Class D4Index
- java.lang.Object
-
- ucar.ma2.Index
-
- dap4.dap4lib.D4Index
-
- All Implemented Interfaces:
Cloneable
public class D4Index extends ucar.ma2.Index
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCurrentCounter(int i)intindex()Compute the linear index from the current odometer indices.static List<Slice>indexToSlices(ucar.ma2.Index indices)Convert ucar.ma2.Index to list of slicesbooleanisScalar()static ucar.ma2.IndexoffsetToIndex(int offset, int[] shape)Given an offset (single index) and a set of dimensions compute the set of dimension indices that correspond to the offset.static D4IndexslicesToIndex(List<Slice> slices)If a set of slices refers to a single position, then return the corresponding Index.StringtoString()
-
-
-
Field Detail
-
SCALAR
public static final D4Index SCALAR
-
-
Constructor Detail
-
D4Index
public D4Index(int rank)
-
D4Index
public D4Index(int[] _shape)
-
D4Index
public D4Index(D4Index index)
-
D4Index
public D4Index(int[] indices, int[] dimsizes)
-
-
Method Detail
-
offsetToIndex
public static ucar.ma2.Index offsetToIndex(int offset, int[] shape)Given an offset (single index) and a set of dimensions compute the set of dimension indices that correspond to the offset.
-
indexToSlices
public static List<Slice> indexToSlices(ucar.ma2.Index indices) throws DapException
Convert ucar.ma2.Index to list of slices- Parameters:
indices- to convert- Returns:
- list of corresponding slices
- Throws:
DapException
-
slicesToIndex
public static D4Index slicesToIndex(List<Slice> slices) throws DapException
If a set of slices refers to a single position, then return the corresponding Index. Otherwise, throw Exception.- Parameters:
slices-- Returns:
- Index corresponding to slices
- Throws:
DapException
-
toString
public String toString()
- Overrides:
toStringin classucar.ma2.Index
-
index
public int index()
Compute the linear index from the current odometer indices. Not quite the same as super.currentElement(), which does not use shape[], but does use the super's "unexpected" notion of stride, although result may be same.
-
getCurrentCounter
public int getCurrentCounter(int i)
-
isScalar
public boolean isScalar()
-
-