2 import org.web3d.x3d.sai.*;
7 private static final int ROWS = 3;
14 public void getValue(
double[][] value)
throws ArrayIndexOutOfBoundsException {
18 StringTokenizer tokens;
21 if (RLreturn == null) {
22 rep = browser.SendEventOut(nodePtr, offset, datasize, dataType,
command);
27 tokens =
new StringTokenizer(rep);
29 lines = Integer.valueOf(tokens.nextToken()).intValue();
31 if (value.length < lines) {
32 throw new ArrayIndexOutOfBoundsException(
"MFVec3d getValue passed array of insufficient size");
35 for (count1=0; count1<lines; count1++) {
36 if ((value[count1]).length < ROWS) {
37 throw new ArrayIndexOutOfBoundsException(
"MFVec3d getValue passed array with sub array of insufficient size");
39 for(count2=0; count2<ROWS; count2++) {
40 value[count1][count2] = Double.valueOf(tokens.nextToken()).doubleValue();
44 public void getValue(
double[] value)
throws ArrayIndexOutOfBoundsException {
47 StringTokenizer tokens;
50 if (RLreturn == null) {
51 rep = browser.SendEventOut(nodePtr, offset, datasize, dataType,
command);
56 tokens =
new StringTokenizer(rep);
58 lines = Integer.valueOf(tokens.nextToken()).intValue();
60 if (value.length < (lines*ROWS)) {
61 throw new ArrayIndexOutOfBoundsException(
"MFVec3d getValue passed array of insufficient size");
64 for (count1=0; count1<(lines*ROWS); count1++) {
65 value[count1] = Double.valueOf(tokens.nextToken()).doubleValue();
68 public void get1Value(
int index,
double[] value)
throws ArrayIndexOutOfBoundsException {
72 StringTokenizer tokens;
76 if (RLreturn == null) {
77 rep = browser.SendEventOut(nodePtr, offset, datasize, dataType,
command);
82 tokens =
new StringTokenizer(rep);
84 lines = Integer.valueOf(tokens.nextToken()).intValue();
86 if (value.length < ROWS) {
87 throw new ArrayIndexOutOfBoundsException(
"MFVec3d get1Value passed array of insufficient size");
91 throw new ArrayIndexOutOfBoundsException(
"MFVec2f get1Value passed index out of bounds");
94 tval =
new double[lines][ROWS];
96 for (count1=0; count1<lines; count1++) {
97 for(count2=0; count2<ROWS; count2++) {
98 tval[count1][count2] = Double.valueOf(tokens.nextToken()).doubleValue();
102 for (count1=0; count1<ROWS; count1++) {
103 value[count1] = tval[index][count1];
106 public void setValue(
int size,
double[] value)
throws ArrayIndexOutOfBoundsException {
110 if ((size*ROWS) > value.length) {
111 throw new ArrayIndexOutOfBoundsException(
"MFVec3d setValue not passed enough values to complete request");
116 for (count = 0; count < (size*ROWS); count++) {
117 val = val +
" " + value[count];
119 browser.newSendEvent(
this, val);
121 public void setValue(
int size,
double[][] value)
throws ArrayIndexOutOfBoundsException {
125 if (size > value.length) {
131 for (count = 0; count < size; count++) {
132 if ((value[count]).length < ROWS) {
133 throw new ArrayIndexOutOfBoundsException(
"MFVec3d setValue passed degenerate vector value");
135 val = val +
" " + value[count][0] +
" " + value[count][1] +
" " + value[count][2];
137 browser.newSendEvent(
this, val);
139 public void set1Value(
int index,
double[] value)
throws ArrayIndexOutOfBoundsException {
140 if (value.length < ROWS) {
141 throw new ArrayIndexOutOfBoundsException(
"MFVec3d set1Value passed degenerate vector value");
143 browser.newSendEvent(
this,
" ONEVAL " + index +
" " + value[0] +
" " + value[1] +
" " + value[2]);
145 public void append(
double[] value) {
150 StringTokenizer tokens;
155 if (RLreturn == null) {
156 rep = browser.SendEventOut(nodePtr, offset, datasize, dataType,
command);
161 tokens =
new StringTokenizer(rep);
163 lines = Integer.valueOf(tokens.nextToken()).intValue();
164 size = value.length/ROWS;
166 val =
" " + (lines+size);
168 for (count = 0; count < lines; count++) {
169 val = val +
" " + Double.valueOf(tokens.nextToken()).doubleValue() +
" " + Double.valueOf(tokens.nextToken()).doubleValue() +
" " + Double.valueOf(tokens.nextToken()).doubleValue();
172 for (count = 0; count < value.length; count++) {
173 if (value.length < ROWS) {
174 throw new ArrayIndexOutOfBoundsException(
"MFVec2f append degenerate vector value received");
177 val = val +
" " + value[count] +
" " + value[count+1] +
" " + value[count+2];
182 browser.newSendEvent(
this, val);
184 public void insertValue(
int index,
double[] value) {
189 StringTokenizer tokens;
194 if (RLreturn == null) {
195 rep = browser.SendEventOut(nodePtr, offset, datasize, dataType,
command);
200 tokens =
new StringTokenizer(rep);
202 lines = Integer.valueOf(tokens.nextToken()).intValue();
203 size = value.length/ROWS;
205 val =
" " + (lines+size);
207 for (count = 0; count < index; count++) {
208 val = val +
" " + Double.valueOf(tokens.nextToken()).doubleValue() +
" " + Double.valueOf(tokens.nextToken()).doubleValue() +
" " + Double.valueOf(tokens.nextToken()).doubleValue();
211 for (count = 0; count < value.length; count++) {
212 if (value.length < ROWS) {
213 throw new ArrayIndexOutOfBoundsException(
"MFVec2f insert degenerate vector value received");
216 val = val +
" " + value[count] +
" " + value[count+1] +
" " + value[count+2];
221 for (count = (index+size); count < (lines+size); count++) {
222 val = val +
" " + Double.valueOf(tokens.nextToken()).doubleValue() +
" " + Double.valueOf(tokens.nextToken()).doubleValue() +
" " + Double.valueOf(tokens.nextToken()).doubleValue();
225 browser.newSendEvent(
this, val);