From ae5c0747ba534502d4d2fc540284fc6c456d1bcd Mon Sep 17 00:00:00 2001 From: bdemsky Date: Mon, 22 Dec 2003 01:30:22 +0000 Subject: [PATCH] Adding files --- .../MCC/IR/AbstractInterferes.java | 100 ++++++++++++++++++ .../RepairCompiler/MCC/IR/AbstractRepair.java | 31 ++++++ Repair/RepairCompiler/MCC/IR/ScopeNode.java | 11 ++ Repair/RepairCompiler/MCC/IR/TermNode.java | 47 ++++++++ 4 files changed, 189 insertions(+) create mode 100755 Repair/RepairCompiler/MCC/IR/AbstractInterferes.java create mode 100755 Repair/RepairCompiler/MCC/IR/AbstractRepair.java create mode 100755 Repair/RepairCompiler/MCC/IR/ScopeNode.java create mode 100755 Repair/RepairCompiler/MCC/IR/TermNode.java diff --git a/Repair/RepairCompiler/MCC/IR/AbstractInterferes.java b/Repair/RepairCompiler/MCC/IR/AbstractInterferes.java new file mode 100755 index 0000000..5122d07 --- /dev/null +++ b/Repair/RepairCompiler/MCC/IR/AbstractInterferes.java @@ -0,0 +1,100 @@ +package MCC.IR; + +class AbstractInterferes { + static public boolean interferes(AbstractRepair ar, DNFPredicate dp) { + if ((ar.getDescriptor()!=dp.getPredicate().getDescriptor()) && + ((ar.getDescriptor() instanceof SetDescriptor)|| + !dp.getPredicate().usesDescriptor((RelationDescriptor)ar.getDescriptor()))) + return false; + + /* This if handles all the c comparisons in the paper */ + if (ar.getDescriptor()==dp.getPredicate().getDescriptor()&& + (ar.getType()==AbstractRepair.ADDTOSET||ar.getType()==AbstractRepair.ADDTORELATION)&& + (ar.getPredicate().getPredicate() instanceof ExprPredicate)&& + (dp.getPredicate() instanceof ExprPredicate)&& + (dp.getPredicate().inverted()==ar.getPredicate().getPredicate().inverted())&& + (((ExprPredicate)dp.getPredicate()).getType()==ExprPredicate.SIZE)) { + boolean neg1=ar.getPredicate().isNegated(); + Opcode op1=((ExprPredicate)ar.getPredicate().getPredicate()).getOp(); + int size1=((ExprPredicate)ar.getPredicate().getPredicate()).leftsize(); + boolean neg2=dp.isNegated(); + Opcode op2=((ExprPredicate)dp.getPredicate()).getOp(); + int size2=((ExprPredicate)dp.getPredicate()).leftsize(); + if ((!neg1&&((op1==Opcode.EQ)||(op1==Opcode.NE)||(op1==Opcode.GT)||op1==Opcode.GE))|| + (neg1&&((op1==Opcode.EQ)||(op1==Opcode.NE)||(op1==Opcode.LT)||op1==Opcode.LE))) { + int size1a=0; + if (!neg1) { + if((op1==Opcode.EQ)||(op1==Opcode.GE)) + size1a=size1; + if((op1==Opcode.GT)||(op1==Opcode.NE)) + size1a=size1+1; + } + if (neg1) { + if((op1==Opcode.EQ)||(op1==Opcode.LE)) + size1a=size1+1; + if((op1==Opcode.LT)||(op1==Opcode.NE)) + size1a=size1; + } + if ((!neg2&&(op2==Opcode.EQ)&&(size1a==size2))|| + (neg2&&(op2==Opcode.EQ)&&(size1a!=size2))|| + (!neg2&&(op2==Opcode.NE)&&(size1a!=size2))|| + (neg2&&(op2==Opcode.NE)&&(size1a==size2))|| + (!neg2&&(op2==Opcode.GE))|| + (!neg2&&(op2==Opcode.GT))|| + (neg2&&(op2==Opcode.LE))|| + (neg2&&(op2==Opcode.LT))|| + (neg2&&(op2==Opcode.GE)&&(size1a=size2))|| + (!neg2&&(op2==Opcode.GT)&&(size1a>size2))|| + (neg2&&(op2==Opcode.LE)&&(size1a>size2))|| + (neg2&&(op2==Opcode.LT)&&(size1a>=size2))) + return false; + } + + + } + return true; + } +} diff --git a/Repair/RepairCompiler/MCC/IR/AbstractRepair.java b/Repair/RepairCompiler/MCC/IR/AbstractRepair.java new file mode 100755 index 0000000..037251a --- /dev/null +++ b/Repair/RepairCompiler/MCC/IR/AbstractRepair.java @@ -0,0 +1,31 @@ +package MCC.IR; + +class AbstractRepair { + public final static int ADDTOSET=1; + public final static int REMOVEFROMSET=2; + public final static int ADDTORELATION=3; + public final static int REMOVEFROMRELATION=4; + public final static int MODIFYRELATION=5; + + DNFPredicate torepair; + int type; + Descriptor descriptor; + + public int getType() { + return type; + } + + public DNFPredicate getPredicate() { + return torepair; + } + + public Descriptor getDescriptor() { + return descriptor; + } + + public AbstractRepair(DNFPredicate dp,int typ, Descriptor d) { + torepair=dp; + type=typ; + descriptor=d; + } +} diff --git a/Repair/RepairCompiler/MCC/IR/ScopeNode.java b/Repair/RepairCompiler/MCC/IR/ScopeNode.java new file mode 100755 index 0000000..8a10b6d --- /dev/null +++ b/Repair/RepairCompiler/MCC/IR/ScopeNode.java @@ -0,0 +1,11 @@ +package MCC.IR; + +class ScopeNode { + Rule rule; + boolean satisfy; + + public ScopeNode(Rule r,boolean satisfy) { + rule=r; + this.satisfy=satisfy; + } +} diff --git a/Repair/RepairCompiler/MCC/IR/TermNode.java b/Repair/RepairCompiler/MCC/IR/TermNode.java new file mode 100755 index 0000000..46b9f74 --- /dev/null +++ b/Repair/RepairCompiler/MCC/IR/TermNode.java @@ -0,0 +1,47 @@ +package MCC.IR; + +class TermNode { + public final static int CONJUNCTION=1; + public final static int ABSTRACT=2; + public final static int UPDATE=3; + public final static int RULESCOPE=4; + + + Constraint constr; + Conjunction conj; + int type; + AbstractRepair repair; + ScopeNode scope; + + + public TermNode(Constraint constr, Conjunction conj) { + this.constr=constr; + this.conj=conj; + type=CONJUNCTION; + } + + public TermNode(AbstractRepair ar) { + repair=ar; + type=ABSTRACT; + } + + public TermNode(ScopeNode sn) { + scope=sn; + type=RULESCOPE; + } + + public Conjunction getConjunction() { + if (type!=CONJUNCTION) + throw new Error("Not Conjunction Node!"); + else + return conj; + } + + public AbstractRepair getAbstract() { + if (type!=ABSTRACT) + throw new Error("Not Abstract Repair Node!"); + else + return repair; + } +} + -- 2.34.1