Commit in GeomConverter/src/org/lcsim on MAIN
geometry/GeometryReader.java+4-31.3 -> 1.4
geometry/compact/CompactElementFactory.java+30added 1.1
                /CompactReader.java+5-31.13 -> 1.14
                /Detector.java+1-11.8 -> 1.9
                /DefaultElementFactory.java-1051.3 removed
                /ElementFactory.java-281.2 removed
                /JDOMExpressionFactory.java-1771.1 removed
geometry/compact/converter/lcdd/LCDDElementFactory.java+9-81.5 -> 1.6
                               /Main.java+1-11.11 -> 1.12
util/xml/DefaultElementFactory.java+97added 1.1
        /ElementFactory.java+28added 1.1
        /JDOMExpressionFactory.java+177added 1.1
+352-326
4 added + 3 removed + 5 modified, total 12 files
Refactored org.lcsim.geometry.compact XML engine into org.lcsim.util.xml package.

GeomConverter/src/org/lcsim/geometry
GeometryReader.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- GeometryReader.java	10 Mar 2005 05:10:05 -0000	1.3
+++ GeometryReader.java	15 Jul 2005 02:54:57 -0000	1.4
@@ -3,9 +3,9 @@
 import java.io.IOException;
 import java.io.InputStream;
 import org.jdom.JDOMException;
+import org.lcsim.geometry.compact.CompactElementFactory;
 import org.lcsim.geometry.compact.CompactReader;
-import org.lcsim.geometry.compact.DefaultElementFactory;
-import org.lcsim.geometry.compact.ElementFactory.ElementCreationException;
+import org.lcsim.util.xml.ElementFactory.ElementCreationException;
 import org.lcsim.geometry.compact.Field;
 import org.lcsim.geometry.compact.Segmentation;
 import org.lcsim.geometry.compact.Subdetector;
@@ -25,10 +25,11 @@
    {
       return (Detector) super.read(in);
    }
