本文整理汇总了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");
}
}
示例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);
}
示例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");
}
}
示例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);
}
示例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);
}
示例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);
}