Index: trunk/src/com/kitfox/svg/SVGElement.java
===================================================================
--- trunk/src/com/kitfox/svg/SVGElement.java	(revision 8084)
+++ trunk/src/com/kitfox/svg/SVGElement.java	(revision 11525)
@@ -4,14 +4,14 @@
  * All rights reserved.
  *
- * Redistribution and use in source and binary forms, with or 
+ * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
  * conditions are met:
  *
- *   - Redistributions of source code must retain the above 
+ *   - Redistributions of source code must retain the above
  *     copyright notice, this list of conditions and the following
  *     disclaimer.
  *   - Redistributions in binary form must reproduce the above
  *     copyright notice, this list of conditions and the following
- *     disclaimer in the documentation and/or other materials 
+ *     disclaimer in the documentation and/or other materials
  *     provided with the distribution.
  *
@@ -27,6 +27,6 @@
  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE. 
- * 
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
  * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
  * projects can be found at http://www.kitfox.com
@@ -35,4 +35,22 @@
  */
 package com.kitfox.svg;
+
+import java.awt.geom.AffineTransform;
+import java.awt.geom.GeneralPath;
+import java.io.Serializable;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
 
 import com.kitfox.svg.pathcmd.Arc;
@@ -51,21 +69,4 @@
 import com.kitfox.svg.xml.StyleSheet;
 import com.kitfox.svg.xml.XMLParseUtil;
-import java.awt.geom.AffineTransform;
-import java.awt.geom.GeneralPath;
-import java.io.Serializable;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
 
 /**
@@ -79,5 +80,5 @@
     public static final String SVG_NS = "http://www.w3.org/2000/svg";
     protected SVGElement parent = null;
-    protected final ArrayList children = new ArrayList();
+    protected final ArrayList<SVGElement> children = new ArrayList<>();
     protected String id = null;
     /**
@@ -88,19 +89,19 @@
      * Styles defined for this elemnt via the <b>style</b> attribute.
      */
-    protected final HashMap inlineStyles = new HashMap();
+    protected final HashMap<String, StyleAttribute> inlineStyles = new HashMap<>();
     /**
      * Presentation attributes set for this element. Ie, any attribute other
      * than the <b>style</b> attribute.
      */
-    protected final HashMap presAttribs = new HashMap();
+    protected final HashMap<String, StyleAttribute> presAttribs = new HashMap<>();
     /**
      * A list of presentation attributes to not include in the presentation
      * attribute set.
      */
