本文整理汇总了Java中edu.mit.csail.sdg.alloy4compiler.ast.Sig.isTopLevel方法的典型用法代码示例。如果您正苦于以下问题:Java Sig.isTopLevel方法的具体用法?Java Sig.isTopLevel怎么用?Java Sig.isTopLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.mit.csail.sdg.alloy4compiler.ast.Sig
的用法示例。
在下文中一共展示了Sig.isTopLevel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addSig
import edu.mit.csail.sdg.alloy4compiler.ast.Sig; //导入方法依赖的package包/类
/** Add a new sig to this solution and associate it with the given expression (and if s.isTopLevel then add this expression into Sig.UNIV).
* <br> The expression must contain only constant Relations or Relations that are already bound in this solution.
* <br> (If the sig was already added by a previous call to addSig(), then this call will return immediately without altering what it is associated with)
*/
void addSig(Sig s, Expression expr) throws ErrorFatal {
if (solved) throw new ErrorFatal("Cannot add an additional sig since solve() has completed.");
if (expr.arity()!=1) throw new ErrorFatal("Sig "+s+" must be associated with a unary relational value.");
if (a2k.containsKey(s)) return;
a2k.put(s, expr);
sigs.add(s);
if (s.isTopLevel()) a2k.put(UNIV, a2k.get(UNIV).union(expr));
}
示例2: derive_overall_scope
import edu.mit.csail.sdg.alloy4compiler.ast.Sig; //导入方法依赖的package包/类
/** If A is toplevel, and we haven't been able to derive its scope yet, then let it get the "overall" scope. */
private boolean derive_overall_scope (Iterable<Sig> sigs) throws Err {
boolean changed=false;
final int overall = (cmd.overall<0 && cmd.scope.size()==0) ? 3 : cmd.overall;
for(Sig s:sigs) if (!s.builtin && s.isTopLevel() && sig2scope(s)<0) {
if (s.isEnum!=null) { sig2scope(s, 0); continue; } // enum without children should get the empty set
if (overall<0) throw new ErrorSyntax(cmd.pos, "You must specify a scope for sig \""+s+"\"");
sig2scope(s, overall);
changed=true;
}
return changed;
}
示例3: derive_scope_from_parent
import edu.mit.csail.sdg.alloy4compiler.ast.Sig; //导入方法依赖的package包/类
/** If A is not toplevel, and we haven't been able to derive its scope yet, then give it its parent's scope. */
private boolean derive_scope_from_parent (Iterable<Sig> sigs) throws Err {
boolean changed=false;
Sig trouble=null;
for(Sig s:sigs) if (!s.builtin && !s.isTopLevel() && sig2scope(s)<0 && (s instanceof PrimSig)) {
PrimSig p = ((PrimSig)s).parent;
int pb = sig2scope(p);
if (pb>=0) {sig2scope(s,pb); changed=true;} else {trouble=s;}
}
if (changed) return true;
if (trouble==null) return false;
throw new ErrorSyntax(cmd.pos,"You must specify a scope for sig \""+trouble+"\"");
}