User`s guide
4 Using MWArra y Classes
index
Index of the requested element in the MWStructArray
In the case where index is of type int, the valid range for index is 1<=index
<= N
,whereN is the total number of elements in the array.
Inthecasewhere
index is of type int[],eachelementoftheindex vector
is an index along one dimension of the
MWStructArray object. T he valid
range for any index is
1 <= index[i] <= N[i],whereN[i] is the size of the
ith dimension.
Exceptions
The get method throws the following exception:
IndexOutOfBoundsException
The specified index parameter is invalid.
Example — Getting Struct ure Array Data with get
Get the data stored in field f2 at index (1,1) of MWStructArray object S:
int[] sdims = {1, 2};
String[] sfields = {"f1", "f2", "f3"};
Integer val = new Integer(555);
MWStructArray S = new MWStructArray(sdims, sfields);
int[] index = {1, 1};
S.set(sfields[2], index, val);
Object d_out = S.get(sfields[2], index);
System.out.println("Structure data S(1,1).f2 is " +
d_out.toString());
When run, the example displays this output:
4-126