本文整理汇总了Java中kodkod.ast.ConstantExpression类的典型用法代码示例。如果您正苦于以下问题:Java ConstantExpression类的具体用法?Java ConstantExpression怎么用?Java ConstantExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConstantExpression类属于kodkod.ast包,在下文中一共展示了ConstantExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: interpret
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/**
* Returns a {@link kodkod.engine.bool.BooleanMatrix matrix} m of
* {@link kodkod.engine.bool.BooleanValue boolean formulas} representing the
* specified constant expression.
*
* @return { m: BooleanMatrix | let dset = [0..this.universe.size()^c.arity)
* | m.dimensions.dimensions = [0..c.arity) ->one
* this.universe.size() && c = UNIV => m.elements[dset] = TRUE, c =
* NONE => m.elements[dset] = FALSE, c = IDEN => (all i: dset |
* (some j: int | i = j*(1+this.universe.size())) => m.elements[i] =
* TRUE, m.elements[i] = FALSE), c = INT => (all i: dset | (some j:
* int | this.interpret(j)=i) => m.elements[i] = TRUE, m.elements[i]
* = FALSE }
*/
public final BooleanMatrix interpret(ConstantExpression c) {
final int univSize = universe().size();
if (c == Expression.UNIV) {
final IntSet all = Ints.rangeSet(Ints.range(0, univSize - 1));
return factory().matrix(Dimensions.square(univSize, 1), all, all);
} else if (c == Expression.IDEN) {
final Dimensions dim2 = Dimensions.square(univSize, 2);
final IntSet iden = Ints.bestSet(dim2.capacity());
for (int i = 0; i < univSize; i++) {
iden.add(i * univSize + i);
}
return factory().matrix(dim2, iden, iden);
} else if (c == Expression.NONE) {
return factory().matrix(Dimensions.square(univSize, 1), Ints.EMPTY_SET, Ints.EMPTY_SET);
} else if (c == Expression.INTS) {
final IntSet ints = Ints.bestSet(univSize);
for (IntIterator iter = ints().iterator(); iter.hasNext();) {
ints.add(interpret(iter.next()));
}
return factory().matrix(Dimensions.square(univSize, 1), ints, ints);
} else {
throw new IllegalArgumentException("unknown constant expression: " + c);
}
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:39,代码来源:LeafInterpreter.java
示例2: visit
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/**
* Calls lookup(unaryExpr) 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(unaryExpr) | some t => t, let op =
* (unaryExpr.op).(TRANSPOSE->transpose + CLOSURE->closure +
* REFLEXIVE_CLOSURE->(lambda(m)(m.closure().or(iden))) |
* cache(unaryExpr, op(unaryExpr.child))
*/
public final BooleanMatrix visit(UnaryExpression unaryExpr) {
BooleanMatrix ret = lookup(unaryExpr);
if (ret != null)
return ret;
final BooleanMatrix child = unaryExpr.expression().accept(this);
final ExprOperator op = unaryExpr.op();
switch (op) {
case TRANSPOSE :
ret = child.transpose();
break;
case CLOSURE :
ret = child.closure();
break;
case REFLEXIVE_CLOSURE :
ret = child.closure().or(visit((ConstantExpression) Expression.IDEN));
break;
default :
throw new IllegalArgumentException("Unknown operator: " + op);
}
return cache(unaryExpr, ret);
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:34,代码来源:FOL2BoolTranslator.java
示例3: visit
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/** {@inheritDoc} */
public void visit(ConstantExpression x) {
if (map.containsKey(x))
return;
String newname = null;
if (x == Expression.NONE)
newname = "Expression.NONE";
else if (x == Expression.UNIV)
newname = "Expression.UNIV";
else if (x == Expression.IDEN)
newname = "Expression.IDEN";
else if (x == Expression.INTS)
newname = "Expression.INTS";
else
throw new RuntimeException("Unknown kodkod ConstantExpression \"" + x + "\" encountered");
map.put(x, newname);
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:18,代码来源:TranslateKodkodToJava.java
示例4: interpret
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/**
* Returns a {@link kodkod.engine.bool.BooleanMatrix matrix} m of
* {@link kodkod.engine.bool.BooleanValue boolean formulas} representing
* the specified constant expression.
* @return { m: BooleanMatrix | let dset = [0..this.universe.size()^c.arity) |
* m.dimensions.dimensions = [0..c.arity) ->one this.universe.size() &&
* c = UNIV => m.elements[dset] = TRUE, c = NONE => m.elements[dset] = FALSE,
* c = IDEN => (all i: dset | (some j: int | i = j*(1+this.universe.size())) => m.elements[i] = TRUE, m.elements[i] = FALSE),
* c = INT => (all i: dset | (some j: int | this.interpret(j)=i) => m.elements[i] = TRUE, m.elements[i] = FALSE }
*/
public final BooleanMatrix interpret(ConstantExpression c) {
final int univSize = universe().size();
if (c==Expression.UNIV) {
final IntSet all = Ints.rangeSet(Ints.range(0, univSize-1));
return factory().matrix(Dimensions.square(univSize, 1), all, all);
} else if (c==Expression.IDEN) {
final Dimensions dim2 = Dimensions.square(univSize, 2);
final IntSet iden = Ints.bestSet(dim2.capacity());
for(int i = 0; i < univSize; i++) {
iden.add(i*univSize + i);
}
return factory().matrix(dim2, iden, iden);
} else if (c==Expression.NONE) {
return factory().matrix(Dimensions.square(univSize, 1), Ints.EMPTY_SET, Ints.EMPTY_SET);
} else if (c==Expression.INTS) {
final IntSet ints = Ints.bestSet(univSize);
for(IntIterator iter = ints().iterator(); iter.hasNext(); ) {
ints.add(interpret(iter.next()));
}
return factory().matrix(Dimensions.square(univSize, 1), ints, ints);
} else {
throw new IllegalArgumentException("unknown constant expression: " + c);
}
}
开发者ID:ModelWriter,项目名称:Tarski,代码行数:35,代码来源:LeafInterpreter.java
示例5: visit
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/**
* Calls lookup(unaryExpr) 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(unaryExpr) | some t => t,
* let op = (unaryExpr.op).(TRANSPOSE->transpose + CLOSURE->closure + REFLEXIVE_CLOSURE->(lambda(m)(m.closure().or(iden))) |
* cache(unaryExpr, op(unaryExpr.child))
*/
public final BooleanMatrix visit(UnaryExpression unaryExpr) {
BooleanMatrix ret = lookup(unaryExpr);
if (ret!=null) return ret;
final BooleanMatrix child = unaryExpr.expression().accept(this);
final ExprOperator op = unaryExpr.op();
switch(op) {
case TRANSPOSE : ret = child.transpose(); break;
case CLOSURE : ret = child.closure(); break;
case REFLEXIVE_CLOSURE : ret = child.closure().or(visit((ConstantExpression)Expression.IDEN)); break;
default :
throw new IllegalArgumentException("Unknown operator: " + op);
}
return cache(unaryExpr,ret);
}
开发者ID:ModelWriter,项目名称:Tarski,代码行数:25,代码来源:FOL2BoolTranslator.java
示例6: visit
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/** {@inheritDoc} */
public void visit(ConstantExpression x) {
if (map.containsKey(x)) return;
String newname=null;
if (x==Expression.NONE) newname="Expression.NONE";
else if (x==Expression.UNIV) newname="Expression.UNIV";
else if (x==Expression.IDEN) newname="Expression.IDEN";
else if (x==Expression.INTS) newname="Expression.INTS";
else throw new RuntimeException("Unknown kodkod ConstantExpression \""+x+"\" encountered");
map.put(x,newname);
}
开发者ID:ModelWriter,项目名称:Tarski,代码行数:12,代码来源:TranslateKodkodToJava.java
示例7: visit
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
@Override
public E visit(ConstantExpression constExpr) {
start(constExpr);
return end(constExpr, visitor.visit(constExpr));
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:6,代码来源:AspectReturnVisitor.java
示例8: visit
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
@Override
public Expression visit(ConstantExpression constExpr) {
return constExpr;
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:5,代码来源:HOLTranslator.java
示例9: visit
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/** @ensures this.tokens' = concat[ this.tokens, node ] */
public void visit(ConstantExpression node) {
append(node);
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:5,代码来源:PrettyPrinter.java
示例10: visit
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
public Boolean visit(ConstantExpression constExpr) {
return noHOL(constExpr);
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:4,代码来源:AnnotatedNode.java
示例11: visit
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/**
* Returns Collections.EMPTY_SET
* @return Collections.EMPTY_SET
*/
@SuppressWarnings("unchecked")
public Set<T> visit(ConstantExpression constExpr) {
return Collections.EMPTY_SET;
}
开发者ID:ModelWriter,项目名称:Tarski,代码行数:9,代码来源:AbstractCollector.java
示例12: visit
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/** @ensures this.tokens' = concat[ this.tokens, node ] */
public void visit(ConstantExpression node) { append(node); }
开发者ID:ModelWriter,项目名称:Tarski,代码行数:3,代码来源:PrettyPrinter.java
示例13: visitIdent
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
@Override
public Expression visitIdent() {
return ConstantExpression.IDEN;
}
开发者ID:aleksandarmilicevic,项目名称:squander,代码行数:5,代码来源:ConstRel2KKConst.java
示例14: visitUniv
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
@Override
public Expression visitUniv() {
return ConstantExpression.UNIV;
}
开发者ID:aleksandarmilicevic,项目名称:squander,代码行数:5,代码来源:ConstRel2KKConst.java
示例15: visitNone
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
@Override
public Expression visitNone() {
return ConstantExpression.NONE;
}
开发者ID:aleksandarmilicevic,项目名称:squander,代码行数:5,代码来源:ConstRel2KKConst.java
示例16: visit
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/** @effects this.tokens' = concat[ this.tokens, node ] */
public void visit(ConstantExpression node) { append(node); }
开发者ID:wala,项目名称:MemSAT,代码行数:3,代码来源:PrettyPrinter.java
示例17: visit
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/**
* Visits the given constant expression.
**/
public void visit(ConstantExpression constExpr);
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:5,代码来源:VoidVisitor.java
示例18: visit
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/**
* Calls lookup(constExpr) and returns the cached value, if any. If a
* replacement has not been cached, the constExpr is cached and returned.
*
* @return constExpr
*/
public Expression visit(ConstantExpression constExpr) {
final Expression ret = lookup(constExpr);
return ret == null ? cache(constExpr, constExpr) : constExpr;
}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:11,代码来源:AbstractReplacer.java
示例19: visit
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/**
* Does nothing.
*/
public void visit(ConstantExpression constExpr) {}
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:5,代码来源:AbstractVoidVisitor.java
示例20: visit
import kodkod.ast.ConstantExpression; //导入依赖的package包/类
/**
* Visits the given constant expression and returns the result.
*
* @return the result of visiting <code>constExpr</code>
**/
public E visit(ConstantExpression constExpr);
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:7,代码来源:ReturnVisitor.java
注:本文中的kodkod.ast.ConstantExpression类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论