Commit in GeomConverter/src/org/lcsim/material on MAIN
XMLMaterialManager.java+53-561.6 -> 1.7
Qualified XML Element usage as org.jdom.Element .

GeomConverter/src/org/lcsim/material
XMLMaterialManager.java 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- XMLMaterialManager.java	28 Jun 2005 21:34:54 -0000	1.6
+++ XMLMaterialManager.java	28 Jun 2005 22:42:41 -0000	1.7
@@ -56,10 +56,10 @@
     private Document currentDoc;
     
     /** Map of material names to materials. */
-    protected LinkedHashMap<String,Element> materialMap;
+    protected LinkedHashMap<String, org.jdom.Element> materialMap;
     
     /** Map of element names to elements. */
-    protected LinkedHashMap<String,Element> elementMap;
+    protected LinkedHashMap<String, org.jdom.Element> elementMap;
     
     /** Return static manager containing chem element data. */
     public static XMLMaterialManager getElements()
@@ -165,13 +165,13 @@
     }
     
     /** Get the material map. */
-    public LinkedHashMap<String, Element> getMaterialMap()
+    public LinkedHashMap<String, org.jdom.Element> getMaterialMap()
     {
         return materialMap;
     }
     
     /** Get the chem element map. */
-    public LinkedHashMap<String, Element> getElementMap()
+    public LinkedHashMap<String, org.jdom.Element> getElementMap()
     {
         return elementMap;
     }
@@ -195,13 +195,13 @@
     }
     
     /** Is the argument an element of type material? */
-    public boolean isMaterial(Element e)
+    public boolean isMaterial(org.jdom.Element e)
     {
         return "material".equals(e.getName());
     }
     
     /** Is the argument an element of type element? [sic] */
-    public boolean isElement(Element e)
+    public boolean isElement(org.jdom.Element e)
     {
         return "element".equals(e.getName());
     }
@@ -239,9 +239,9 @@
      * @param d Document to search for materials element.
      *
      */
