• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ExprToIntCast类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中kodkod.ast.ExprToIntCast的典型用法代码示例。如果您正苦于以下问题:Java ExprToIntCast类的具体用法?Java ExprToIntCast怎么用?Java ExprToIntCast使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ExprToIntCast类属于kodkod.ast包,在下文中一共展示了ExprToIntCast类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: visit

import kodkod.ast.ExprToIntCast; //导入依赖的package包/类
/**
 * Calls lookup(intExpr) and returns the cached value, if any. If a
 * translation has not been cached, translates the expression, calls
 * cache(...) on it and returns it.
 * 
 * @return let t = lookup(intExpr) | some t => t, cache(intExpr,
 *         translate(intExpr))
 */
public final Int visit(ExprToIntCast intExpr) {
	Int ret = lookup(intExpr);
	if (ret != null)
		return ret;
	vars = vars.createNested();
	BooleanMatrix expr = intExpr.expression().accept(this);
	switch (intExpr.op()) {
		case CARDINALITY :
			ret = expr.cardinality();
			break;
		case SUM :
			final IntSet ints = interpreter.ints();
			ret = sum(expr, ints.iterator(), 0, ints.size() - 1);
			break;
		default :
			throw new IllegalArgumentException("unknown operator: " + intExpr.op());
	}
	for (Variable v : vars)
		ret.defCond().addVar(v);
	vars = vars.parent();
	return cache(intExpr, ret);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:31,代码来源:FOL2BoolTranslator.java


示例2: visit

import kodkod.ast.ExprToIntCast; //导入依赖的package包/类
/**
 * @ensures this.tokens' = concat[ this.tokens, "int","[",
 *          tokenize[node.expression], "]" ]
 **/
public void visit(ExprToIntCast node) {
	switch (node.op()) {
		case SUM :
			append("int");
			append("[");
			node.expression().accept(this);
			append("]");
			break;
		case CARDINALITY :
			append("#");
			append("(");
			node.expression().accept(this);
			append(")");
			break;
		default :
			throw new IllegalArgumentException("unknown operator: " + node.op());
	}

}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:24,代码来源:PrettyPrinter.java


示例3: visit

import kodkod.ast.ExprToIntCast; //导入依赖的package包/类
/** {@inheritDoc} */
public void visit(ExprToIntCast x) {
	String newname = makename(x);
	if (newname == null)
		return;
	String sub = make(x.expression());
	switch (x.op()) {
		case CARDINALITY :
			file.printf("IntExpression %s=%s.count();%n", newname, sub);
			break;
		case SUM :
			file.printf("IntExpression %s=%s.sum();%n", newname, sub);
			break;
		default :
			throw new RuntimeException("Unknown kodkod operator \"" + x.op() + "\" encountered");
	}
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:18,代码来源:TranslateKodkodToJava.java


示例4: 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);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:18,代码来源:TranslateAlloyToKodkod.java


示例5: 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);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:17,代码来源:TranslateAlloyToKodkod.java


示例6: visit

import kodkod.ast.ExprToIntCast; //导入依赖的package包/类
/** 
 * Calls lookup(intExpr) and returns the cached value, if any.  
 * If a translation has not been cached, translates the expression,
 * calls cache(...) on it and returns it.
 * @return let t = lookup(intExpr) | some t => t, 
 * 	cache(intExpr, translate(intExpr))
 */
public final Int visit(ExprToIntCast intExpr) {
	Int ret = lookup(intExpr);
	if (ret!=null) return ret;
	vars = vars.createNested();
	BooleanMatrix expr = intExpr.expression().accept(this);
       switch(intExpr.op()) {
	case CARDINALITY : 
		ret = expr.cardinality(); break;
	case SUM         :
		final IntSet ints = interpreter.ints();
		ret = sum(expr, ints.iterator(), 0, ints.size()-1); break;
	default: 
		throw new IllegalArgumentException("unknown operator: " + intExpr.op());
	}
       for (Variable v : vars) ret.defCond().addVar(v); 
       vars = vars.parent(); 
	return cache(intExpr, ret);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:26,代码来源:FOL2BoolTranslator.java


示例7: visit

import kodkod.ast.ExprToIntCast; //导入依赖的package包/类
/** @ensures this.tokens' = concat[ this.tokens, "int","[",
 *   tokenize[node.expression], "]" ] **/
public void visit(ExprToIntCast node) {
	switch(node.op()) { 
	case SUM:
		append("int");
		append("[");
		node.expression().accept(this);
		append("]");
		break;
	case CARDINALITY : 
		append("#");
		append("(");
		node.expression().accept(this);
		append(")");
		break;
	default : throw new IllegalArgumentException("unknown operator: " + node.op());
	}
	
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:21,代码来源:PrettyPrinter.java


示例8: 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);
}
 
开发者ID:wala,项目名称:MemSAT,代码行数:20,代码来源:PartialCannonicalizer.java


示例9: visit

import kodkod.ast.ExprToIntCast; //导入依赖的package包/类
/** @effects this.tokens' = concat[ this.tokens, "int","[",
 *   tokenize[node.expression], "]" ] **/
public void visit(ExprToIntCast node) {
	if (displayed(node)) return;
	final boolean oldTop = notTop();
	switch(node.op()) { 
	case SUM:
		append("int");
		append("[");
		node.expression().accept(this);
		append("]");
		break;
	case CARDINALITY : 
		append("#");
		append("(");
		node.expression().accept(this);
		append(")");
		break;
	default : throw new IllegalArgumentException("unknown operator: " + node.op());
	}
	top = oldTop;
}
 
