FreeWRL/FreeX3D  3.0.0
SFBool.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 SFBool extends Field {
11  boolean value;
12 
13  public SFBool() { }
14 
15  public SFBool(boolean value) {
16  this.value = value;
17  }
18 
19  public boolean getValue() {
20  __updateRead();
21  return value;
22  }
23 
24  public void setValue(boolean value) {
25  this.value = value;
26  __updateWrite();
27  }
28 
29 
30  public void setValue(ConstSFBool sfBool) {
31  sfBool.__updateRead();
32  value = sfBool.value;
33  __updateWrite();
34  }
35 
36  public void setValue(SFBool sfBool) {
37  sfBool.__updateRead();
38  value = sfBool.value;
39  __updateWrite();
40  }
41 
42 
43  public String toString() {
44  __updateRead();
45  return value ? "TRUE" : "FALSE";
46  }
47 
48  public void __fromPerl(BufferedReader in) throws IOException {
49 
50  String myline;
51  //System.out.println ("fromPerl, Bool");
52  myline = in.readLine();
53  // direct from perl, will be 0 or 1, from a route, TRUE, FALSE
54  value = (myline.equals("TRUE") || myline.equals("1"));
55  //System.out.println ("reading in a boolean value is " + value
56  // + " for string " + myline);
57 
58  }
59 
60  public void __toPerl(PrintWriter out) throws IOException {
61  out.print (value);
62  //out.println();
63  }
64  //public void setOffset(String offs) { this.offset = offs; } //JAS2
65  //public String getOffset() { return this.offset; } //JAS2
66 }