Using Class Methods
Inthecasewhereindex is of type int[],eachelementoftheindex vector
is an index along one dimension of the
MWLogicalArray object. The valid
range for any index is
1 <= index[i] <= N[i],whereN[i] is the size of the
ith dimension.
Exceptions
The set method throws the following exception:
IndexOutOfBoundsException
The specified index parameter is invalid.
Example—SettingaValueinaLogicalArray
Get and modify the value at A(2,3):
boolean[][] Adata = {{true, false, false},
{false, true, false}};
MWLogicalArray A = new MWLogicalArray(Adata);
int[] index = {2, 3};
Object d_out = A.get(index);
System.out.println("Array element A(2,3) is " +
d_out.toString() + "\n");
System.out.println("Setting A(2,3) to true\n");
A.set(index, true);
d_out = A.get(index);
System.out.println("Array element A(2,3) is " +
d_out.toString() + "\n");
When run, the example displays this output:
Array element A(2,3) is false
4-103
Komentarze do niniejszej Instrukcji