Java Code Examples for kodkod.ast.ProjectExpression#columns()

The following examples show how to use kodkod.ast.ProjectExpression#columns() . 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: PrettyPrinter.java    From org.alloytools.alloy with Apache License 2.0 6 votes vote down vote up
/**
 * @ensures appends the tokenization of the given node to this.tokens
 */
@Override
public void visit(ProjectExpression node) {
    append("project");
    append("[");
    node.expression().accept(this);
    comma();
    append("<");
    final Iterator<IntExpression> cols = node.columns();
    cols.next().accept(this);
    while (cols.hasNext()) {
        comma();
        cols.next().accept(this);
    }
    append(">");
    append("]");
}
 
Example 2
Source File: TranslateKodkodToJava.java    From org.alloytools.alloy with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void visit(ProjectExpression x) {
    String newname = makename(x);
    if (newname == null)
        return;
    String expr = make(x.expression());
    List<String> names = new ArrayList<String>();
    for (Iterator<IntExpression> i = x.columns(); i.hasNext();) {
        names.add(make(i.next()));
    }
    for (int i = 0; i < names.size(); i++) {
        if (i == 0)
            file.printf("Expression %s=%s.project(", newname, expr);
        else
            file.printf(",");
        file.printf("%s", names.get(i));
    }
    file.printf(");%n");
}
 
Example 3
Source File: PrettyPrinter.java    From kodkod with MIT License 6 votes vote down vote up
/** @ensures appends the tokenization of the given node to this.tokens */
public void visit(ProjectExpression node) {
	append("project");
	append("[");
	node.expression().accept(this);
	comma();
	append("<");
	final Iterator<IntExpression> cols = node.columns();
	cols.next().accept(this);
	while(cols.hasNext()) { 
		comma();
		cols.next().accept(this);
	}
	append(">");
	append("]");
}
 
Example 4
Source File: PrettyPrinter.java    From quetzal with Eclipse Public License 2.0 6 votes vote down vote up
/** @effects appends the tokenization of the given node to this.tokens */
public void visit(ProjectExpression node) {
	if (displayed(node)) return;
	final boolean oldTop = notTop();
	append("project");
	append("[");
	node.expression().accept(this);
	comma();
	append("<");
	final Iterator<IntExpression> cols = node.columns();
	cols.next().accept(this);
	while(cols.hasNext()) { 
		comma();
		cols.next().accept(this);
	}
	append(">");
	append("]");
	top = oldTop;
}