Java Code Examples for kodkod.ast.Decl#multiplicity()
The following examples show how to use
kodkod.ast.Decl#multiplicity() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TranslateKodkodToJava.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public void visit(Decl x) { String newname = makename(x); if (newname == null) return; String v = make(x.variable()); String e = make(x.expression()); switch (x.multiplicity()) { case LONE : file.printf("Decls %s=%s.loneOf(%s);%n", newname, v, e); break; case ONE : file.printf("Decls %s=%s.oneOf(%s);%n", newname, v, e); break; case SOME : file.printf("Decls %s=%s.someOf(%s);%n", newname, v, e); break; case SET : file.printf("Decls %s=%s.setOf(%s);%n", newname, v, e); break; default : throw new RuntimeException("Unknown kodkod multiplicity \"" + x.multiplicity() + "\" encountered"); } }
Example 2
Source File: FOL2BoolTranslator.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
/** * Calls lookup(decl) and returns the cached value, if any. If a translation has * not been cached, translates decl.expression, calls cache(...) on it and * returns it. * * @return let t = lookup(decl) | some t => t, cache(decl, * decl.expression.accept(this)) */ @Override public final BooleanMatrix visit(Decl decl) { BooleanMatrix matrix = lookup(decl); if (matrix != null) return matrix; if (decl.multiplicity() != Multiplicity.ONE) throw new HigherOrderDeclException(decl); return cache(decl, decl.expression().accept(this)); }
Example 3
Source File: HOLTranslator.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
private boolean noNewHOLSkolems(Collection<Relation> newSkolems, Collection<Relation> oldSkolems) { Set<Relation> diff = new HashSet<Relation>(newSkolems); diff.removeAll(oldSkolems); for (Relation sk : diff) { Decl d = sk.getSkolemVarDecl(); if (d != null && d.multiplicity() != Multiplicity.ONE) return false; } return true; }
Example 4
Source File: PrettyPrinter.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
/** * @ensures this.tokens' = concat[ this.tokens, tokenize[ node.variable ], ":", * tokenize[ node.expression ] **/ @Override public void visit(Decl node) { node.variable().accept(this); colon(); if (node.multiplicity() != Multiplicity.ONE) { append(node.multiplicity()); space(); } node.expression().accept(this); }
Example 5
Source File: FOL2BoolTranslator.java From kodkod with MIT License | 5 votes |
/** * Calls lookup(decl) and returns the cached value, if any. * If a translation has not been cached, translates decl.expression, * calls cache(...) on it and returns it. * @return let t = lookup(decl) | * some t => t, cache(decl, decl.expression.accept(this)) */ public final BooleanMatrix visit(Decl decl) { BooleanMatrix matrix = lookup(decl); if (matrix!=null) return matrix; if (decl.multiplicity()!=Multiplicity.ONE) throw new HigherOrderDeclException(decl); return cache(decl, decl.expression().accept(this)); }
Example 6
Source File: PrettyPrinter.java From kodkod with MIT License | 5 votes |
/** * @ensures this.tokens' = * concat[ this.tokens, tokenize[ node.variable ], ":", tokenize[ node.expression ] **/ public void visit(Decl node) { node.variable().accept(this); colon(); if (node.multiplicity()!=Multiplicity.ONE) { append(node.multiplicity()); space(); } node.expression().accept(this); }
Example 7
Source File: PrettyPrinter.java From quetzal with Eclipse Public License 2.0 | 5 votes |
/** * @effects this.tokens' = * concat[ this.tokens, tokenize[ node.variable ], ":", tokenize[ node.expression ] **/ public void visit(Decl node) { if (displayed(node)) return; final boolean oldTop = notTop(); node.variable().accept(this); colon(); if (node.multiplicity()!=Multiplicity.ONE) { append(node.multiplicity()); space(); } node.expression().accept(this); top = oldTop; }