5 public class RelationQuantifier extends Quantifier {
7 RelationDescriptor relation;
8 VarDescriptor x, y; // y = x.relation
10 public RelationQuantifier() {}
12 public void setRelation(RelationDescriptor rd) {
16 public void setTuple(VarDescriptor x, VarDescriptor y) {
21 public Set getRequiredDescriptors() {
22 HashSet v = new HashSet();
27 public String toString() {
28 return "relation quantifier <" + x.getSymbol() + "," + y.getSymbol() + "> in " + relation.getSymbol();
31 public void generate_open(CodeWriter writer) {
32 writer.outputline("for (SimpleIterator* " + x.getSafeSymbol() + "_iterator = " + relation.getSafeSymbol() + "_hash->iterator(); " + x.getSafeSymbol() + "_iterator->hasNext(); ) {");
34 writer.outputline(y.getType().getSafeSymbol() + " " + y.getSafeSymbol() + " = (" + y.getType().getSafeSymbol() + ") " + x.getSafeSymbol() + "_iterator->next();");
35 // #ATTN#: key is called second because next() forwards ptr and key does not!
36 writer.outputline(x.getType().getSafeSymbol() + " " + x.getSafeSymbol() + " = (" + x.getType().getSafeSymbol() + ") " + x.getSafeSymbol() + "_iterator->key();");