当前位置: 首页>>代码示例>>Java>>正文


Java IntToExprCast.op方法代码示例

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


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

示例1: visit

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

示例2: visit

import kodkod.ast.IntToExprCast; //导入方法依赖的package包/类
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);
}
 
开发者ID:wala,项目名称:MemSAT,代码行数:20,代码来源:PartialCannonicalizer.java

示例3: visit

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

示例4: visit

import kodkod.ast.IntToExprCast; //导入方法依赖的package包/类
/** 
 * Calls lookup(castExpr) 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(castExpr) | some t => t, 
 * 	cache(castExpr, translate(castExpr))
 */
public BooleanMatrix visit(IntToExprCast castExpr) {
	BooleanMatrix ret = lookup(castExpr);
	if (ret!=null) return ret;

	final Int child = castExpr.intExpr().accept(this);
	final BooleanFactory factory =  interpreter.factory();
	final IntSet ints = interpreter.ints();
	
	ret = factory.matrix(Dimensions.square(interpreter.universe().size(), 1));
	
	switch(castExpr.op()) {
	case INTCAST : 	
		for(IntIterator iter = ints.iterator(); iter.hasNext(); ) {
			int i = iter.next();
			int atomIndex = interpreter.interpret(i);
			ret.set(atomIndex, factory.or(ret.get(atomIndex), child.eq(factory.integer(i))));
		}
		break;
	case BITSETCAST : 
		final List<BooleanValue> twosComplement = child.twosComplementBits();
		final int msb = twosComplement.size()-1;
		// handle all bits but the sign bit
		for(int i = 0; i < msb; i++) { 
			int pow2 = 1<<i;
			if (ints.contains(pow2)) { 
				ret.set(interpreter.interpret(pow2), twosComplement.get(i));
			}
		}
		// handle the sign bit
		if (ints.contains(-1<<msb)) {
			ret.set(interpreter.interpret(-1<<msb), twosComplement.get(msb));
		}
		break;
	default : 
		throw new IllegalArgumentException("Unknown cast operator: " + castExpr.op());
	}
	
	return cache(castExpr, ret);
}
 
开发者ID:emina,项目名称:kodkod,代码行数:47,代码来源:FOL2BoolTranslator.java

示例5: visit

import kodkod.ast.IntToExprCast; //导入方法依赖的package包/类
/**
 * Calls lookup(castExpr) 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(castExpr) | some t => t, cache(castExpr,
 *         translate(castExpr))
 */
public BooleanMatrix visit(IntToExprCast castExpr) {
	BooleanMatrix ret = lookup(castExpr);
	if (ret != null)
		return ret;

	final Int child = castExpr.intExpr().accept(this);
	final BooleanFactory factory = interpreter.factory();
	final IntSet ints = interpreter.ints();

	ret = factory.matrix(Dimensions.square(interpreter.universe().size(), 1));

	switch (castExpr.op()) {
		case INTCAST :
			for (IntIterator iter = ints.iterator(); iter.hasNext();) {
				int i = iter.next();
				int atomIndex = interpreter.interpret(i);
				ret.set(atomIndex, factory.or(ret.get(atomIndex), child.eq(factory.integer(i))));
			}
			ret.setDefCond(child.defCond());
			break;
		case BITSETCAST :
			final List<BooleanValue> twosComplement = child.twosComplementBits();
			final int msb = twosComplement.size() - 1;
			// handle all bits but the sign bit
			for (int i = 0; i < msb; i++) {
				int pow2 = 1 << i;
				if (ints.contains(pow2)) {
					ret.set(interpreter.interpret(pow2), twosComplement.get(i));
				}
			}
			// handle the sign bit
			if (ints.contains(-1 << msb)) {
				ret.set(interpreter.interpret(-1 << msb), twosComplement.get(msb));
			}
			break;
		default :
			throw new IllegalArgumentException("Unknown cast operator: " + castExpr.op());
	}

	return cache(castExpr, ret);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:50,代码来源:FOL2BoolTranslator.java

示例6: visit

import kodkod.ast.IntToExprCast; //导入方法依赖的package包/类
/** 
 * Calls lookup(castExpr) 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(castExpr) | some t => t, 
 * 	cache(castExpr, translate(castExpr))
 */
public BooleanMatrix visit(IntToExprCast castExpr) {
	BooleanMatrix ret = lookup(castExpr);
	if (ret!=null) return ret;

	final Int child = castExpr.intExpr().accept(this);
	final BooleanFactory factory =  interpreter.factory();
	final IntSet ints = interpreter.ints();
	
	ret = factory.matrix(Dimensions.square(interpreter.universe().size(), 1));
	
	switch(castExpr.op()) {
	case INTCAST : 	
		for(IntIterator iter = ints.iterator(); iter.hasNext(); ) {
			int i = iter.next();
			int atomIndex = interpreter.interpret(i);
			ret.set(atomIndex, factory.or(ret.get(atomIndex), child.eq(factory.integer(i))));
		}
		ret.setDefCond(child.defCond());
		break;
	case BITSETCAST : 
		final List<BooleanValue> twosComplement = child.twosComplementBits();
		final int msb = twosComplement.size()-1;
		// handle all bits but the sign bit
		for(int i = 0; i < msb; i++) { 
			int pow2 = 1<<i;
			if (ints.contains(pow2)) { 
				ret.set(interpreter.interpret(pow2), twosComplement.get(i));
			}
		}
		// handle the sign bit
		if (ints.contains(-1<<msb)) {
			ret.set(interpreter.interpret(-1<<msb), twosComplement.get(msb));
		}
		break;
	default : 
		throw new IllegalArgumentException("Unknown cast operator: " + castExpr.op());
	}
	
	return cache(castExpr, ret);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:48,代码来源:FOL2BoolTranslator.java


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