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);
return v;
}
- public void generate(CodeWriter writer, VarDescriptor vd) {
+ public void generate(CodeWriter writer, VarDescriptor dest) {
throw new IRException("unsupported");
}
- public void generate_set(CodeWriter writer, VarDescriptor vd) {
- writer.outputline("Set " + vd.getSafeSymbol() + " = " + sd.getSafeSymbol() + "_hash;");
+ public void generate_inclusion(CodeWriter writer, VarDescriptor dest, VarDescriptor element) {
+ writer.outputline("int " + dest.getSafeSymbol() + " = " + sd.getSafeSymbol() + "_hash->contains(" + element.getSafeSymbol() + ");");
}
+ public void generate_size(CodeWriter writer, VarDescriptor dest) {
+ writer.outputline("int " + dest.getSafeSymbol() + " = " + sd.getSafeSymbol() + "_hash->count();");
+ }
+
public void prettyPrint(PrettyPrinter pp) {
pp.output(sd.getSafeSymbol());
}
}
}
+
+