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