5 public class ImageSetExpr extends SetExpr {
7 public static final boolean INVERSE = true;
10 RelationDescriptor rd;
13 public ImageSetExpr(VarDescriptor vd, RelationDescriptor rd) {
19 public ImageSetExpr(boolean inverse, VarDescriptor vd, RelationDescriptor rd) {
22 this.inverse = inverse;
25 public boolean inverted() {
29 public VarDescriptor getVar() {
33 public RelationDescriptor getRelation() {
37 public Descriptor getDescriptor() {
41 public boolean usesDescriptor(RelationDescriptor rd) {
45 public Set getInversedRelations() {
46 HashSet set = new HashSet();
53 public Set getRequiredDescriptors() {
54 HashSet v = new HashSet();
59 public void generate(CodeWriter writer, VarDescriptor dest) {
60 throw new IRException("not supported");
63 public void generate_inclusion(CodeWriter writer, VarDescriptor dest, VarDescriptor element) {
64 String hash = inverse ? "_hashinv->contains(" : "_hash->contains(" ;
65 writer.outputline("int " + dest.getSafeSymbol() + " = " + rd.getSafeSymbol() + hash + vd.getSafeSymbol() + ", " + element.getSafeSymbol() + ");");
68 public void generate_size(CodeWriter writer, VarDescriptor dest) {
72 String hash = inverse ? "_hashinv->count(" : "_hash->count(" ;
73 writer.outputline("int " + dest.getSafeSymbol() + " = " + rd.getSafeSymbol() + hash + vd.getSafeSymbol() + ");");
76 public void prettyPrint(PrettyPrinter pp) {
77 pp.output(vd.toString());
82 pp.output(rd.toString());
85 public TypeDescriptor typecheck(SemanticAnalyzer sa) {
86 throw new IRException("not supported");