View Javadoc

1   package org.lcsim.geometry.compact.converter.lcdd.util;
2   
3   import org.jdom.Attribute;
4   
5   
6   /**
7    *
8    * @author tonyj
9    */
10  public abstract class Solid extends RefElement
11  {
12     
13     /** Creates a new instance of Solid */
14     public Solid(String type, String name)
15     {
16        super(type,name);
17     }
18     
19     public String getSolidName()
20     {
21  	   return getAttributeValue("name");
22     }
23     
24     public double getDim(String name)
25     {
26  	   Attribute attrib = getAttribute(name);
27  	   double val = 0.0;
28  	   
29  	   if ( attrib == null )
30  	   {
31  		   throw new IllegalArgumentException("Solid " + getName() + " has no attribute called " + name);
32  	   }
33  	   
34  	   try {
35  		   val = attrib.getDoubleValue();
36  	   }
37  	   catch (Exception e)
38  	   {
39  		   throw new RuntimeException("Problem converting " + attrib.getValue() + " to double.");
40  	   }
41  	   
42  	   return val;
43     }   
44  }