Add option to remove conjunctions.
authorbdemsky <bdemsky>
Wed, 9 Nov 2005 21:07:04 +0000 (21:07 +0000)
committerbdemsky <bdemsky>
Wed, 9 Nov 2005 21:07:04 +0000 (21:07 +0000)
Repair/RepairCompiler/MCC/CLI.java
Repair/RepairCompiler/MCC/Compiler.java
Repair/RepairCompiler/MCC/IR/Termination.java
Repair/RepairCompiler/MCC/IR/UpdateNode.java

index b8cce23..39b64ef 100755 (executable)
@@ -12,7 +12,7 @@ import MCC.IR.RepairGenerator;
  * files.
  *
  * @author  le01, 6.035 Staff (<tt>6.035-staff@mit.edu</tt>)
- * @version <tt>$Id: CLI.java,v 1.20 2005/11/09 16:47:42 bdemsky Exp $</tt>
+ * @version <tt>$Id: CLI.java,v 1.21 2005/11/09 21:06:29 bdemsky Exp $</tt>
  */
 public class CLI {
     /**
@@ -104,6 +104,7 @@ public class CLI {
            System.out.println("-depth depthnum constraintnum -- generate dependency graph from constraintnum with depth of depthnum");
            System.out.println("-depthconj depthnum constraintnum conjunctionnum -- generate dependency graph from constraintnum with depth of depthnum");
            System.out.println("-instrument -- generate instrumentation code");
+           System.out.println("-removeconj constr,conj");
            System.out.println("-aggressivesearch -- search for one repair per constraint");
            System.out.println("-prunequantifiernodes -- prune nodes that satisfy constraint by decreasing scope");
            System.out.println("-cplusplus -- properly set up c++ classes");
@@ -125,6 +126,12 @@ public class CLI {
                 debug = true;
            } else if (args[i].equals("-checkonly")) {
                 Compiler.REPAIR=false;
+           } else if (args[i].equals("-removeconj")) {
+               if ((i+1)==args.length) {
+                   throw new Error("No fieldname");
+               }
+               Compiler.removeconj.add(args[i+1]);
+               i++;
            } else if (args[i].equals("-exactallocation")) {
                 Compiler.EXACTALLOCATION=true;
            } else if (args[i].equals("-omitcomp")) {
index a53acc7..f0b13cd 100755 (executable)
@@ -28,11 +28,14 @@ public class Compiler {
     public static boolean OMITCOMP=false;
     public static boolean MERGENODES=false;
     public static boolean TIME=false;
+
+    public static HashSet removeconj=new HashSet();
     public static boolean DEBUGGRAPH=false;
     public static boolean REJECTLENGTH=false;
     public static boolean PRINTREPAIRS=false;
     public static boolean EXACTALLOCATION=false;
 
+
     public static Vector debuggraphs=new Vector();
 
     public static void main(String[] args) {
index 8585655..32facba 100755 (executable)
@@ -173,6 +173,9 @@ public class Termination {
            Constraint c=(Constraint)constraints.get(i);
            DNFConstraint dnf=c.dnfconstraint;
            for(int j=0;j<dnf.size();j++) {
+               if (Compiler.removeconj.contains(new String(i+","+j)))
+                   continue;
+
                TermNode tn=new TermNode(c,dnf.get(j));
                GraphNode gn=new GraphNode("Conj"+i+"A"+j,
                                           "Conj ("+i+","+j+") "+dnf.get(j).name()
@@ -186,6 +189,8 @@ public class Termination {
            }
            // Construct quantifier "conjunction" nodes
            for(int j=0;j<c.numQuantifiers();j++) {
+               if (Compiler.removeconj.contains(new String(i+","+(j+constraints.size()))))
+                   continue;
                Quantifier q=c.getQuantifier(j);
                if (q instanceof SetQuantifier) {
                    SetQuantifier sq=(SetQuantifier)q;
@@ -195,8 +200,8 @@ public class Termination {
                    dconst=dconst.not();
                    TermNode tn=new TermNode(c,dconst.get(0));
                    tn.setquantifiernode();
-                   GraphNode gn=new GraphNode("Conj"+i+"AQ"+j,
-                                              "Conj ("+i+","+j+") "+dconst.get(0).name()
+                   GraphNode gn=new GraphNode("Conj"+i+"AQ"+(j+constraints.size()),
+                                              "Conj ("+i+","+(j+constraints.size())+") "+dconst.get(0).name()
                                               ,tn);
                    gn.setOption(conjoption);
                    conjunctions.add(gn);
@@ -213,8 +218,8 @@ public class Termination {
                    dconst=dconst.not();
                    TermNode tn=new TermNode(c,dconst.get(0));
                    tn.setquantifiernode();
-                   GraphNode gn=new GraphNode("Conj"+i+"AQ"+j,
-                                              "Conj ("+i+","+j+") "+dconst.get(0).name()
+                   GraphNode gn=new GraphNode("Conj"+i+"AQ"+(j+constraints.size()),
+                                              "Conj ("+i+","+(j+constraints.size())+") "+dconst.get(0).name()
                                               ,tn);
                    gn.setOption(conjoption);
                    conjunctions.add(gn);
index 0f47287..9892ad2 100755 (executable)
@@ -52,6 +52,7 @@ class UpdateNode {
             return false;
        if (computeordering()) /* Ordering exists */
            return true;
+       
        return false;
     }