本文整理汇总了Java中edu.mit.csail.sdg.alloy4compiler.ast.Sig.SEQIDX属性的典型用法代码示例。如果您正苦于以下问题:Java Sig.SEQIDX属性的具体用法?Java Sig.SEQIDX怎么用?Java Sig.SEQIDX使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类edu.mit.csail.sdg.alloy4compiler.ast.Sig
的用法示例。
在下文中一共展示了Sig.SEQIDX属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sigMETA
/** Returns the AlloyType corresponding to the given sig; create an AlloyType for it if none existed before. */
private AlloyType sigMETA(PrimSig s) throws Err {
if (s==Sig.NONE) throw new ErrorFatal("Unexpected sig \"none\" encountered.");
AlloyType type = sig2type.get(s);
if (type != null) return type;
if (s==Sig.UNIV) type=AlloyType.UNIV;
else if (s==Sig.SIGINT) type=AlloyType.INT;
else if (s==Sig.SEQIDX) type=AlloyType.SEQINT;
else if (s==Sig.STRING) type=AlloyType.STRING;
else type = makeType(s.label, s.isOne!=null, s.isAbstract!=null, false, s.isPrivate!=null, s.isMeta!=null, s.isEnum!=null);
sig2type.put(s, type);
AlloyAtom atom = new AlloyAtom(type, (type==AlloyType.SEQINT ? Integer.MIN_VALUE : Integer.MAX_VALUE), s.label);
atom2sets.put(atom, new LinkedHashSet<AlloySet>());
sig2atom.put(s, atom);
if (s.parent!=Sig.UNIV && s.parent!=null)
ts.put(type, sigMETA(s.parent));
if (s.parent!=null)
exts.add(new AlloyTuple(atom, sig2atom.get(s.parent)));
Iterable<PrimSig> children = (s==Sig.UNIV ? toplevels : s.children());
for(PrimSig sub:children) sigMETA(sub);
return type;
}
示例2: VizTree
/** Constructs a tree to display the given instance. */
public VizTree(A4Solution instance, String title, int fontSize) {
super(fontSize);
this.instance = instance;
this.title = title;
this.onWindows = Util.onWindows();
ArrayList<Object> toplevel = new ArrayList<Object>();
for(Sig s: instance.getAllReachableSigs()) if (s!=Sig.UNIV && s!=Sig.SEQIDX && s!=Sig.NONE) toplevel.add(s);
for(ExprVar v: instance.getAllSkolems()) if (v.type().arity()==1 && v.label.startsWith("$")) toplevel.add(v);
Collections.sort(toplevel, new Comparator<Object>() {
public int compare(Object a, Object b) {
String t1, t2;
if (a instanceof Sig) { t1=((Sig)a).label; if (b instanceof ExprVar) return -1; else t2=((Sig)b).label; }
else { t1=((ExprVar)a).label; if (b instanceof Sig) return 1; else t2=((ExprVar)b).label; }
return Util.slashComparator.compare(t1, t2);
}
});
this.toplevel = Collections.unmodifiableList(toplevel);
do_start();
}
示例3: writesig
/** Write the given Sig. */
private A4TupleSet writesig(final Sig x) throws Err {
A4TupleSet ts = null, ts2 = null;
if (x==Sig.NONE) return null; // should not happen, but we test for it anyway
if (sol==null && x.isMeta!=null) return null; // When writing the metamodel, skip the metamodel sigs!
if (x instanceof PrimSig) for(final PrimSig sub:children((PrimSig)x)) {
A4TupleSet ts3 = writesig(sub);
if (ts2==null) ts2 = ts3; else ts2 = ts2.plus(ts3);
}
if (rep!=null) rep.write(x);
Util.encodeXMLs(out, "\n<sig label=\"", x.label, "\" ID=\"", map(x));
if (x instanceof PrimSig && x!=Sig.UNIV) Util.encodeXMLs(out, "\" parentID=\"", map(((PrimSig)x).parent));
if (x.builtin) out.print("\" builtin=\"yes");
if (x.isAbstract!=null) out.print("\" abstract=\"yes");
if (x.isOne!=null) out.print("\" one=\"yes");
if (x.isLone!=null) out.print("\" lone=\"yes");
if (x.isSome!=null) out.print("\" some=\"yes");
if (x.isPrivate!=null) out.print("\" private=\"yes");
if (x.isMeta!=null) out.print("\" meta=\"yes");
if (x instanceof SubsetSig && ((SubsetSig)x).exact) out.print("\" exact=\"yes");
if (x.isEnum!=null) out.print("\" enum=\"yes");
out.print("\">\n");
try {
if (sol!=null && x!=Sig.UNIV && x!=Sig.SIGINT && x!=Sig.SEQIDX) {
ts = (A4TupleSet)(sol.eval(x));
for(A4Tuple t: ts.minus(ts2)) Util.encodeXMLs(out, " <atom label=\"", t.atom(0), "\"/>\n");
}
} catch(Throwable ex) {
throw new ErrorFatal("Error evaluating sig " + x.label, ex);
}
if (x instanceof SubsetSig) for(Sig p:((SubsetSig)x).parents) Util.encodeXMLs(out, " <type ID=\"", map(p), "\"/>\n");
out.print("</sig>\n");
for(Field field: x.getFields()) writeField(field);
return ts;
}