FreeWRL / FreeX3D 4.3.0
EventOutMFInt32.java
1// read in a multi Int32 value from the FreeWRL browser.
2
3package vrml.external.field;
4import vrml.external.Browser;
5import vrml.external.field.FieldTypes;
6import java.util.*;
7
8public class EventOutMFInt32 extends EventOutMField {
9 public EventOutMFInt32() { EventType = FieldTypes.MFINT32; }
10
11 public int[] getValue() {
12 int [] rval;
13 int lines;
14 int rows;
15 int count1;
16 int count2;
17 StringTokenizer tokens;
18 String rep;
19
20 if (RLreturn == null) {
21 rep = Browser.SendEventOut (nodeptr, offset, datasize, datatype, command);
22 } else {
23 rep = RLreturn;
24 }
25 // get the number of lines of code to come back.
26
27 rows = 1;
28
29 tokens = new StringTokenizer (rep);
30
31 //System.out.println ("DEBUG: EventOutMFInt32 getValue - rep = " + rep);
32 lines = Integer.valueOf(tokens.nextToken()).intValue();
33 //System.out.println ("DEBUG: read in as a token " + lines);
34
35 rval = new int [lines];
36
37 // now, read in the lines.
38 for (count1=0; count1<lines; count1++) {
39 rval[count1] = Integer.valueOf(tokens.nextToken()).intValue();
40
41 }
42
43 // for the getSize call
44 sizeof = lines;
45 return rval;
46 }
47
48
49 public int get1Value(int index) {
50 int all[] = getValue();
51
52 return all[index];
53 }
54}