當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。