-    Element getMaterialsRoot(Document d) throws JDOMException
+    org.jdom.Element getMaterialsRoot(Document d) throws JDOMException
     {
-        Element m = null;
+        org.jdom.Element m = null;
         if (d.hasRootElement() )
         {
             if ( d.getRootElement().getName() == "materials" )
@@ -267,13 +267,13 @@
     }
     
     /** Finds the materials element in the current document. */
-    Element getMaterialsRoot() throws JDOMException
+    org.jdom.Element getMaterialsRoot() throws JDOMException
     {
         return getMaterialsRoot(currentDoc);
     }
     
     /** Add a material to the map. */
-    public void addMaterial(Element e) throws JDOMException
+    public void addMaterial(org.jdom.Element e) throws JDOMException
     {
         if ( e.getName() != "material")
         {
@@ -292,7 +292,7 @@
     }
     
     /** Add an element to the map. */
-    public void addElement(Element e) throws JDOMException
+    public void addElement(org.jdom.Element e) throws JDOMException
     {
         //System.out.println("add element: " + e.getAttributeValue("name"));
         
@@ -305,11 +305,11 @@
     }
     
     /** Find a material in the map. */
-    public Element getMaterial(String matName)
+    public org.jdom.Element getMaterial(String matName)
     {
         //System.out.println("lkp mat: " + matName);
         
-        Element m = materialMap.get(matName);
+        org.jdom.Element m = materialMap.get(matName);
         
         if ( m == null )
         {
@@ -333,9 +333,9 @@
     }
     
     /** Find an element in the map. */
-    public Element getElement(String elemName)
+    public org.jdom.Element getElement(String elemName)
     {
-        Element e = elementMap.get(elemName);
+        org.jdom.Element e = elementMap.get(elemName);
         
         if ( e == null )
         {
@@ -349,13 +349,13 @@
     }
     
     /** Find an element in the current document without affecting the map. */
-    public Element findElementInDocument(String elemName, Document d) throws JDOMException
+    public org.jdom.Element findElementInDocument(String elemName, Document d) throws JDOMException
     {
-        Element me = getMaterialsRoot(d);
-        Element fnd = null;
+        org.jdom.Element me = getMaterialsRoot(d);
+        org.jdom.Element fnd = null;
         for ( Object o : me.getChildren("element"))
         {
-            Element curr = (Element) o;
+            org.jdom.Element curr = (org.jdom.Element) o;
             if ( curr.getAttributeValue("name").equals(elemName) )
             {
                 fnd = curr;
@@ -372,20 +372,20 @@
         return fnd;
     }
     
-    public Element findElementInDocument(String elemName) throws JDOMException
+    public org.jdom.Element findElementInDocument(String elemName) throws JDOMException
     {
         return findElementInDocument(elemName, currentDoc);
     }
     
     /** Find a material in the current document without affecting the map. */
-    public Element findMaterialInDocument(String matName, Document d) throws JDOMException
+    public org.jdom.Element findMaterialInDocument(String matName, Document d) throws JDOMException
     {
-        Element me = getMaterialsRoot(d);
+        org.jdom.Element me = getMaterialsRoot(d);
         
-        Element fnd = null;
+        org.jdom.Element fnd = null;
         for ( Object o : me.getChildren("material"))
         {
-            Element curr = (Element) o;
+            org.jdom.Element curr = (org.jdom.Element) o;
             if ( curr.getAttributeValue("name").equals(matName) )
             {
                 fnd = curr;
@@ -402,7 +402,7 @@
         return fnd;
     }
     
-    public Element findMaterialInDocument(String matName) throws JDOMException
+    public org.jdom.Element findMaterialInDocument(String matName) throws JDOMException
     {
         return findElementInDocument(matName);
     }
@@ -429,13 +429,13 @@
     /** Core method for loading material and element XML data from an external entity. */
     public void loadFromDocument(Document d) throws JDOMException
     {
-        Element root = getMaterialsRoot(d);
+        org.jdom.Element root = getMaterialsRoot(d);
         
         /* DEBUG: track number of materials and elements read. */
         //int mcount, ecount;
         //mcount = ecount = 0;
         
-        for ( Element e : (List<Element>) root.getChildren() )
+        for ( org.jdom.Element e : (List<org.jdom.Element>) root.getChildren() )
         {   
             String elemName = e.getName();
             if ("material".equals(elemName))
@@ -474,7 +474,7 @@
      * Recursively add the referenced materials or elements from a single material node.
      * It will also automatically look in the parent.
      */
-    public void addReferences(Element e, Document d) throws JDOMException
+    public void addReferences(org.jdom.Element e, Document d) throws JDOMException
     {
         if ( e != null )
         {
@@ -492,13 +492,13 @@
                     throw new JDOMException("Material does not contain fraction or composite tags.");
                 }
                 
-                for ( Element ce : (List<Element>) l )
+                for ( org.jdom.Element ce : (List<org.jdom.Element>) l )
                 {
                     
                     String ref = ce.getAttributeValue("ref");
                     
                     /* Add if element. */
-                    Element fnd = findElementInDocument(ref, d);
+                    org.jdom.Element fnd = findElementInDocument(ref, d);
                     if (fnd != null)
                     {
                         addElement(fnd);
@@ -546,7 +546,7 @@
             throw new IllegalArgumentException("List cannot be null.");
         }
         
-        Element m = getMaterial(matName);
+        org.jdom.Element m = getMaterial(matName);
         
         if ( "material".equals(m.getName()))
         {
@@ -562,12 +562,12 @@
                 throw new JDOMException("Material does not contain fraction or composite tags.");
             }
             
-            for ( Element ce : (List<Element>) l )
+            for ( org.jdom.Element ce : (List<org.jdom.Element>) l )
             {
                 String ref = ce.getAttributeValue("ref");
                 
                 /* Add if element. */
-                Element fnd = getElement(ref);
+                org.jdom.Element fnd = getElement(ref);
                 if (fnd != null)
                 {
                     if ( !refs.contains(fnd))
@@ -599,19 +599,19 @@
         }
     }
     
-    public void addReferences(Element e) throws JDOMException
+    public void addReferences(org.jdom.Element e) throws JDOMException
     {
         addReferences(e, currentDoc);
     }
     
-    public Document cloneMaterialsRoot(Element e) throws JDOMException
+    public Document cloneMaterialsRoot(org.jdom.Element e) throws JDOMException
     {
         if ( e.getName() != "materials" )
         {
             throw new JDOMException("Element passed as materials root has wrong name.");
         }
         
-        Element matRoot = new Element("materials");
+        org.jdom.Element matRoot = new org.jdom.Element("materials");
         matRoot.setContent(e.cloneContent() );
         Document d = new Document();
         d.setRootElement(matRoot);
@@ -620,7 +620,7 @@
         return currentDoc;
     }
     
-    public void setMaterialsRoot(Element e) throws JDOMException
+    public void setMaterialsRoot(org.jdom.Element e) throws JDOMException
     {
         setCurrentDocument(cloneMaterialsRoot(e));
     }
@@ -630,8 +630,8 @@
     {
         for (Object o : getElementMap().values() )
         {
-            Element e = (Element) o;
-            lcdd.addElement((Element) e.clone());
+            org.jdom.Element e = (org.jdom.Element) o;
+            lcdd.addElement((org.jdom.Element) e.clone());
         }
     }
     
@@ -640,7 +640,7 @@
     {
         for (Object o : getMaterialMap().values() )
         {
-            Element e = (Element) o;
+            org.jdom.Element e = (org.jdom.Element) o;
             
             //System.out.println ("mat " + e.getAttributeValue("name") + " -> LCDD");
             
@@ -649,7 +649,7 @@
         }
     }
     
-    public static Material makeLCDDMaterial(Element m) throws JDOMException
+    public static Material makeLCDDMaterial(org.jdom.Element m) throws JDOMException
     {
         if ( m.getName() != "material")
         {
@@ -661,14 +661,14 @@
         return mat;
     }
     
-    public static Element makeLCDDElement(Element e) throws JDOMException
+    public static org.jdom.Element makeLCDDElement(org.jdom.Element e) throws JDOMException
     {
         if (e.getName() != "element")
         {
             throw new JDOMException("XML element to make element is not of type element.");
         }
         
-        Element ee = new Element("element");
+        org.jdom.Element ee = new org.jdom.Element("element");
         ee.addContent(e.cloneContent());
         ee.setAttribute("name", e.getAttributeValue("name"));
         ee.setAttribute("formula", e.getAttributeValue("formula"));
@@ -678,10 +678,7 @@
     
     public void resolveLCDDMaterialReference(String name, LCDD lcdd) throws JDOMException
     {
-        //System.out.println("lazy lkp for LCDD: " + name);
-        
-        //XMLMaterialManager mgr = XMLMaterialManager.getElements();
-        //XMLMaterialManager mgr = XMLMaterialManager.getMaterials();
+        //System.out.println("lazy lkp for LCDD: " + name);                
         
         List l = new ArrayList();
         
@@ -689,7 +686,7 @@
         
         for (Object o : l)
         {
-            Element e = (Element) o;
+            org.jdom.Element e = (org.jdom.Element) o;
             /* material */
             if ( "material".equals(e.getName()) )
             {
@@ -700,7 +697,7 @@
             /* element */
             else
             {
-                Element ee = makeLCDDElement(e);
+                org.jdom.Element ee = makeLCDDElement(e);
                 //System.out.println("LCDD -> " + ee.getAttributeValue("name"));
                 lcdd.addElement(ee);
             }
@@ -713,7 +710,7 @@
     public Material addMaterialReferenceToLCDD(String name, LCDD lcdd) throws JDOMException
     {
         /** First look for the material. */
-        Element m = getMaterial(name);
+        org.jdom.Element m = getMaterial(name);
         
         /** Throw if material was not found. */
         if ( m == null )
@@ -722,14 +719,14 @@
         }
         
         /** Lookup associated single element. */
-        Element e = null;
+        org.jdom.Element e = null;
         String elemName = name+"_e";
         e = getElement(elemName);
         
         /** Add the element [sic] to LCDD, checking if it exists already. */
         if ( lcdd.getElement(elemName) == null)
         {
-            lcdd.addElement((Element) e.clone());
+            lcdd.addElement((org.jdom.Element) e.clone());
         }
         
         /** Add the material to LCDD. */
@@ -748,15 +745,15 @@
     }
     
     /** Read materials from a compact description and cache materials and their dependencies in this manager. */
-    public void addReferencesFromCompact(Element lccdd) throws JDOMException
+    public void addReferencesFromCompact(org.jdom.Element lccdd) throws JDOMException
     {
-        Element materials = lccdd.getChild("materials");
+        org.jdom.Element materials = lccdd.getChild("materials");
         
         setMaterialsRoot(lccdd.getChild("materials"));
         
         for (Iterator i = materials.getChildren().iterator(); i.hasNext(); )
         {
-            Element element = (Element) i.next();
+            org.jdom.Element element = (org.jdom.Element) i.next();
             if ("material".equals(element.getName()))
             {
                 addReferences(element);
@@ -789,7 +786,7 @@
     /**
      *
      */
-    public Element getDefaultMaterial() 
+    public org.jdom.Element getDefaultMaterial() 
     {
         return getMaterial(defaultMaterialName);
     }
CVSspam 0.2.8