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.outputline("int " + dest.getSafeSymbol() + " = " + sd.getSafeSymbol() + "_hash->contains(" + element.getSafeSymbol() + ");");
63 public void generate_size(CodeWriter writer, VarDescriptor dest) {
64 writer.outputline("int " + dest.getSafeSymbol() + " = " + sd.getSafeSymbol() + "_hash->count();");
67 public void prettyPrint(PrettyPrinter pp) {
68 pp.output(sd.getSafeSymbol());
71 public TypeDescriptor typecheck(SemanticAnalyzer sa) {
72 this.td = sd.getType();