-    protected static final Set ignorePresAttrib;
+    protected static final Set<String> ignorePresAttrib;
 
     static
     {
-        HashSet set = new HashSet();
+        HashSet<String> set = new HashSet<>();
 //        set.add("id");
 //        set.add("class");
@@ -157,9 +158,9 @@
      * @return an ordered list of nodes from the root of the tree to this node
      */
-    public List getPath(List retVec)
+    public List<SVGElement> getPath(List<SVGElement> retVec)
     {
         if (retVec == null)
         {
-            retVec = new ArrayList();
+            retVec = new ArrayList<>();
         }
 
@@ -179,9 +180,9 @@
      * @return The list containing the children of this group
      */
-    public List getChildren(List retVec)
+    public List<SVGElement> getChildren(List<SVGElement> retVec)
     {
         if (retVec == null)
         {
-            retVec = new ArrayList();
+            retVec = new ArrayList<>();
         }
 
@@ -197,7 +198,5 @@
     public SVGElement getChild(String id)
     {
-        for (Iterator it = children.iterator(); it.hasNext();)
-        {
-            SVGElement ele = (SVGElement) it.next();
+        for (SVGElement ele : children) {
             String eleId = ele.getId();
             if (eleId != null && eleId.equals(id))
@@ -234,5 +233,5 @@
         }
 
-        Object temp = children.get(i);
+        SVGElement temp = children.get(i);
         children.set(i, children.get(j));
         children.set(j, temp);
@@ -269,5 +268,5 @@
         if (style != null)
         {
-            HashMap map = XMLParseUtil.parseStyle(style, inlineStyles);
+            HashMap<?, ?> map = XMLParseUtil.parseStyle(style, inlineStyles);
         }
 
@@ -302,5 +301,5 @@
      * @return a set of Strings that corespond to CSS attributes on this element
      */
-    public Set getInlineAttributes()
+    public Set<String> getInlineAttributes()
     {
         return inlineStyles.keySet();
@@ -310,5 +309,5 @@
      * @return a set of Strings that corespond to XML attributes on this element
      */
-    public Set getPresentationAttributes()
+    public Set<String> getPresentationAttributes()
     {
         return presAttribs.keySet();
@@ -330,7 +329,5 @@
         this.diagram = diagram;
         diagram.setElement(id, this);
-        for (Iterator it = children.iterator(); it.hasNext();)
-        {
-            SVGElement ele = (SVGElement) it.next();
+        for (SVGElement ele : children) {
             ele.setDiagram(diagram);
         }
@@ -400,5 +397,5 @@
         for (int i = 0; i < children.size(); ++i)
         {
-            SVGElement ele = (SVGElement) children.get(i);
+            SVGElement ele = children.get(i);
             ele.build();
         }
@@ -418,5 +415,5 @@
         return id;
     }
-    LinkedList contexts = new LinkedList();
+    LinkedList<SVGElement> contexts = new LinkedList<>();
 
     /**
@@ -431,5 +428,5 @@
     protected SVGElement popParentContext()
     {
-        return (SVGElement) contexts.removeLast();
+        return contexts.removeLast();
     }
 
@@ -474,5 +471,5 @@
 
         //Check for local inline styles
-        StyleAttribute styAttr = (StyleAttribute)inlineStyles.get(styName);
+        StyleAttribute styAttr = inlineStyles.get(styName);
 
         attrib.setStringValue(styAttr == null ? "" : styAttr.getStringValue());
@@ -486,5 +483,5 @@
 
         //Check for presentation attribute
-        StyleAttribute presAttr = (StyleAttribute)presAttribs.get(styName);
+        StyleAttribute presAttr = presAttribs.get(styName);
 
         attrib.setStringValue(presAttr == null ? "" : presAttr.getStringValue());
@@ -533,5 +530,5 @@
     {
         //Check for local inline styles
-        return (StyleAttribute) inlineStyles.get(styName);
+        return inlineStyles.get(styName);
     }
 
@@ -546,5 +543,5 @@
 
         //Make sure we have a coresponding presentation attribute
-        StyleAttribute presAttr = (StyleAttribute) presAttribs.get(presName);
+        StyleAttribute presAttr = presAttribs.get(presName);
 
         //Copy presentation value directly
@@ -568,5 +565,5 @@
     {
         //Check for local inline styles
-        return (StyleAttribute) presAttribs.get(styName);
+        return presAttribs.get(styName);
     }
 
@@ -601,5 +598,5 @@
         String function = matchWord.group().toLowerCase();
 
-        LinkedList termList = new LinkedList();
+        LinkedList<String> termList = new LinkedList<>();
         while (matchWord.find())
         {
@@ -609,9 +606,9 @@
 
         double[] terms = new double[termList.size()];
-        Iterator it = termList.iterator();
+        Iterator<String> it = termList.iterator();
         int count = 0;
         while (it.hasNext())
         {
-            terms[count++] = XMLParseUtil.parseDouble((String) it.next());
+            terms[count++] = XMLParseUtil.parseDouble(it.next());
         }
 
@@ -661,7 +658,7 @@
     }
 
-    static protected float nextFloat(LinkedList l)
-    {
-        String s = (String) l.removeFirst();
+    static protected float nextFloat(LinkedList<String> l)
+    {
+        String s = l.removeFirst();
         return Float.parseFloat(s);
     }
@@ -672,5 +669,5 @@
 
         //Tokenize
-        LinkedList tokens = new LinkedList();
+        LinkedList<String> tokens = new LinkedList<>();
         while (matchPathCmd.find())
         {
@@ -680,9 +677,9 @@
 
         boolean defaultRelative = false;
-        LinkedList cmdList = new LinkedList();
+        LinkedList<PathCommand> cmdList = new LinkedList<>();
         char curCmd = 'Z';
         while (tokens.size() != 0)
         {
-            String curToken = (String) tokens.removeFirst();
+            String curToken = tokens.removeFirst();
             char initChar = curToken.charAt(0);
             if ((initChar >= 'A' && initChar <= 'Z') || (initChar >= 'a' && initChar <= 'z'))
@@ -825,5 +822,5 @@
     public SVGElement getChild(int i)
     {
-        return (SVGElement) children.get(i);
+        return children.get(i);
     }
 
