From: bdemsky Date: Mon, 2 Aug 2004 21:42:44 +0000 (+0000) Subject: Updates to allow discovering of partial functions X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e2af60de1736531dfe9f5ce4b5192e2d343434b8;p=repair.git Updates to allow discovering of partial functions --- diff --git a/Repair/RepairCompiler/MCC/Compiler.java b/Repair/RepairCompiler/MCC/Compiler.java index a1f8bf6..fc4f738 100755 --- a/Repair/RepairCompiler/MCC/Compiler.java +++ b/Repair/RepairCompiler/MCC/Compiler.java @@ -62,6 +62,7 @@ public class Compiler { success = semantics(state) || error(state, "Semantic analysis failed, not attempting variable initialization."); + state.setanalysis=new SetAnalysis(state); Termination termination=null; /* Check partition constraints */ (new ImplicitSchema(state)).update(); diff --git a/Repair/RepairCompiler/MCC/IR/CastExpr.java b/Repair/RepairCompiler/MCC/IR/CastExpr.java index 23e194f..263460f 100755 --- a/Repair/RepairCompiler/MCC/IR/CastExpr.java +++ b/Repair/RepairCompiler/MCC/IR/CastExpr.java @@ -15,6 +15,10 @@ public class CastExpr extends Expr { return expr.isValue(td); } + public SetDescriptor getSet() { + return expr.getSet(); + } + public Set freeVars() { return expr.freeVars(); } diff --git a/Repair/RepairCompiler/MCC/IR/ConstraintDependence.java b/Repair/RepairCompiler/MCC/IR/ConstraintDependence.java index 0e718c2..cd3eb99 100755 --- a/Repair/RepairCompiler/MCC/IR/ConstraintDependence.java +++ b/Repair/RepairCompiler/MCC/IR/ConstraintDependence.java @@ -156,7 +156,7 @@ public class ConstraintDependence { continue; for(Iterator fit=functions.iterator();fit.hasNext();) { Function f=(Function)fit.next(); - if (rulesensurefunction(f)) + if (rulesensurefunction(state,f,false)) continue; //no constraint needed to ensure Set s=providesfunction(f); @@ -171,7 +171,12 @@ public class ConstraintDependence { } } - private boolean rulesensurefunction(Function f) { + /** This method determines whether the model definition rules + * ensure that the relation and evaluation domain descriped by f + * is either a function (if isPartial=false) or a partial function + * (if isPartial=true). */ + + static private boolean rulesensurefunction(State state,Function f, boolean isPartial) { boolean foundrule=false; for(int i=0;i