Java Code Examples for kodkod.ast.operator.IntOperator#ABS

The following examples show how to use kodkod.ast.operator.IntOperator#ABS . 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 5 votes vote down vote up
/**
 * @ensures appends the given op and child to this.tokens; the child is
 *          parenthesized if it's not an instance of unary int expression or int
 *          constant.
 **/
@Override
public void visit(UnaryIntExpression node) {
    final IntExpression child = node.intExpr();
    final IntOperator op = node.op();
    final boolean parens = (op == IntOperator.ABS) || (op == IntOperator.SGN) || parenthesize(child);
    append(node.op());
    visitChild(child, parens);
}
 
Example 2
Source File: PrettyPrinter.java    From kodkod with MIT License 5 votes vote down vote up
/** @ensures appends the given op and child to this.tokens; the child is 
 * parenthesized if it's not an instance of unary int expression or int constant. **/
public void visit(UnaryIntExpression node)  { 
	final IntExpression child = node.intExpr();
	final IntOperator op = node.op();
	final boolean parens = 
		(op==IntOperator.ABS) || (op==IntOperator.SGN) || 
		parenthesize(child);
	append(node.op());
	visitChild(child, parens);
}
 
Example 3
Source File: PrettyPrinter.java    From quetzal with Eclipse Public License 2.0 5 votes vote down vote up
/** @effects appends the given op and child to this.tokens; the child is 
 * parenthesized if it's not an instance of unary int expression or int constant. **/
public void visit(UnaryIntExpression node)  { 
	if (displayed(node)) return;
	final boolean oldTop = notTop();
	final IntExpression child = node.intExpr();
	final IntOperator op = node.op();
	final boolean parens = 
		(op==IntOperator.ABS) || (op==IntOperator.SGN) || 
		parenthesize(child);
	append(node.op());
	visitChild(child, parens);
	top = oldTop;
}