5 public class SetExpr extends Expr {
9 public SetExpr(SetDescriptor sd) {
13 public String name() {
17 public boolean equals(Map remap, Expr e) {
18 if (e==null||!(e instanceof SetExpr))
20 SetExpr se=(SetExpr)e;
26 public boolean usesDescriptor(Descriptor s) {
30 public Set useDescriptor(Descriptor s) {
31 HashSet newset=new HashSet();
41 public Set getInversedRelations() {
45 public Descriptor getDescriptor() {
49 public Set getRequiredDescriptors() {
50 HashSet v = new HashSet();
55 public void generate(CodeWriter writer, VarDescriptor dest) {
56 throw new IRException("unsupported");
59 public void generate_inclusion(CodeWriter writer, VarDescriptor dest, VarDescriptor element) {
60 writer.addDeclaration("int", dest.getSafeSymbol());
61 writer.outputline(dest.getSafeSymbol() + " = SimpleHashcontainskey(" +sd.getSafeSymbol()+ "_hash, "+element.getSafeSymbol() + ");");
64 public void generate_size(CodeWriter writer, VarDescriptor dest) {
65 writer.addDeclaration("int", dest.getSafeSymbol());
66 writer.outputline(dest.getSafeSymbol() + " = SimpleHashcountset("+sd.getSafeSymbol()+"_hash);");
69 public void prettyPrint(PrettyPrinter pp) {
70 pp.output(sd.getSafeSymbol());
73 public TypeDescriptor typecheck(SemanticAnalyzer sa) {
74 this.td = sd.getType();