本文整理汇总了Java中edu.mit.csail.sdg.alloy4compiler.ast.Sig.PrimSig方法的典型用法代码示例。如果您正苦于以下问题:Java Sig.PrimSig方法的具体用法?Java Sig.PrimSig怎么用?Java Sig.PrimSig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.mit.csail.sdg.alloy4compiler.ast.Sig
的用法示例。
在下文中一共展示了Sig.PrimSig方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test2
import edu.mit.csail.sdg.alloy4compiler.ast.Sig; //导入方法依赖的package包/类
static void test2() throws Exception {
test1();
XMLNode xml = new XMLNode(new StringReader(
"<alloy builddate='unknown'>"
+ "<instance bitwidth='2' maxseq='1' command='Run Deadlock' filename='dijkstra.als'>"
+ "<sig label='univ' ID='0' builtin='yes'> <atom label='-2'/> <atom label='-1'/> <atom label='0'/> <atom label='1'/> <atom label='State$0'/> <atom label='State$1'/> <atom label='State$2'/> </sig>"
+ "<sig label='Int' ID='1' parentID='0' builtin='yes'> <atom label='-2'/> <atom label='-1'/> <atom label='0'/> <atom label='1'/> </sig>"
+ "<sig label='seq/Int' ID='2' parentID='1' builtin='yes'> <atom label='0'/> </sig>"
+ "<sig label='Act' ID='5' parentID='0'> <atom label='Act$0'/> <atom label='Act$1'/> <atom label='Act$2'/> </sig>"
+ "<skolem label='$x' ID='16'>"
+ " <tuple> <atom label='0'/> <atom label='Act$1'/> </tuple>"
+ " <types> <type ID='2'/> <type ID='5'/> </types>"
+ "</skolem>"
+ "</instance>"
+ "</alloy>"));
Sig activity = new Sig.PrimSig("Act");
A4Solution sol = A4SolutionReader.read(Arrays.asList(activity), xml);
SafeList<ExprVar> skolems = new SafeList<ExprVar>(sol.getAllSkolems());
check(skolems.size()==1);
check(skolems.get(0).label, "$x");
check(skolems.get(0).type(), Sig.SEQIDX.type().product(activity.type()));
}
示例2: test1
import edu.mit.csail.sdg.alloy4compiler.ast.Sig; //导入方法依赖的package包/类
static void test1() throws Exception {
XMLNode xml = new XMLNode(new StringReader(
"<alloy builddate='unknown'>"
+ "<instance bitwidth='2' maxseq='1' command='Run Deadlock' filename='dijkstra.als'>"
+ "<sig label='univ' ID='0' builtin='yes'> <atom label='-2'/> <atom label='-1'/> <atom label='0'/> <atom label='1'/> <atom label='State$0'/> <atom label='State$1'/> <atom label='State$2'/> </sig>"
+ "<sig label='Int' ID='1' parentID='0' builtin='yes'> <atom label='-2'/> <atom label='-1'/> <atom label='0'/> <atom label='1'/> </sig>"
+ "<sig label='seq/Int' ID='2' parentID='1' builtin='yes'> <atom label='0'/> </sig>"
+ "<sig label='State' ID='5' parentID='0'> <atom label='State$0'/> <atom label='State$1'/> <atom label='State$2'/> </sig>"
+ "<field label='len' parentID='5' ID='17'>"
+ " <tuple> <atom label='State$1'/> <atom label='-2'/> </tuple>"
+ " <tuple> <atom label='State$1'/> <atom label='-1'/> </tuple>"
+ " <types> <type ID='5'/> <type ID='1'/> </types>"
+ "</field>"
+ "<skolem label='$Deadlock_s' ID='16'>"
+ " <tuple> <atom label='State$0'/> </tuple>"
+ " <types> <type ID='5'/> </types>"
+ "</skolem>"
+ "</instance>"
+ "</alloy>"));
Sig state = new Sig.PrimSig("State");
A4Solution sol = A4SolutionReader.read(Arrays.asList(state), xml);
SafeList<ExprVar> skolems = new SafeList<ExprVar>(sol.getAllSkolems());
check(skolems.size()==1);
check(skolems.get(0).label, "$Deadlock_s");
check(skolems.get(0).type(), state.type());
//
Sig state2 = new Sig.PrimSig("State");
Field field2 = state2.addField("len", Sig.SIGINT);
sol = A4SolutionReader.read(Arrays.asList(state2), xml);
SafeList<ExprVar> skolems2 = new SafeList<ExprVar>(sol.getAllSkolems());
check(skolems2.size()==1);
check(skolems2.get(0).label, "$Deadlock_s");
check(skolems2.get(0).type(), state2.type());
check(""+sol.eval(field2.cardinality()), "-2");
}