本文整理汇总了Java中edu.mit.csail.sdg.alloy4compiler.ast.Sig.NONE属性的典型用法代码示例。如果您正苦于以下问题:Java Sig.NONE属性的具体用法?Java Sig.NONE怎么用?Java Sig.NONE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类edu.mit.csail.sdg.alloy4compiler.ast.Sig
的用法示例。
在下文中一共展示了Sig.NONE属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: sig
/** Returns the AlloyType corresponding to the given sig; create an AlloyType for it if none existed before. */
private AlloyType sig(PrimSig s) throws Err {
if (s==Sig.NONE) throw new ErrorFatal("Unexpected sig \"none\" encountered.");
AlloyType ans = sig2type.get(s);
if (ans == null) {
ans = makeType(s.label, s.isOne!=null, s.isAbstract!=null, false, s.isPrivate!=null, s.isMeta!=null, s.isEnum!=null);
sig2type.put(s, ans);
if (s.parent!=Sig.UNIV) ts.put(ans, sig(s.parent));
}
return ans;
}
示例4: atoms
/** Constructs the atoms corresponding to the given sig. */
private void atoms(A4Solution sol, PrimSig s) throws Err {
Expr sum=Sig.NONE;
for(PrimSig c:s.children()) { sum=sum.plus(c); atoms(sol, c); }
A4TupleSet ts = (A4TupleSet) (sol.eval(s.minus(sum))); // This ensures that atoms will be associated with the most specific sig
for(A4Tuple z: ts) {
String atom = z.atom(0);
int i, dollar = atom.lastIndexOf('$');
try { i = Integer.parseInt(dollar>=0 ? atom.substring(dollar+1) : atom); } catch(NumberFormatException ex) { i = Integer.MAX_VALUE; }
AlloyAtom at = new AlloyAtom(sig(s), ts.size()==1 ? Integer.MAX_VALUE : i, atom);
atom2sets.put(at, new LinkedHashSet<AlloySet>());
string2atom.put(atom, at);
}
}
示例5: sim
/** If ex is a simple combination of Relations, then return that combination, else return null. */
private Expression sim(Expr ex) {
while(ex instanceof ExprUnary) {
ExprUnary u = (ExprUnary)ex;
if (u.op!=ExprUnary.Op.NOOP && u.op!=ExprUnary.Op.EXACTLYOF) break;
ex = u.sub;
}
if (ex instanceof ExprBinary) {
ExprBinary b = (ExprBinary)ex;
if (b.op==ExprBinary.Op.ARROW || b.op==ExprBinary.Op.PLUS || b.op==ExprBinary.Op.JOIN) {
Expression left = sim(b.left); if (left==null) return null;
Expression right = sim(b.right); if (right==null) return null;
if (b.op==ExprBinary.Op.ARROW) return left.product(right);
if (b.op==ExprBinary.Op.PLUS) return left.union(right); else return left.join(right);
}
}
if (ex instanceof ExprConstant) {
switch(((ExprConstant)ex).op) {
case EMPTYNESS: return Expression.NONE;
}
}
if (ex==Sig.NONE) return Expression.NONE;
if (ex==Sig.SIGINT) return Expression.INTS;
if (ex instanceof Sig) return sol.a2k((Sig)ex);
if (ex instanceof Field) return sol.a2k((Field)ex);
return null;
}
示例6: 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;
}
示例7: children
/** Helper method that returns the list of direct subsignatures. */
private Iterable<PrimSig> children(PrimSig x) throws Err {
if (x==Sig.NONE) return new ArrayList<PrimSig>();
if (x!=Sig.UNIV) return x.children(); else return toplevels;
}