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


Java Quantifier类代码示例

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


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

示例1: translateQuantifier

import gov.nasa.jpf.constraints.expressions.Quantifier; //导入依赖的package包/类
public Expression<Boolean> translateQuantifier(Tree n) {
  Quantifier q;
  switch(n.getType()) {
  case EXISTS:
    q = Quantifier.EXISTS;
    break;
  case FORALL:
    q = Quantifier.FORALL;
    break;
  default:
    throw new UnexpectedTokenException(n, FORALL, EXISTS);
  }
  List<? extends Variable<?>> vars = translateTypedVarList(n.getChild(0));
  pushContext(vars);
  Expression<Boolean> body = translateBoolExpression(n.getChild(1));
  popContext();
  return new QuantifierExpression(q, vars, body);
}
 
开发者ID:psycopaths,项目名称:jconstraints,代码行数:19,代码来源:ASTTranslator.java

示例2: eliminationTest

import gov.nasa.jpf.constraints.expressions.Quantifier; //导入依赖的package包/类
@Test
public void eliminationTest() throws IOException {
  Properties conf = new Properties();     
  conf.setProperty("symbolic.dp", "z3");
  ConstraintSolverFactory factory = new ConstraintSolverFactory(conf);
  NativeZ3Solver solver = (NativeZ3Solver)factory.createSolver();        

  Variable x = new Variable(BuiltinTypes.INTEGER, "x");
  Variable a = new Variable(BuiltinTypes.INTEGER, "a");
  Variable b = new Variable(BuiltinTypes.INTEGER, "b");

  Constant zero = new Constant(BuiltinTypes.INTEGER, 0);

  //Expression expr = new NumericBooleanExpression(x, NumericComparator.EQ, x);

  Expression expr = new NumericBooleanExpression(
          x, 
          NumericComparator.EQ,
          new NumericCompound<>(a, NumericOperator.PLUS, b));                

  expr = ExpressionUtil.and(expr,
          new NumericBooleanExpression(a, NumericComparator.GT, zero),
          new NumericBooleanExpression(b, NumericComparator.GT, zero));

  List bound = new ArrayList<>();
  bound.add(a);
  bound.add(b);

  QuantifierExpression qe = new QuantifierExpression(Quantifier.EXISTS, bound, expr);
  System.out.println("gov.nasa.jpf.constraints.api.QuantifierEliminationTest.eliminationTest()");
  StringBuilder aa = new StringBuilder();
  qe.print(aa);
  System.out.println(aa.toString());
  assertNotNull(solver.eliminateQuantifiers(qe));
}
 
开发者ID:psycopaths,项目名称:jconstraints-z3,代码行数:36,代码来源:QuantifierEliminationTest.java

示例3: visit

import gov.nasa.jpf.constraints.expressions.Quantifier; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public Expression<?> visit(QuantifierExpression q, Boolean data) {
  Quantifier quant = q.getQuantifier();
  if(data)
    quant = quant.negate();
  return new QuantifierExpression(quant, q.getBoundVariables(), (Expression<Boolean>)visit(q.getBody(), data));
}
 
开发者ID:psycopaths,项目名称:jconstraints,代码行数:9,代码来源:ExpressionSimplificationVisitor.java

示例4: forall

import gov.nasa.jpf.constraints.expressions.Quantifier; //导入依赖的package包/类
public static QuantifierExpression forall(Expression<Boolean> expr, Variable<?>... vars) {
    return new QuantifierExpression(Quantifier.FORALL, Arrays.asList(vars), expr);
}
 
开发者ID:psycopaths,项目名称:jconstraints,代码行数:4,代码来源:PropertyBuilder.java


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