FreeWRL/FreeX3D  3.0.0
ConstMFTime.java
1 //AUTOMATICALLY GENERATED BY genfields.pl.
2 //DO NOT EDIT!!!!
3 
4 package vrml.field;
5 import vrml.*;
6 import java.io.BufferedReader;
7 import java.io.PrintWriter;
8 import java.io.IOException;
9 
10 public class ConstMFTime extends ConstMField {
11  public ConstMFTime() {
12  }
13 
14  public ConstMFTime(double[] value) {
15  this(value.length, value);
16  }
17 
18  public ConstMFTime(int size, double[] value) {
19  for (int i = 0; i < size; i++)
20  __vect.addElement(new ConstSFTime(value[i]));
21  }
22 
23  public void getValue(double[] value) {
24  __updateRead();
25  int size = __vect.size();
26  for (int i = 0; i < size; i++) {
27  ConstSFTime sfTime = (ConstSFTime) __vect.elementAt(i);
28  value[i] = sfTime.value;
29  }
30  }
31 
32  public double get1Value(int index) {
33  __update1Read(index);
34  return ((ConstSFTime) __vect.elementAt(index)).getValue();
35  }
36 
37  public String toString() {
38  __updateRead();
39  StringBuffer sb = new StringBuffer("[");
40  int size = __vect.size();
41  for (int i = 0; i < size; i++) {
42  if (i > 0) sb.append(", ");
43  sb.append(__vect.elementAt(i));
44  }
45  return sb.append("]").toString();
46  }
47 
48  public void __fromPerl(BufferedReader in) throws IOException {
49  __vect.clear();
50  String lenline = in.readLine();
51  //System.out.println ("__fromPerl, read in length as " + lenline);
52  //int len = Integer.parseInt(in.readLine());
53  int len = Integer.parseInt(lenline);
54  for (int i = 0; i < len; i++) {
55  ConstSFTime sf = new ConstSFTime();
56  sf.__fromPerl(in);
57  __vect.addElement(sf);
58  }
59  }
60 
61  public void __toPerl(PrintWriter out) throws IOException {
62  StringBuffer sb = new StringBuffer("");
63  int size = __vect.size();
64  //out.print(size);
65  for (int i = 0; i < size; i++) {
66  ((ConstSFTime) __vect.elementAt(i)).__toPerl(out);
67  if (i != (size-1)) out.print (", ");
68  }
69  //out.println();
70  }
71  //public void setOffset(String offs) { this.offset = offs; } //JAS2
72  //public String getOffset() { return this.offset; } //JAS2
73 }