开发者ID:wala,项目名称:MemSAT,代码行数:23,代码来源:PrettyPrinter.java


示例10: 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);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:19,代码来源:AbstractReplacer.java


示例11: visit

import kodkod.ast.ExprToIntCast; //导入依赖的package包/类
/**
 * Calls lookup(intExpr) and returns the cached value, if any. If no cached
 * value exists, visits the child, caches its return value and returns it.
 * 
 * @return let x = lookup(intExpr) | x != null => x, cache(intExpr,
 *         intExpr.expression.accept(this))
 */
public Set<T> visit(ExprToIntCast intExpr) {
	Set<T> ret = lookup(intExpr);
	if (ret != null)
		return ret;
	ret = newSet();
	ret.addAll(intExpr.expression().accept(this));
	return cache(intExpr, ret);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:16,代码来源:AbstractCollector.java


示例12: visit

import kodkod.ast.ExprToIntCast; //导入依赖的package包/类
/** {@inheritDoc} */
public void visit(ExprToIntCast x) {
    String newname=makename(x); if (newname==null) return;
    String sub=make(x.expression());
    switch(x.op()) {
       case CARDINALITY: file.printf("IntExpression %s=%s.count();%n", newname, sub); break;
       case SUM: file.printf("IntExpression %s=%s.sum();%n", newname, sub); break;
       default: throw new RuntimeException("Unknown kodkod operator \""+x.op()+"\" encountered");
    }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:11,代码来源:TranslateKodkodToJava.java


示例13: 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);
  }
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:16,代码来源:AbstractReplacer.java


示例14: visit

import kodkod.ast.ExprToIntCast; //导入依赖的package包/类
/** 
 * Calls lookup(intExpr) and returns the cached value, if any.  
 * If no cached value exists, visits the child, caches its return value and returns it. 
 * @return let x = lookup(intExpr) | 
 *          x != null => x,  
 *          cache(intExpr, intExpr.expression.accept(this)) 
 */
public Set<T> visit(ExprToIntCast intExpr) {
	Set<T> ret = lookup(intExpr);
	if (ret!=null) return ret;
	ret = newSet();
	ret.addAll(intExpr.expression().accept(this));
	return cache(intExpr,ret);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:15,代码来源:AbstractCollector.java


示例15: visit

import kodkod.ast.ExprToIntCast; //导入依赖的package包/类
/** 
 * Calls lookup(intExpr) and returns the cached value, if any.  
 * If a translation has not been cached, translates the expression,
 * calls cache(...) on it and returns it.
 * @return let t = lookup(intExpr) | some t => t, 
 * 	cache(intExpr, translate(intExpr))
 */
public final Int visit(ExprToIntCast intExpr) {
	Int ret = lookup(intExpr);
	if (ret!=null) return ret;
	switch(intExpr.op()) {
	case CARDINALITY : 
		ret = intExpr.expression().accept(this).cardinality(); break;
	case SUM         :
		final IntSet ints = interpreter.ints();
		ret = sum(intExpr.expression().accept(this), ints.iterator(), 0, ints.size()-1); break;
	default: 
		throw new IllegalArgumentException("unknown operator: " + intExpr.op());
	}
	return cache(intExpr, ret);
}
 
开发者ID:emina,项目名称:kodkod,代码行数:22,代码来源:FOL2BoolTranslator.java


示例16: node2expr

import kodkod.ast.ExprToIntCast; //导入依赖的package包/类
/** converts a Kodkod node to a Kodkod expression. */
protected Expression node2expr(Node node) {
    if (node instanceof Expression)
        return (Expression)node;
    if (node instanceof IntExpression) 
        return ((IntExpression) node).toExpression();
    if (node instanceof ExprToIntCast)
        return ((ExprToIntCast) node).expression();
    if (node instanceof Formula)
        return form2expr((Formula) node);
    throw new RuntimeException("don't know how to convert " + node.getClass().getSimpleName() + " to expression");
}
 
开发者ID:aleksandarmilicevic,项目名称:squander,代码行数:13,代码来源:SquanderKodkodImpl.java


示例17: visit

import kodkod.ast.ExprToIntCast; //导入依赖的package包/类
@Override
public I visit(ExprToIntCast intExpr) {
	start(intExpr);
	return end(intExpr, visitor.visit(intExpr));
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:6,代码来源:AspectReturnVisitor.java


示例18: visit

import kodkod.ast.ExprToIntCast; //导入依赖的package包/类
@Override
public IntExpression visit(ExprToIntCast intExpr) {
	return intExpr;
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:5,代码来源:HOLTranslator.java


示例19: parenthesize

import kodkod.ast.ExprToIntCast; //导入依赖的package包/类
/**
 * @return true if the given expression should be parenthesized when a
 *         child of a compound parent
 */
private boolean parenthesize(IntExpression child) {
	return !(child instanceof UnaryIntExpression || child instanceof IntConstant
			|| child instanceof ExprToIntCast);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:9,代码来源:PrettyPrinter.java


示例20: visit

import kodkod.ast.ExprToIntCast; //导入依赖的package包/类
public Boolean visit(ExprToIntCast e) {
	return checkVisitedThenAccumA(e, Boolean.FALSE, e.expression());
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:4,代码来源:AnnotatedNode.java



注:本文中的kodkod.ast.ExprToIntCast类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PointType类代码示例发布时间:2022-05-23
下一篇:
Java UniformColorSprite类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap