View Javadoc

1   package org.lcsim.geometry.compact.converter.lcdd.util;
2   
3   import org.jdom.DataConversionException;
4   
5   /**
6    * 
7    * @author tonyj
8    */
9   public class Box extends Solid {
10      /** Creates a new instance of Box */
11      public Box(String name) {
12          super("box", name);
13          setAttribute("x", String.valueOf(0.));
14          setAttribute("y", String.valueOf(0.));
15          setAttribute("z", String.valueOf(0.));
16      }
17  
18      public Box(String name, double x, double y, double z) {
19          super("box", name);
20          setX(x);
21          setY(y);
22          setZ(z);
23      }
24  
25      public void setX(double x) {
26          setAttribute("x", String.valueOf(x));
27      }
28  
29      public void setY(double y) {
30          setAttribute("y", String.valueOf(y));
31      }
32  
33      public void setZ(double z) {
34          setAttribute("z", String.valueOf(z));
35      }
36  
37      public double getX() {
38          try {
39              return getAttribute("x").getDoubleValue();
40          } catch (DataConversionException x) {
41              throw new RuntimeException(x);
42          }
43      }
44  
45      public double getY() {
46          try {
47              return getAttribute("y").getDoubleValue();
48          } catch (DataConversionException x) {
49              throw new RuntimeException(x);
50          }
51      }
52  
53      public double getZ() {
54          try {
55              return getAttribute("z").getDoubleValue();
56          } catch (DataConversionException x) {
57              throw new RuntimeException(x);
58          }
59      }
60  }