本文整理汇总了Java中kodkod.ast.Expression.arity方法的典型用法代码示例。如果您正苦于以下问题:Java Expression.arity方法的具体用法?Java Expression.arity怎么用?Java Expression.arity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kodkod.ast.Expression
的用法示例。
在下文中一共展示了Expression.arity方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addSig
import kodkod.ast.Expression; //导入方法依赖的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: addField
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Add a new field to this solution and associate it with the given
* expression. <br>
* The expression must contain only constant Relations or Relations that are
* already bound in this solution. <br>
* (If the field was already added by a previous call to addField(), then
* this call will return immediately without altering what it is associated
* with)
*/
void addField(Field f, Expression expr) throws ErrorFatal {
if (solved)
throw new ErrorFatal("Cannot add an additional field since solve() has completed.");
if (expr.arity() != f.type().arity())
throw new ErrorFatal(
"Field " + f + " must be associated with an " + f.type().arity() + "-ary relational value.");
if (a2k.containsKey(f))
return;
a2k.put(f, expr);
}
示例3: addSkolem
import kodkod.ast.Expression; //导入方法依赖的package包/类
/**
* Add a new skolem to this solution and associate it with the given
* expression. <br>
* The expression must contain only constant Relations or Relations that are
* already bound in this solution.
*/
private ExprVar addSkolem(String label, Type type, Expression expr) throws Err {
if (solved)
throw new ErrorFatal("Cannot add an additional skolem since solve() has completed.");
int a = type.arity();
if (a < 1)
throw new ErrorFatal("Skolem " + label + " must be associated with a relational value.");
if (a != expr.arity())
throw new ErrorFatal("Skolem " + label + " must be associated with an " + a + "-ary relational value.");
ExprVar v = ExprVar.make(Pos.UNKNOWN, label, type);
a2k.put(v, expr);
skolems.add(v);
return v;
}
示例4: addSig
import kodkod.ast.Expression; //导入方法依赖的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));
}
示例5: addField
import kodkod.ast.Expression; //导入方法依赖的package包/类
/** Add a new field to this solution and associate it with the given expression.
* <br> The expression must contain only constant Relations or Relations that are already bound in this solution.
* <br> (If the field was already added by a previous call to addField(), then this call will return immediately without altering what it is associated with)
*/
void addField(Field f, Expression expr) throws ErrorFatal {
if (solved) throw new ErrorFatal("Cannot add an additional field since solve() has completed.");
if (expr.arity()!=f.type().arity()) throw new ErrorFatal("Field "+f+" must be associated with an "+f.type().arity()+"-ary relational value.");
if (a2k.containsKey(f)) return;
a2k.put(f, expr);
}
示例6: addSkolem
import kodkod.ast.Expression; //导入方法依赖的package包/类
/** Add a new skolem to this solution and associate it with the given expression.
* <br> The expression must contain only constant Relations or Relations that are already bound in this solution.
*/
private ExprVar addSkolem(String label, Type type, Expression expr) throws Err {
if (solved) throw new ErrorFatal("Cannot add an additional skolem since solve() has completed.");
int a = type.arity();
if (a<1) throw new ErrorFatal("Skolem "+label+" must be associated with a relational value.");
if (a!=expr.arity()) throw new ErrorFatal("Skolem "+label+" must be associated with an "+a+"-ary relational value.");
ExprVar v = ExprVar.make(Pos.UNKNOWN, label, type);
a2k.put(v, expr);
skolems.add(v);
return v;
}