Guidelines for Working with MWArray Classes
These examples construct a scalar logical array initialized to false:
MWLogicalArray a1 = new MWLogicalArray(false);
MWLogicalArray a2 = new MWLogicalArray(0);
MWLogicalArray a3 = new MWLogicalArray("false");
MWLogicalArray a4 = new MWLogicalArray(new Boolean(false));
As with MWNumericArray, MWLogicalArrays can be constructed with
multidimension al Java arrays. Here are some examples:
boolean[][] x1 = {{true, false}, {false, true}};
int[][] x2 = {{1, 0}, {0, 1}};
Boolean[][] x3 = {{new Boolean(true), new Boolean(false)},
{new Boolean(false), new Boolean(true)}};
String[][] x4 = {{"true", "false"},
{"false", "true"}};
boolean[][][] x5 = {
{{ true, false, true},
{ false, true, false}},
{{ true, false, true},
{ false, true, false}}
};
MWLogicalArray a1 = new MWLogicalArray(x1);
MWLogicalArray a2 = new MWLogicalArray(x2);
MWLogicalArray a3 = new MWLogicalArray(x3);
MWLogicalArray a4 = new MWLogicalArray(x4);
MWLogicalArray a5 = new MWLogicalArray(x5);
Using Static Factory Methods to Create MWLogicalArrays
The following table lists the static factory methods of MWLogicalArray.
Factory Method Usage
newInstance(int[])
New logical array. Values are
initialized to
false.
4-23
Komentarze do niniejszej Instrukcji