本文整理汇总了Java中kodkod.ast.ExprToIntCast.expression方法的典型用法代码示例。如果您正苦于以下问题:Java ExprToIntCast.expression方法的具体用法?Java ExprToIntCast.expression怎么用?Java ExprToIntCast.expression使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kodkod.ast.ExprToIntCast
的用法示例。
在下文中一共展示了ExprToIntCast.expression方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toInt
import kodkod.ast.ExprToIntCast; //导入方法依赖的package包/类
private IntExpression toInt(Expr x, Object y) throws Err, ErrorFatal {
// simplify: if y is int[Int[sth]] then return sth
if (y instanceof ExprToIntCast) {
ExprToIntCast y2 = (ExprToIntCast) y;
if (y2.expression() instanceof IntToExprCast)
return ((IntToExprCast) y2.expression()).intExpr();
}
// simplify: if y is Int[sth], then return sth
if (y instanceof IntToExprCast)
return ((IntToExprCast) y).intExpr();
if (y instanceof IntExpression)
return (IntExpression) y;
// [AM]: maybe this conversion should be removed
if (y instanceof Expression)
return ((Expression) y).sum();
throw new ErrorFatal(x.span(), "This should have been an integer expression.\nInstead it is " + y);
}
示例2: toInt
import kodkod.ast.ExprToIntCast; //导入方法依赖的package包/类
private IntExpression toInt(Expr x, Object y) throws Err, ErrorFatal {
// simplify: if y is int[Int[sth]] then return sth
if (y instanceof ExprToIntCast) {
ExprToIntCast y2 = (ExprToIntCast) y;
if (y2.expression() instanceof IntToExprCast)
return ((IntToExprCast)y2.expression()).intExpr();
}
// simplify: if y is Int[sth], then return sth
if (y instanceof IntToExprCast)
return ((IntToExprCast) y).intExpr();
if (y instanceof IntExpression)
return (IntExpression)y;
//[AM]: maybe this conversion should be removed
if (y instanceof Expression) return ((Expression) y).sum();
throw new ErrorFatal(x.span(), "This should have been an integer expression.\nInstead it is "+y);
}
示例3: visit
import kodkod.ast.ExprToIntCast; //导入方法依赖的package包/类
public IntExpression visit(ExprToIntCast expr) {
IntExpression ret = lookup(expr);
if (ret!=null) return ret;
final ExprCastOperator op = expr.op();
final Expression child = expr.expression().accept(this);
final int hash = hash(op, child);
for(Iterator<PartialCannonicalizer.Holder<IntExpression>> itr = intExprs.get(hash); itr.hasNext(); ) {
final IntExpression next = itr.next().obj;
if (next.getClass()==ExprToIntCast.class) {
if (((ExprToIntCast)next).expression()==child)
return cache(expr, next);
}
}
ret = child==expr.expression() ? expr : child.apply(op);
intExprs.add(new PartialCannonicalizer.Holder<IntExpression>(ret, hash));
return cache(expr,ret);
}
示例4: visit
import kodkod.ast.ExprToIntCast; //导入方法依赖的package包/类
/**
* Calls lookup(intExpr) and returns the cached value, if any. If a
* replacement has not been cached, visits the expression's child. If
* nothing changes, the argument is cached and returned, otherwise a
* replacement expression is cached and returned.
*
* @return { i: ExprToIntCast | i.expression =
* intExpr.expression.accept(delegate) && i.op = intExpr.op}
*/
public IntExpression visit(ExprToIntCast intExpr) {
IntExpression ret = lookup(intExpr);
if (ret != null)
return ret;
final Expression expr = intExpr.expression().accept(delegate);
ret = expr == intExpr.expression() ? intExpr : expr.apply(intExpr.op());
return cache(intExpr, ret);
}
示例5: visit
import kodkod.ast.ExprToIntCast; //导入方法依赖的package包/类
/**
* Calls lookup(intExpr) and returns the cached value, if any.
* If a replacement has not been cached, visits the expression's
* child. If nothing changes, the argument is cached and
* returned, otherwise a replacement expression is cached and returned.
* @return { i: ExprToIntCast | i.expression = intExpr.expression.accept(this) && i.op = intExpr.op}
*/
public IntExpression visit(ExprToIntCast intExpr) {
IntExpression ret = lookup(intExpr);
if (ret!=null) return ret;
final Expression expr = intExpr.expression().accept(this);
ret = expr==intExpr.expression() ? intExpr : expr.apply(intExpr.op());
return cache(intExpr, ret);
}