Package ucar.array
Class Index
- java.lang.Object
-
- ucar.array.Index
-
public class Index extends Object
Indexes for Arrays. An Index refers to a particular element of an array. This is a generalization of index as int[]. A scalar has effectively int[1] = {1} Mutable.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]
getCurrentIndex()
Get the current index as int[] .Index
incr(int dim)
Increment the ith dimension.static Index
of(int... current)
An Index with the current value passed in.static Index
ofRank(int rank)
An Index of the given rank.Index
set(int... index)
Set the current element's index.Index
set0(int v)
set current element at dimension 0 to vIndex
set1(int v)
set current element at dimension 1 to vIndex
set2(int v)
set current element at dimension 2 to vIndex
set3(int v)
set current element at dimension 3 to vIndex
set4(int v)
set current element at dimension 4 to vIndex
set5(int v)
set current element at dimension 5 to vIndex
set6(int v)
set current element at dimension 6 to vIndex
setDim(int dim, int value)
Set current element at dimension dim
-
-
-
Constructor Detail
-
Index
public Index(Index from)
Copy constructor.
-
-
Method Detail
-
ofRank
public static Index ofRank(int rank)
An Index of the given rank.
-
of
public static Index of(int... current)
An Index with the current value passed in.
-
incr
public Index incr(int dim)
Increment the ith dimension.- Parameters:
dim
- which dimension- Returns:
- the incremented Index.
-
getCurrentIndex
public int[] getCurrentIndex()
Get the current index as int[] .
-
setDim
public Index setDim(int dim, int value)
Set current element at dimension dim- Parameters:
dim
- set this dimensionvalue
- to this value
-
set0
public Index set0(int v)
set current element at dimension 0 to v
-
set1
public Index set1(int v)
set current element at dimension 1 to v
-
set2
public Index set2(int v)
set current element at dimension 2 to v
-
set3
public Index set3(int v)
set current element at dimension 3 to v
-
set4
public Index set4(int v)
set current element at dimension 4 to v
-
set5
public Index set5(int v)
set current element at dimension 5 to v
-
set6
public Index set6(int v)
set current element at dimension 6 to v
-
set
public Index set(int... index)
Set the current element's index.- Parameters:
index
- set current value to these values, number of values must be equal to the rank.- Throws:
ArrayIndexOutOfBoundsException
- if index.length != rank.
-
-