-   static class GeometryFactory extends DefaultElementFactory
+   static class GeometryFactory extends CompactElementFactory
    {
       GeometryFactory()
       {
+         super();
          register(Detector.class);
          register(Subdetector.class,"org.lcsim.geometry.subdetector");
          register(Segmentation.class,"org.lcsim.geometry.segmentation");

GeomConverter/src/org/lcsim/geometry/compact
CompactElementFactory.java added at 1.1
diff -N CompactElementFactory.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ CompactElementFactory.java	15 Jul 2005 02:54:57 -0000	1.1
@@ -0,0 +1,30 @@
+/*
+ * CompactElementFactory.java
+ *
+ * Created on July 14, 2005, 7:23 PM
+ */
+
+package org.lcsim.geometry.compact;
+
+import org.lcsim.util.xml.DefaultElementFactory;
+
+/**
+ *
+ * @author jeremym
+ */
+public class CompactElementFactory extends DefaultElementFactory
+{
+    
+    /** Creates a new instance of CompactElementFactory */
+    public CompactElementFactory()
+    {
+        super();
+        register(Constant.class);
+        register(Detector.class);
+        register(Header.class);
+        register(Readout.class);
+        register(Subdetector.class);
+        register(Segmentation.class);
+        register(Field.class);
+    }    
+}

GeomConverter/src/org/lcsim/geometry/compact
CompactReader.java 1.13 -> 1.14
diff -u -r1.13 -r1.14
--- CompactReader.java	5 Jul 2005 23:11:39 -0000	1.13
+++ CompactReader.java	15 Jul 2005 02:54:57 -0000	1.14
@@ -9,13 +9,15 @@
 import org.jdom.Element;
 import org.jdom.JDOMException;
 import org.jdom.input.SAXBuilder;
-import org.lcsim.geometry.compact.ElementFactory.ElementCreationException;
+import org.lcsim.util.xml.ElementFactory.ElementCreationException;
 import org.lcsim.material.XMLMaterialManager;
+import org.lcsim.util.xml.ElementFactory;
+import org.lcsim.util.xml.JDOMExpressionFactory;
 
 /**
  * A tool for reading xml files containing compact detector descriptions.
  * @author tonyj
- * @version $Id: CompactReader.java,v 1.13 2005/07/05 23:11:39 jeremy Exp $
+ * @version $Id: CompactReader.java,v 1.14 2005/07/15 02:54:57 jeremy Exp $
  *
  * This class does not create subclass objects.  For example, CylindricalBarrelCalorimeter
  * is inserted into Detector as a generic Subdetector.  To get subclasses, use the
@@ -33,7 +35,7 @@
      */
     public CompactReader()
     {
-        this(new DefaultElementFactory());
+        this(new CompactElementFactory());
     }
     /**
      * Create a CompactReader using the specified ElementFactory.

GeomConverter/src/org/lcsim/geometry/compact
Detector.java 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- Detector.java	5 Jul 2005 22:40:16 -0000	1.8
+++ Detector.java	15 Jul 2005 02:54:57 -0000	1.9
@@ -28,8 +28,8 @@
    protected Detector(Element element)
    {       
         materialMgr = XMLMaterialManager.create(XMLMaterialManager.materials() );        
-        //materialMgr.setParentManager( XMLMaterialManager.elements() );
    }
+   
    /**
     * Called by the reader to associate a header with this detector
     * @param header The header.

GeomConverter/src/org/lcsim/geometry/compact
DefaultElementFactory.java removed after 1.3
diff -N DefaultElementFactory.java
--- DefaultElementFactory.java	8 Mar 2005 02:58:28 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,105 +0,0 @@
-package org.lcsim.geometry.compact;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.jdom.Element;
-import org.jdom.JDOMException;
-
-
-/**
- * The default implementation of ElementFactory.
- * @author tonyj
- */
-public class DefaultElementFactory implements ElementFactory
-{
-   private List<Class> classes = new ArrayList<Class>();
-   private Map<Class,String> packageMap = new HashMap<Class,String>();
-   
-   /**
-    * Create the default element factory.
-    */
-   public DefaultElementFactory()
-   {
-      register(Constant.class);
-      register(Detector.class);
-      register(Header.class);
-      register(Readout.class);
-      register(Subdetector.class);
-      register(Segmentation.class);
-      register(Field.class);
-   }
-   
-   public <T> T createElement(Class<T> c, Element node, String type) throws JDOMException, ElementCreationException
-   {
-      if (type != null)
-      {
-         Class<T> cand = getElementClass(c,type);
-         if (cand != null) return create(cand,node);
-      }
-      for (Class cand  : classes)
-      {
-         if (c.isAssignableFrom(cand)) return create((Class<? extends T>) cand,node);
-      }
-      throw new ElementCreationException("Unknown element "+c);
-   }
-   
-   public void register(Class elementClass,String packageName)
-   {
-      packageMap.put(elementClass,packageName);
-   }
-   /**
-    * Register a class with the factory. Future calls to create any class which is a subclass 
-    * of this class will cause a new instance of this class to be created. The class specificed
-    * must have a constructor which takes a jdom Element as its argument.
-    * @param elementClass The class to register.
-    */
-   public void register(Class elementClass)
-   {
-      classes.add(0,elementClass);
-   }
-   private <T> T create(Class<T> type, Element node) throws ElementCreationException
-   {
-      try
-      {
-         Constructor<T> c = type.getDeclaredConstructor(Element.class);
-         c.setAccessible(true);
-         return c.newInstance(node);
-      }
-      catch (NoSuchMethodException x)
-      {
-         throw new ElementCreationException("Could not create element: "+type,x);
-      }
-      catch (InvocationTargetException x)
-      {
-         throw new ElementCreationException("Could not create element: "+type,x.getCause());
-      }
-      catch (InstantiationException x)
-      {
-         throw new ElementCreationException("Could not create element: "+type,x.getCause());
-      }
-      catch (IllegalAccessException x)
-      {
-         throw new ElementCreationException("Could not create element: "+type,x);
-      }
-   }
-   public <T> Class<T> getElementClass(Class<T> type, String name) throws ElementCreationException
-   {
-      String packageName = packageMap.get(type);
-      if (packageName == null) return null;
-      String key = packageName+"."+name;
-      try
-      {
-         Class result = Class.forName(key);
-         if (!type.isAssignableFrom(result)) throw new ElementCreationException("Element "+key+" is of wrong type");
-         return (Class<T>) result;
-      }
-      catch (ClassNotFoundException x)
-      {
-         return null;
-      }
-   }
-}
\ No newline at end of file

GeomConverter/src/org/lcsim/geometry/compact
ElementFactory.java removed after 1.2
diff -N ElementFactory.java
--- ElementFactory.java	2 Mar 2005 02:07:42 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,28 +0,0 @@
-package org.lcsim.geometry.compact;
-
-import org.jdom.Element;
-import org.jdom.JDOMException;
-
-/**
- * An interface that must be implemented by all element factories.
- * 
- * By providing their own implementation of ElementFactory users can cause custom classes to be
- * created by the reader.
- * @author tonyj
- * @version $Id: ElementFactory.java,v 1.2 2005/03/02 02:07:42 tonyj Exp $
- */
-public interface ElementFactory
-{
-   <T> T createElement(Class<T> c, Element node, String type) throws JDOMException, ElementCreationException;
-   public static class ElementCreationException extends Exception
-   {
-      ElementCreationException(String message)
-      {
-         super(message);
-      }
-      ElementCreationException(String message, Throwable cause)
-      {
-         super(message,cause);
-      }
-   }
-}
\ No newline at end of file

GeomConverter/src/org/lcsim/geometry/compact
JDOMExpressionFactory.java removed after 1.1
diff -N JDOMExpressionFactory.java
--- JDOMExpressionFactory.java	28 Feb 2005 07:33:45 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,177 +0,0 @@
-package org.lcsim.geometry.compact;
-
-import gnu.jel.CompilationException;
-import gnu.jel.CompiledExpression;
-import gnu.jel.DVMap;
-import gnu.jel.Evaluator;
-import gnu.jel.Library;
-import java.util.HashMap;
-import java.util.Map;
-import org.jdom.Attribute;
-import org.jdom.DataConversionException;
-import org.jdom.DefaultJDOMFactory;
-import org.jdom.Namespace;
-
-/**
- *
- * @author tonyj
- */
-class JDOMExpressionFactory extends DefaultJDOMFactory
-{
-   private Object[] resolver = { new Resolver() };
-   private Library jelLibrary = setUpLibrary();
-   private Map<String,Double> constants = new HashMap<String,Double>();
-   
-   void addConstant(String name, double value)
-   {
-      constants.put(name,value);
-   }
-   
-   public org.jdom.Attribute attribute(String name, String value, int type, Namespace namespace)
-   {
-      return new CustomAttribute(name,value,type,namespace);
-   }
-   
-   public org.jdom.Attribute attribute(String name, String value, Namespace namespace)
-   {
-      return new CustomAttribute(name,value,namespace);
-   }
-   
-   public org.jdom.Attribute attribute(String name, String value, int type)
-   {
-      return new CustomAttribute(name,value,type);
-   }
-   
-   public org.jdom.Attribute attribute(String name, String value)
-   {
-      return new CustomAttribute(name,value);
-   }
-   
-   private class CustomAttribute extends Attribute
-   {
-      CustomAttribute(String name, String value)
-      {
-         super(name,value);
-      }
-      CustomAttribute(String name, String value, int type)
-      {
-         super(name,value,type);
-      }
-      CustomAttribute(String name, String value, Namespace namespace)
-      {
-         super(name,value,namespace);
-      }
-      CustomAttribute(String name, String value, int type, Namespace namespace)
-      {
-         super(name,value,type,namespace);
-      }
-      
-      //      public boolean getBooleanValue() throws DataConversionException
-      //      {
-      //         String expression = super.getValue();
-      //         try
-      //         {
-      //            CompiledExpression expr = Evaluator.compile(expression,jelLibrary,Boolean.TYPE);
-      //            return expr.evaluate_boolean(resolver);
-      //         }
-      //         catch (Throwable x)
-      //         {
-      //            DataConversionException xx = new DataConversionException(expression,"boolean");
-      //            xx.initCause(x);
-      //            throw xx;
-      //         }
-      //      }
-      
-      public long getLongValue() throws DataConversionException
-      {
-         String expression = super.getValue();
-         try
-         {
-            CompiledExpression expr = Evaluator.compile(expression,jelLibrary,Long.TYPE);
-            return expr.evaluate_long(resolver);
-         }
-         catch (Throwable x)
-         {
-            DataConversionException xx = new DataConversionException(expression,"long");
-            xx.initCause(x);
-            throw xx;
-         }
-      }
-      
-      public int getIntValue() throws DataConversionException
-      {
-         String expression = super.getValue();
-         try
-         {
-            CompiledExpression expr = Evaluator.compile(expression,jelLibrary,Integer.TYPE);
-            return expr.evaluate_int(resolver);
-         }
-         catch (Throwable x)
-         {
-            DataConversionException xx = new DataConversionException(expression,"int");
-            xx.initCause(x);
-            throw xx;
-         }
-      }
-      
-      public float getFloatValue() throws DataConversionException
-      {
-         String expression = super.getValue();
-         try
-         {
-            CompiledExpression expr = Evaluator.compile(expression,jelLibrary,Float.TYPE);
-            return expr.evaluate_float(resolver);
-         }
-         catch (Throwable x)
-         {
-            DataConversionException xx = new DataConversionException(expression,"float");
-            xx.initCause(x);
-            throw xx;
-         }
-      }
-      
-      public double getDoubleValue() throws DataConversionException
-      {
-         String expression = super.getValue();
-         try
-         {
-            CompiledExpression expr = Evaluator.compile(expression,jelLibrary,Double.TYPE);
-            return expr.evaluate_double(resolver);
-         }
-         catch (Throwable x)
-         {
-            DataConversionException xx = new DataConversionException(expression,"double");
-            xx.initCause(x);
-            throw xx;
-         }
-      }
-   }
-   private Library setUpLibrary()
-   {
-      try
-      {
-         Class[] staticLib = { Math.class };
-         Class[] dynamicLib = { Resolver.class };
-         Library lib = new Library(staticLib,dynamicLib,null,(Resolver) resolver[0],null);
-         lib.markStateDependent("random",null);
-         return lib;
-      }
-      catch (CompilationException x)
-      {
-         throw new RuntimeException(x); // should never happen
-      }
-   }
-   
-   public class Resolver extends DVMap
-   {
-      public String getTypeName(String str)
-      {
-         if (constants.containsKey(str)) return "Double";
-         return null;
-      }
-      public double getDoubleProperty(String str)
-      {
-         return ((Number) constants.get(str)).doubleValue();
-      }
-   }
-}

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
LCDDElementFactory.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- LCDDElementFactory.java	31 Mar 2005 01:03:46 -0000	1.5
+++ LCDDElementFactory.java	15 Jul 2005 02:54:58 -0000	1.6
@@ -1,15 +1,16 @@
 package org.lcsim.geometry.compact.converter.lcdd;
 
 import org.lcsim.geometry.compact.Subdetector;
-import org.lcsim.geometry.compact.DefaultElementFactory;
+import org.lcsim.util.xml.DefaultElementFactory;
 import org.lcsim.geometry.compact.Field;
 import org.lcsim.geometry.compact.Segmentation;
+import org.lcsim.geometry.compact.CompactElementFactory;
 
 /**
  *
  * @author tonyj
  */
-class LCDDElementFactory extends DefaultElementFactory
+class LCDDElementFactory extends CompactElementFactory
 {
    LCDDElementFactory()
    {
@@ -19,13 +20,13 @@
       register(Field.class,"org.lcsim.geometry.compact.converter.lcdd");
       register(Segmentation.class,"org.lcsim.geometry.compact.converter.lcdd");
    }
-
-    public <T> T createElement(Class<T> c, org.jdom.Element node, String type) throws org.jdom.JDOMException, org.lcsim.geometry.compact.ElementFactory.ElementCreationException {
-
-        T retValue;
-        
+/*
+    public <T> T createElement(Class<T> c, org.jdom.Element node, String type) throws org.jdom.JDOMException, org.lcsim.geometry.compact.ElementFactory.ElementCreationException 
+    {
+        T retValue;        
         retValue = super.createElement(c, node, type);
-        //System.out.println("Got "+retValue+" for type "+type);
+        System.out.println("Got "+retValue+" for type "+type);
         return retValue;
     }
+ */
 }

GeomConverter/src/org/lcsim/geometry/compact/converter/lcdd
Main.java 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- Main.java	28 Jun 2005 21:34:53 -0000	1.11
+++ Main.java	15 Jul 2005 02:54:58 -0000	1.12
@@ -13,7 +13,7 @@
 import org.jdom.input.SAXBuilder;
 import org.jdom.output.Format;
 import org.jdom.output.XMLOutputter;
-import org.lcsim.geometry.compact.ElementFactory;
+import org.lcsim.util.xml.ElementFactory;
 import org.lcsim.geometry.compact.Detector;
 import org.lcsim.geometry.compact.CompactReader;
 import org.lcsim.geometry.compact.converter.Converter;

GeomConverter/src/org/lcsim/util/xml
DefaultElementFactory.java added at 1.1
diff -N DefaultElementFactory.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ DefaultElementFactory.java	15 Jul 2005 02:54:58 -0000	1.1
@@ -0,0 +1,97 @@
+package org.lcsim.util.xml;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+
+
+/**
+ * The default implementation of ElementFactory.
+ * @author tonyj
+ */
+public class DefaultElementFactory implements ElementFactory
+{
+   private List<Class> classes = new ArrayList<Class>();
+   private Map<Class,String> packageMap = new HashMap<Class,String>();
+   
+   /**
+    * Create the default element factory.
+    */
+   public DefaultElementFactory()
+   {}
+   
+   public <T> T createElement(Class<T> c, Element node, String type) throws JDOMException, ElementCreationException
+   {
+      if (type != null)
+      {
+         Class<T> cand = getElementClass(c,type);
+         if (cand != null) return create(cand,node);
+      }
+      for (Class cand  : classes)
+      {
+         if (c.isAssignableFrom(cand)) return create((Class<? extends T>) cand,node);
+      }
+      throw new ElementCreationException("Unknown element "+c);
+   }
+   
+   public void register(Class elementClass,String packageName)
+   {
+      packageMap.put(elementClass,packageName);
+   }
+   /**
+    * Register a class with the factory. Future calls to create any class which is a subclass 
+    * of this class will cause a new instance of this class to be created. The class specificed
+    * must have a constructor which takes a jdom Element as its argument.
+    * @param elementClass The class to register.
+    */
+   public void register(Class elementClass)
+   {
+      classes.add(0,elementClass);
+   }
+   private <T> T create(Class<T> type, Element node) throws ElementCreationException
+   {
+      try
+      {
+         Constructor<T> c = type.getDeclaredConstructor(Element.class);
+         c.setAccessible(true);
+         return c.newInstance(node);
+      }
+      catch (NoSuchMethodException x)
+      {
+         throw new ElementCreationException("Could not create element: "+type,x);
+      }
+      catch (InvocationTargetException x)
+      {
+         throw new ElementCreationException("Could not create element: "+type,x.getCause());
+      }
+      catch (InstantiationException x)
+      {
+         throw new ElementCreationException("Could not create element: "+type,x.getCause());
+      }
+      catch (IllegalAccessException x)
+      {
+         throw new ElementCreationException("Could not create element: "+type,x);
+      }
+   }
+   public <T> Class<T> getElementClass(Class<T> type, String name) throws ElementCreationException
+   {
+      String packageName = packageMap.get(type);
+      if (packageName == null) return null;
+      String key = packageName+"."+name;
+      try
+      {
+         Class result = Class.forName(key);
+         if (!type.isAssignableFrom(result)) throw new ElementCreationException("Element "+key+" is of wrong type");
+         return (Class<T>) result;
+      }
+      catch (ClassNotFoundException x)
+      {
+         return null;
+      }
+   }
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/util/xml
ElementFactory.java added at 1.1
diff -N ElementFactory.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ElementFactory.java	15 Jul 2005 02:54:58 -0000	1.1
@@ -0,0 +1,28 @@
+package org.lcsim.util.xml;
+
+import org.jdom.Element;
+import org.jdom.JDOMException;
+
+/**
+ * An interface that must be implemented by all element factories.
+ * 
+ * By providing their own implementation of ElementFactory users can cause custom classes to be
+ * created by the reader.
+ * @author tonyj
+ * @version $Id: ElementFactory.java,v 1.1 2005/07/15 02:54:58 jeremy Exp $
+ */
+public interface ElementFactory
+{
+   <T> T createElement(Class<T> c, Element node, String type) throws JDOMException, ElementCreationException;
+   public static class ElementCreationException extends Exception
+   {
+      ElementCreationException(String message)
+      {
+         super(message);
+      }
+      ElementCreationException(String message, Throwable cause)
+      {
+         super(message,cause);
+      }
+   }
+}
\ No newline at end of file

GeomConverter/src/org/lcsim/util/xml
JDOMExpressionFactory.java added at 1.1
diff -N JDOMExpressionFactory.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ JDOMExpressionFactory.java	15 Jul 2005 02:54:58 -0000	1.1
@@ -0,0 +1,177 @@
+package org.lcsim.util.xml;
+
+import gnu.jel.CompilationException;
+import gnu.jel.CompiledExpression;
+import gnu.jel.DVMap;
+import gnu.jel.Evaluator;
+import gnu.jel.Library;
+import java.util.HashMap;
+import java.util.Map;
+import org.jdom.Attribute;
+import org.jdom.DataConversionException;
+import org.jdom.DefaultJDOMFactory;
+import org.jdom.Namespace;
+
+/**
+ *
+ * @author tonyj
+ */
+public class JDOMExpressionFactory extends DefaultJDOMFactory
+{
+   private Object[] resolver = { new Resolver() };
+   private Library jelLibrary = setUpLibrary();
+   private Map<String,Double> constants = new HashMap<String,Double>();
+   
+   public void addConstant(String name, double value)
+   {
+      constants.put(name,value);
+   }
+   
+   public org.jdom.Attribute attribute(String name, String value, int type, Namespace namespace)
+   {
+      return new CustomAttribute(name,value,type,namespace);
+   }
+   
+   public org.jdom.Attribute attribute(String name, String value, Namespace namespace)
+   {
+      return new CustomAttribute(name,value,namespace);
+   }
+   
+   public org.jdom.Attribute attribute(String name, String value, int type)
+   {
+      return new CustomAttribute(name,value,type);
+   }
+   
+   public org.jdom.Attribute attribute(String name, String value)
+   {
+      return new CustomAttribute(name,value);
+   }
+   
+   private class CustomAttribute extends Attribute
+   {
+      CustomAttribute(String name, String value)
+      {
+         super(name,value);
+      }
+      CustomAttribute(String name, String value, int type)
+      {
+         super(name,value,type);
+      }
+      CustomAttribute(String name, String value, Namespace namespace)
+      {
+         super(name,value,namespace);
+      }
+      CustomAttribute(String name, String value, int type, Namespace namespace)
+      {
+         super(name,value,type,namespace);
+      }
+      
+      //      public boolean getBooleanValue() throws DataConversionException
+      //      {
+      //         String expression = super.getValue();
+      //         try
+      //         {
+      //            CompiledExpression expr = Evaluator.compile(expression,jelLibrary,Boolean.TYPE);
+      //            return expr.evaluate_boolean(resolver);
+      //         }
+      //         catch (Throwable x)
+      //         {
+      //            DataConversionException xx = new DataConversionException(expression,"boolean");
+      //            xx.initCause(x);
+      //            throw xx;
+      //         }
+      //      }
+      
+      public long getLongValue() throws DataConversionException
+      {
+         String expression = super.getValue();
+         try
+         {
+            CompiledExpression expr = Evaluator.compile(expression,jelLibrary,Long.TYPE);
+            return expr.evaluate_long(resolver);
+         }
+         catch (Throwable x)
+         {
+            DataConversionException xx = new DataConversionException(expression,"long");
+            xx.initCause(x);
+            throw xx;
+         }
+      }
+      
+      public int getIntValue() throws DataConversionException
+      {
+         String expression = super.getValue();
+         try
+         {
+            CompiledExpression expr = Evaluator.compile(expression,jelLibrary,Integer.TYPE);
+            return expr.evaluate_int(resolver);
+         }
+         catch (Throwable x)
+         {
+            DataConversionException xx = new DataConversionException(expression,"int");
+            xx.initCause(x);
+            throw xx;
+         }
+      }
+      
+      public float getFloatValue() throws DataConversionException
+      {
+         String expression = super.getValue();
+         try
+         {
+            CompiledExpression expr = Evaluator.compile(expression,jelLibrary,Float.TYPE);
+            return expr.evaluate_float(resolver);
+         }
+         catch (Throwable x)
+         {
+            DataConversionException xx = new DataConversionException(expression,"float");
+            xx.initCause(x);
+            throw xx;
+         }
+      }
+      
+      public double getDoubleValue() throws DataConversionException
+      {
+         String expression = super.getValue();
+         try
+         {
+            CompiledExpression expr = Evaluator.compile(expression,jelLibrary,Double.TYPE);
+            return expr.evaluate_double(resolver);
+         }
+         catch (Throwable x)
+         {
+            DataConversionException xx = new DataConversionException(expression,"double");
+            xx.initCause(x);
+            throw xx;
+         }
+      }
+   }
+   private Library setUpLibrary()
+   {
+      try
+      {
+         Class[] staticLib = { Math.class };
+         Class[] dynamicLib = { Resolver.class };
+         Library lib = new Library(staticLib,dynamicLib,null,(Resolver) resolver[0],null);
+         lib.markStateDependent("random",null);
+         return lib;
+      }
+      catch (CompilationException x)
+      {
+         throw new RuntimeException(x); // should never happen
+      }
+   }
+   
+   public class Resolver extends DVMap
+   {
+      public String getTypeName(String str)
+      {
+         if (constants.containsKey(str)) return "Double";
+         return null;
+      }
+      public double getDoubleProperty(String str)
+      {
+         return ((Number) constants.get(str)).doubleValue();
+      }
+   }
+}
CVSspam 0.2.8