Adding changes to cvs...
[repair.git] / Repair / RepairCompiler / MCC / IR / GraphNode.java
index 8059be37f278d4da4174da231aa4e7e87f8a1564..da50a5abd882785cdcddcad1bfae2c8655598fe9 100755 (executable)
@@ -83,6 +83,22 @@ public class GraphNode {
         return owner;
     }
 
+    public static void computeclosure(Set nodes) {
+       Stack tovisit=new Stack();
+       tovisit.addAll(nodes);
+       while(!tovisit.isEmpty()) {
+           GraphNode gn=(GraphNode)tovisit.pop();
+           for(Iterator it=gn.edges();it.hasNext();) {
+               Edge edge=(Edge)it.next();
+               GraphNode target=edge.getTarget();
+               if (!nodes.contains(target)) {
+                   nodes.add(target);
+                   tovisit.push(target);
+               }
+           }
+       }
+    }
+
     public void setDotNodeParameters(String param) {
         if (param == null) {
             throw new NullPointerException();
@@ -171,11 +187,11 @@ public class GraphNode {
         private void make() {
             output.println("digraph dotvisitor {");
             output.println("\trotate=90;");
-            output.println("\tpage=\"8.5,11\";");
-            output.println("\tnslimit=1000.0;");
-            output.println("\tnslimit1=1000.0;");
-            output.println("\tmclimit=1000.0;");
-            output.println("\tremincross=true;");
+           /*            output.println("\tpage=\"8.5,11\";");
+                         output.println("\tnslimit=1000.0;");
+                         output.println("\tnslimit1=1000.0;");
+                         output.println("\tmclimit=1000.0;");
+                         output.println("\tremincross=true;");*/
             output.println("\tnode [fontsize=10,height=\"0.1\", width=\"0.1\"];");
             output.println("\tedge [fontsize=6];");
 
@@ -195,8 +211,10 @@ public class GraphNode {
                 while (edges.hasNext()) {
                     Edge edge = (Edge) edges.next();
                     GraphNode node = edge.getTarget();
-                    String edgelabel = useEdgeLabels ? "label=\"" + edge.getLabel() + "\"" : "label=\"\"";
-                    output.println("\t" + gn.getLabel() + " -> " + node.getLabel() + " [" + edgelabel + edge.dotnodeparams + "];");
+                   if (nodes.contains(node)) {
+                       String edgelabel = useEdgeLabels ? "label=\"" + edge.getLabel() + "\"" : "label=\"\"";
+                       output.println("\t" + gn.getLabel() + " -> " + node.getLabel() + " [" + edgelabel + edge.dotnodeparams + "];");
+                   }
                 }
             }
         }