kodkod.ast.operator.IntCastOperator Java Examples

The following examples show how to use kodkod.ast.operator.IntCastOperator. 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: PartialCannonicalizer.java    From quetzal with Eclipse Public License 2.0 6 votes vote down vote up
public Expression visit(IntToExprCast expr) { 
	Expression ret = lookup(expr);
	if (ret!=null) return ret;
	
	final IntCastOperator op = expr.op();
	final IntExpression child = expr.intExpr().accept(this);
	
	final int hash = hash(op, child);
	for(Iterator<PartialCannonicalizer.Holder<Expression>> itr = exprs.get(hash); itr.hasNext(); ) {
		final Expression next = itr.next().obj;
		if (next.getClass()==IntToExprCast.class) { 
			if (((IntToExprCast)next).intExpr()==child)
				return cache(expr, next);
		}
	}
	ret = child==expr.intExpr() ? expr : child.cast(op);
	exprs.add(new PartialCannonicalizer.Holder<Expression>(ret, hash));
	return cache(expr,ret);
}
 
Example #2
Source File: PrettyPrinter.java    From quetzal with Eclipse Public License 2.0 5 votes vote down vote up
/** @effects this.tokens' = concat[ this.tokens, "Int","[",
 *   tokenize[node.intExpr], "]" ] **/
public void visit(IntToExprCast node) {
	if (displayed(node)) return;
	final boolean oldTop = notTop();
	append(node.op()==IntCastOperator.INTCAST ? "Int" : "Bits");
	append("[");
	node.intExpr().accept(this);
	append("]");
	top = oldTop;
}
 
Example #3
Source File: IntExpression.java    From org.alloytools.alloy with Apache License 2.0 2 votes vote down vote up
/**
 * Returns an expression that is the relational representation of this integer
 * expression specified by the given operator.
 *
 * @return an expression that is the relational representation of this integer
 *         expression specified by the given operator.
 */
public final Expression cast(IntCastOperator op) {
    if (op == null)
        throw new NullPointerException();
    return new IntToExprCast(this, op);
}
 
Example #4
Source File: IntToExprCast.java    From org.alloytools.alloy with Apache License 2.0 2 votes vote down vote up
/**
 * Constructs a new IntToExprCast.
 *
 * @requires intExpr != null && op != null
 * @ensures this.intexpr' = intExpr
 */
IntToExprCast(IntExpression intExpr, IntCastOperator op) {
    this.intExpr = intExpr;
    this.op = op;
}
 
Example #5
Source File: IntToExprCast.java    From org.alloytools.alloy with Apache License 2.0 2 votes vote down vote up
/**
 * Returns this.op
 *
 * @return this.op
 */
public final IntCastOperator op() {
    return op;
}
 
Example #6
Source File: IntExpression.java    From kodkod with MIT License 2 votes vote down vote up
/**
 * Returns an expression that is the relational representation of this
 * integer expression specified by the given operator.
 * @return an expression that is the relational representation of this
 * integer expression specified by the given operator.
 */
public final Expression cast(IntCastOperator op) { 
	if (op==null) throw new NullPointerException();
	return new IntToExprCast(this, op);
}
 
Example #7
Source File: IntToExprCast.java    From kodkod with MIT License 2 votes vote down vote up
/**
 * Constructs a new IntToExprCast.
 * @requires intExpr != null && op != null
 * @ensures this.intexpr' = intExpr
 */
IntToExprCast(IntExpression intExpr, IntCastOperator op) {
	this.intExpr = intExpr;
	this.op = op;
}
 
Example #8
Source File: IntToExprCast.java    From kodkod with MIT License 2 votes vote down vote up
/**
 * Returns this.op
 * @return this.op
 */
public final IntCastOperator op() { 
	return op;
}