View Javadoc

1   package org.lcsim.geometry.compact;
2   
3   import org.jdom.DataConversionException;
4   import org.jdom.Element;
5   
6   /**
7    * The class created when a constant definition is found in the XML file.
8    * @author tonyj
9    */
10  public class Constant
11  {
12     private String name;
13     private double value;
14     
15     public Constant(String name, double value)
16     {
17  	   this.name = name;
18  	   this.value = value;
19     }
20     
21     /**
22      * Construct a new Constant
23      * @param constant The JDOM element corresponding to the constant definition.
24      * @throws org.jdom.DataConversionException If an XML error occurs while handling the node.
25      */
26     protected Constant(Element constant) throws DataConversionException
27     {
28        name = constant.getAttributeValue("name");
29        value = constant.getAttribute("value").getDoubleValue();
30     }
31     /**
32      * Get the name of this constant
33      * @return The name.
34      */
35     public String getName()
36     {
37        return name;
38     }
39     /**
40      * The value of this constant (after expression evaluation).
41      * @return The value.
42      */
43     public double getValue()
44     {
45        return value;
46     }
47  }