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


Java Expression.some方法代码示例

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


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

示例1: testFelix_03062008_2

import kodkod.ast.Expression; //导入方法依赖的package包/类
public final void testFelix_03062008_2() {
	Relation x5 = Relation.unary("Role");
	Relation x6 = Relation.unary("Session");

	List<String> atomlist = Arrays.asList("Role$0", "Session$0", "Session$1");

	Universe universe = new Universe(atomlist);
	TupleFactory factory = universe.factory();
	Bounds bounds = new Bounds(universe);

	TupleSet x5_upper = factory.noneOf(1);
	x5_upper.add(factory.tuple("Role$0"));
	bounds.bound(x5, x5_upper);

	TupleSet x6_upper = factory.noneOf(1);
	x6_upper.add(factory.tuple("Session$0"));
	x6_upper.add(factory.tuple("Session$1"));
	bounds.bound(x6, x6_upper);

	Variable x11 = Variable.unary("x_a");
	Decls x10 = x11.oneOf(x6);
	Variable x15 = Variable.unary("x_b");
	Decls x14 = x15.oneOf(x5);
	Variable x17 = Variable.unary("x_c");
	Decls x16 = x17.oneOf(x5);
	Decls x13 = x14.and(x16);
	Expression x20 = x15.product(x17);
	Expression x19 = x11.product(x20);
	Formula x18 = x19.some();
	Formula x12 = x18.forSome(x13);
	Formula x9 = x12.forAll(x10);
	Formula x24 = x5.some();
	Formula x23 = x24.not();
	Formula x28 = x5.eq(x5);
	Formula x29 = x6.eq(x6);
	Formula x25 = x28.and(x29);
	Formula x22 = x23.and(x25);
	Formula x8 = x9.and(x22).and(x5.no()).and(x6.no());

	Solver solver = new Solver();
	solver.options().setSolver(SATFactory.DefaultSAT4J);
	solver.options().setBitwidth(2);
	// solver.options().setFlatten(false);
	solver.options().setIntEncoding(Options.IntEncoding.TWOSCOMPLEMENT);
	solver.options().setSymmetryBreaking(20);
	solver.options().setSkolemDepth(2);

	System.out.flush();

	Solution sol = solver.solve(x8, bounds);
	Instance inst = sol.instance();
	assertNotNull(inst);

	for (Relation rel : inst.relations()) {
		if (rel != x5 && rel != x6) {
			final TupleSet range = inst.tuples(x6).product(inst.tuples(x5));
			assertTrue(range.containsAll(inst.tuples(rel)));
		}
	}
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:61,代码来源:BugTests.java


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