当前位置: 首页>>代码示例>>Java>>正文


Java Expression.arity方法代码示例

本文整理汇总了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));
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:21,代码来源:A4Solution.java

示例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);
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:20,代码来源:A4Solution.java

示例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;
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:20,代码来源:A4Solution.java

示例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));
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:13,代码来源:A4Solution.java

示例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);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:11,代码来源:A4Solution.java

示例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;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:14,代码来源:A4Solution.java


注:本文中的kodkod.ast.Expression.arity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。