Checking in changes that:
[repair.git] / Repair / RepairCompiler / MCC / IR / SetExpr.java
index 083ebaf341d40f03a90869c0f401fb9f738a7d43..d166e6e9cce2554395bbc9c0bfa506210d7c9fdc 100755 (executable)
@@ -9,11 +9,43 @@ public class SetExpr extends Expr {
     public SetExpr(SetDescriptor sd) {
         this.sd = sd;
     }
-    
+
+    public String name() {
+       return sd.toString();
+    }
+
+    public boolean equals(Map remap, Expr e) {
+       if (e==null||!(e instanceof SetExpr))
+           return false;
+       SetExpr se=(SetExpr)e;
+       if (sd!=se.sd)
+           return false;
+       return true;
+    }
+
+    public boolean usesDescriptor(Descriptor s) {
+       return (s==sd);
+    }
+
+    public Set useDescriptor(Descriptor s) {
+       HashSet newset=new HashSet();
+       if (s==sd)
+           newset.add(this);
+       return newset;
+    }
+
     public SetExpr() {
         this.sd = null;
     }
 
+    public Set getInversedRelations() {
+        return new HashSet();
+    }
+
+    public Descriptor getDescriptor() {
+       return sd;
+    }
+
     public Set getRequiredDescriptors() {
         HashSet v = new HashSet();
         v.add(sd);
@@ -25,11 +57,11 @@ public class SetExpr extends Expr {
     }
 
     public void generate_inclusion(CodeWriter writer, VarDescriptor dest, VarDescriptor element) {
-        writer.outputline("int " + dest.getSafeSymbol() + " = " + sd.getSafeSymbol() + "_hash->contains(" + element.getSafeSymbol() + ");");
-    }    
+        writer.outputline("int " + dest.getSafeSymbol() + " = SimpleHashcontainskey(" +sd.getSafeSymbol()+ "_hash, "+element.getSafeSymbol() + ");");
+    }
 
     public void generate_size(CodeWriter writer, VarDescriptor dest) {
-        writer.outputline("int " + dest.getSafeSymbol() + " = " + sd.getSafeSymbol() + "_hash->count();");
+        writer.outputline("int " + dest.getSafeSymbol() + " = SimpleHashcountset("+sd.getSafeSymbol()+"_hash);");
     }
 
     public void prettyPrint(PrettyPrinter pp) {
@@ -42,5 +74,3 @@ public class SetExpr extends Expr {
     }
 
 }
-
-