struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcucchi...@apache.org
Subject svn commit: r1173225 - in /struts/struts2/trunk/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model: Graph.java SubGraph.java
Date Tue, 20 Sep 2011 16:26:45 GMT
Author: mcucchiara
Date: Tue Sep 20 16:26:44 2011
New Revision: 1173225

URL: http://svn.apache.org/viewvc?rev=1173225&view=rev
Log:
Partial upgrade to java 5

Modified:
    struts/struts2/trunk/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/Graph.java
    struts/struts2/trunk/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/SubGraph.java

Modified: struts/struts2/trunk/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/Graph.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/Graph.java?rev=1173225&r1=1173224&r2=1173225&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/Graph.java
(original)
+++ struts/struts2/trunk/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/Graph.java
Tue Sep 20 16:26:44 2011
@@ -32,7 +32,7 @@ import java.util.TreeSet;
  */
 public class Graph extends SubGraph {
     private Set<Link> links;
-    public static Map nodeMap = new LinkedHashMap();
+    public static Map<String,SiteGraphNode> nodeMap = new LinkedHashMap<String,SiteGraphNode>();
 
     public Graph() {
         super("");
@@ -52,8 +52,7 @@ public class Graph extends SubGraph {
         writer.write("edge [fontsize=10, fontname=helvetica]");
 
         // render all the subgraphs
-        for (Iterator iterator = subGraphs.iterator(); iterator.hasNext();) {
-            SubGraph subGraph = (SubGraph) iterator.next();
+        for (SubGraph subGraph : subGraphs) {
             subGraph.render(new IndentWriter(writer));
         }
 

Modified: struts/struts2/trunk/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/SubGraph.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/SubGraph.java?rev=1173225&r1=1173224&r2=1173225&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/SubGraph.java
(original)
+++ struts/struts2/trunk/plugins/sitegraph/src/main/java/org/apache/struts2/sitegraph/model/SubGraph.java
Tue Sep 20 16:26:44 2011
@@ -23,7 +23,6 @@ package org.apache.struts2.sitegraph.mod
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -31,13 +30,13 @@ import java.util.List;
 public class SubGraph implements Render {
     protected String name;
     protected SubGraph parent;
-    protected List subGraphs;
-    protected List nodes;
+    protected List<SubGraph> subGraphs;
+    protected List<SiteGraphNode> nodes;
 
     public SubGraph(String name) {
         this.name = name;
-        this.subGraphs = new ArrayList();
-        this.nodes = new ArrayList();
+        this.subGraphs = new ArrayList<SubGraph>();
+        this.nodes = new ArrayList<SiteGraphNode>();
     }
 
     public String getName() {
@@ -67,14 +66,12 @@ public class SubGraph implements Render 
         writer.write("label=\"" + name + "\";");
 
         // write out the subgraphs
-        for (Iterator iterator = subGraphs.iterator(); iterator.hasNext();) {
-            SubGraph subGraph = (SubGraph) iterator.next();
+        for (SubGraph subGraph : subGraphs) {
             subGraph.render(new IndentWriter(writer));
         }
 
         // write out the actions
-        for (Iterator iterator = nodes.iterator(); iterator.hasNext();) {
-            SiteGraphNode siteGraphNode = (SiteGraphNode) iterator.next();
+        for (SiteGraphNode siteGraphNode : nodes) {
             siteGraphNode.render(writer);
         }
 
@@ -102,8 +99,7 @@ public class SubGraph implements Render 
 
         String[] parts = namespace.split("\\/");
         SubGraph last = this;
-        for (int i = 0; i < parts.length; i++) {
-            String part = parts[i];
+        for (String part : parts) {
             if (part.equals("")) {
                 continue;
             }
@@ -121,8 +117,7 @@ public class SubGraph implements Render 
     }
 
     private SubGraph findSubGraph(String name) {
-        for (Iterator iterator = subGraphs.iterator(); iterator.hasNext();) {
-            SubGraph subGraph = (SubGraph) iterator.next();
+        for (SubGraph subGraph : subGraphs) {
             if (subGraph.getName().equals(name)) {
                 return subGraph;
             }



Mime
View raw message