2 import org.web3d.x3d.sai.*;
7 private static final int ROWS = 2;
14 public void getValue(
float[][] 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(
"MFVec2f getValue passed array of insufficient size");
35 for (count1=0; count1<lines; count1++) {
36 if ((value[count1]).length < ROWS) {
37 throw new ArrayIndexOutOfBoundsException(
"MFVec2f getValue passed array containing degenerate subarray value");
39 for (count2=0; count2<ROWS; count2++) {
40 value[count1][count2] = Float.valueOf(tokens.nextToken()).floatValue();
44 public void getValue(
float[] value)
throws ArrayIndexOutOfBoundsException {
48 StringTokenizer tokens;
51 if (RLreturn == null) {
52 rep = browser.SendEventOut(nodePtr, offset, datasize, dataType,
command);
57 tokens =
new StringTokenizer(rep);
59 lines = Integer.valueOf(tokens.nextToken()).intValue();
61 if (value.length < (lines*ROWS)) {
62 throw new ArrayIndexOutOfBoundsException(
"MFVec2f getValue passed array of insufficient size");
65 for (count1=0; count1<(lines*ROWS); count1++) {
66 value[count1] = Float.valueOf(tokens.nextToken()).floatValue();
69 public void get1Value(
int index,
float[] value)
throws ArrayIndexOutOfBoundsException {
74 StringTokenizer tokens;
77 if (RLreturn == null) {
78 rep = browser.SendEventOut(nodePtr, offset, datasize, dataType,
command);
83 tokens =
new StringTokenizer(rep);
85 lines = Integer.valueOf(tokens.nextToken()).intValue();
87 if (value.length < ROWS) {
88 throw new ArrayIndexOutOfBoundsException(
"MFVec2f get1Value passed array of insufficient size");
92 throw new ArrayIndexOutOfBoundsException(
"MFVec2f get1Value passed index out of bounds");
95 tval =
new float[lines][ROWS];
97 for (count1=0; count1<lines; count1++) {
98 for (count2=0; count2<ROWS; count2++) {
99 tval[count1][count2] = Float.valueOf(tokens.nextToken()).floatValue();
103 for (count1=0; count1<ROWS; count1++) {
104 value[count1] = tval[index][count1];
107 public void setValue(
int size,
float[] value)
throws ArrayIndexOutOfBoundsException {
111 if (value.length < (size*ROWS)) {
112 throw new ArrayIndexOutOfBoundsException(
"MFVec2f setValue passed array containing an insufficient number of values");
117 for (count = 0; count < (size*ROWS); count++) {
118 val = val +
" " + value[count];
120 browser.newSendEvent(
this, val);
122 public void setValue(
int size,
float[][] value)
throws ArrayIndexOutOfBoundsException {
126 if (value.length < size) {
132 for (count = 0; count < size; count++) {
133 if ((value[count]).length < ROWS) {
134 throw new ArrayIndexOutOfBoundsException(
"MFVec2f setValue degenerate vector value received");
136 val = val +
" " + value[count][0] +
" " + value[count][1];
138 browser.newSendEvent(
this, val);
140 public void set1Value(
int index,
float[] value)
throws ArrayIndexOutOfBoundsException {
141 if (value.length < ROWS) {
142 throw new ArrayIndexOutOfBoundsException(
"MFVec2f set1Value degenerate vector value received");
144 browser.newSendEvent(
this,
" ONEVAL " + index +
" " + value[0] +
" " + value[1]);
146 public void append(
float[] value) {
151 StringTokenizer tokens;
156 if (RLreturn == null) {
157 rep = browser.SendEventOut(nodePtr, offset, datasize, dataType,
command);
162 tokens =
new StringTokenizer(rep);
164 lines = Integer.valueOf(tokens.nextToken()).intValue();
165 size = value.length/ROWS;
167 val =
" " + (lines+size);
169 for (count = 0; count < lines; count++) {
170 val = val +
" " + Float.valueOf(tokens.nextToken()).floatValue() +
" " + Float.valueOf(tokens.nextToken()).floatValue();
173 for (count = 0; count < value.length; count++) {
174 if (value.length < ROWS) {
175 throw new ArrayIndexOutOfBoundsException(
"MFVec2f append degenerate vector value received");
178 val = val +
" " + value[count] +
" " + value[count+1];
182 browser.newSendEvent(
this, val);
184 public void insertValue(
int index,
float[] 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 +
" " + Float.valueOf(tokens.nextToken()).floatValue() +
" " + Float.valueOf(tokens.nextToken()).floatValue();
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];
220 for (count = (index+size); count < (lines+size); count++) {
221 val = val +
" " + Float.valueOf(tokens.nextToken()).floatValue() +
" " + Float.valueOf(tokens.nextToken()).floatValue();
224 browser.newSendEvent(
this, val);