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 VarDescriptor getVar() {
29 public RelationDescriptor getRelation() {
33 public Set getInversedRelations() {
34 HashSet set = new HashSet();
41 public Set getRequiredDescriptors() {
42 HashSet v = new HashSet();
47 public void generate(CodeWriter writer, VarDescriptor dest) {
48 throw new IRException("not supported");
51 public void generate_inclusion(CodeWriter writer, VarDescriptor dest, VarDescriptor element) {
52 String hash = inverse ? "_hashinv->contains(" : "_hash->contains(" ;
53 writer.outputline("int " + dest.getSafeSymbol() + " = " + rd.getSafeSymbol() + hash + vd.getSafeSymbol() + ", " + element.getSafeSymbol() + ");");
56 public void generate_size(CodeWriter writer, VarDescriptor dest) {
60 String hash = inverse ? "_hashinv->count(" : "_hash->count(" ;
61 writer.outputline("int " + dest.getSafeSymbol() + " = " + rd.getSafeSymbol() + hash + vd.getSafeSymbol() + ");");
64 public void prettyPrint(PrettyPrinter pp) {
65 pp.output(vd.toString());
70 pp.output(rd.toString());
73 public TypeDescriptor typecheck(SemanticAnalyzer sa) {
74 throw new IRException("not supported");