2 import org.web3d.x3d.sai.*;
7 static final int ROWS = 4;
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(
"MFRotation getValue passed array of insufficient size");
35 for (count1 = 0; count1 < lines; count1++) {
36 for (count2=0; count2<ROWS; count2++) {
37 value[count1][count2] = Float.valueOf(tokens.nextToken()).floatValue();
42 public void getValue(
float[] value)
throws ArrayIndexOutOfBoundsException {
45 StringTokenizer tokens;
48 if (RLreturn == null) {
49 rep = browser.SendEventOut(nodePtr, offset, datasize, dataType,
command);
54 tokens =
new StringTokenizer(rep);
56 lines = Integer.valueOf(tokens.nextToken()).intValue();
58 if (value.length < (lines*ROWS)) {
59 throw new ArrayIndexOutOfBoundsException(
"MFRotation getValue passed array of insufficient size");
62 for (count1 = 0; count1 < (lines*ROWS); count1++) {
63 value[count1] = Float.valueOf(tokens.nextToken()).floatValue();
67 public void get1Value(
int index,
float[] value) {
72 StringTokenizer tokens;
75 if (RLreturn == null) {
76 rep = browser.SendEventOut(nodePtr, offset, datasize, dataType,
command);
81 tokens =
new StringTokenizer(rep);
83 lines = Integer.valueOf(tokens.nextToken()).intValue();
85 if (value.length < ROWS) {
86 throw new ArrayIndexOutOfBoundsException(
"MFRotation get1Value passed array of insufficient size");
89 throw new ArrayIndexOutOfBoundsException(
"MFRotation get1Value passed index out of bounds");
92 tval =
new float[lines][ROWS];
94 for (count1 = 0; count1 < lines; count1++) {
95 for (count2=0; count2<ROWS; count2++) {
96 tval[count1][count2] = Float.valueOf(tokens.nextToken()).floatValue();
100 for (count1 = 0; count1 < ROWS; count1++) {
101 value[count1] = tval[index][count1];
105 public void setValue(
int numRotations,
float[] value)
throws ArrayIndexOutOfBoundsException {
109 if (numRotations > (value.length % ROWS)) {
110 numRotations = (value.length % ROWS);
113 if ((numRotations*ROWS) != (value.length)) {
114 throw new ArrayIndexOutOfBoundsException(
"MFRotation setValue passed degenrate rotation value");
117 val =
" " + numRotations;
119 for (count = 0; count < (numRotations * ROWS); count++) {
120 val = val +
" " + value[count];
123 browser.newSendEvent(
this, val);
126 public void setValue(
int numRotations,
float[][] value)
throws ArrayIndexOutOfBoundsException {
130 if (numRotations > value.length) {
131 numRotations = value.length;
134 val =
" " + numRotations;
135 for (count = 0; count < numRotations; count++) {
136 if (value[count].length < ROWS) {
137 throw new ArrayIndexOutOfBoundsException(
"MFRotation setValue passed degenerate rotation value");
139 val = val +
" " + value[count][0] +
" " + value[count][1] +
" " + value[count][2] +
" " + value[count][3];
141 browser.newSendEvent(
this, val);
143 public void set1Value(
int index,
float[] value) {
144 browser.newSendEvent(
this,
" ONEVAL " + index +
" " + value[0] +
" " + value[1] +
" " + value[2] +
" " + value[3]);
147 public void append(
float[] value) {
151 StringTokenizer tokens;
155 if (RLreturn == null) {
156 rep = browser.SendEventOut(nodePtr, offset, datasize, dataType,
command);
161 tokens =
new StringTokenizer(rep);
162 lines = Integer.valueOf(tokens.nextToken()).intValue();
164 append_size = value.length;
166 if ((append_size % ROWS)!= 0) {
167 throw new ArrayIndexOutOfBoundsException(
"Rotation value array contains insufficient number of colors");
170 val =
" " + (lines + (append_size/ROWS));
172 for (count1 = 0; count1 < (lines*ROWS); count1++) {
173 val = val + tokens.nextToken();
176 for (count1 = 0; count1 < append_size; count1++) {
177 val = val +
" " + value[count1];
180 browser.newSendEvent(
this, val);
182 public void insertValue(
int index,
float[] value) {
186 StringTokenizer tokens;
190 if (RLreturn == null) {
191 rep = browser.SendEventOut(nodePtr, offset, datasize, dataType,
command);
196 tokens =
new StringTokenizer(rep);
197 lines = Integer.valueOf(tokens.nextToken()).intValue();
199 insert_size = value.length;
201 if ((insert_size % ROWS) != 0) {
202 throw new ArrayIndexOutOfBoundsException(
"Rotation value array contains insufficient number of colors");
205 if ((index > (lines/ROWS)) || (index < 0)) {
206 throw new ArrayIndexOutOfBoundsException(
"MFRotation insertValue passed index out of bounds");
209 val =
" " + (lines + (insert_size/ROWS));
211 for (count1 = 0; count1 < (index*ROWS); count1++) {
212 val = val + tokens.nextToken();
215 for (count1 = 0; count1 < insert_size; count1++) {
216 val = val +
" " + value[count1];
219 for (count1 = (index*ROWS); count1 < (lines*ROWS); count1++) {
220 val = val + tokens.nextToken();
223 browser.newSendEvent(
this, val);