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


Java Tuple.arity方法代码示例

本文整理汇总了Java中kodkod.instance.Tuple.arity方法的典型用法代码示例。如果您正苦于以下问题:Java Tuple.arity方法的具体用法?Java Tuple.arity怎么用?Java Tuple.arity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kodkod.instance.Tuple的用法示例。


在下文中一共展示了Tuple.arity方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseTuple

import kodkod.instance.Tuple; //导入方法依赖的package包/类
/** Parse tuple. */
private Tuple parseTuple(XMLNode tuple, int arity) throws Err {
	Tuple ans = null;
	try {
		for (XMLNode sub : tuple)
			if (sub.is("atom")) {
				Tuple x = factory.tuple(sub.getAttribute("label"));
				if (ans == null)
					ans = x;
				else
					ans = ans.product(x);
			}
		if (ans == null)
			throw new ErrorFatal("Expecting: <tuple> <atom label=\"..\"/> .. </tuple>");
		if (ans.arity() != arity)
			throw new ErrorFatal("Expecting: tuple of arity " + arity + " but got tuple of arity " + ans.arity());
		return ans;
	} catch (Throwable ex) {
		throw new ErrorFatal("Expecting: <tuple> <atom label=\"..\"/> .. </tuple>", ex);
	}
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:22,代码来源:A4SolutionReader.java

示例2: convert

import kodkod.instance.Tuple; //导入方法依赖的package包/类
private TupleSet convert(TupleFactory factory, Expr f) throws Err {
	TupleSet old = ((A4TupleSet) (partial.eval(f))).debugGetKodkodTupleset();
	TupleSet ans = factory.noneOf(old.arity());
	for (Tuple oldT : old) {
		Tuple newT = null;
		for (int i = 0; i < oldT.arity(); i++) {
			if (newT == null)
				newT = factory.tuple(oldT.atom(i));
			else
				newT = newT.product(factory.tuple(oldT.atom(i)));
		}
		ans.add(newT);
	}
	return ans;
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:16,代码来源:TranslateAlloyToKodkod.java

示例3: parseTuple

import kodkod.instance.Tuple; //导入方法依赖的package包/类
/** Parse tuple. */
private Tuple parseTuple(XMLNode tuple, int arity) throws Err {
    Tuple ans = null;
    try {
        for(XMLNode sub:tuple) if (sub.is("atom")) {
            Tuple x = factory.tuple(sub.getAttribute("label"));
            if (ans==null) ans=x; else ans=ans.product(x);
        }
        if (ans==null) throw new ErrorFatal("Expecting: <tuple> <atom label=\"..\"/> .. </tuple>");
        if (ans.arity()!=arity) throw new ErrorFatal("Expecting: tuple of arity "+arity+" but got tuple of arity "+ans.arity());
        return ans;
    } catch(Throwable ex) {
        throw new ErrorFatal("Expecting: <tuple> <atom label=\"..\"/> .. </tuple>", ex);
    }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:16,代码来源:A4SolutionReader.java

示例4: convert

import kodkod.instance.Tuple; //导入方法依赖的package包/类
private TupleSet convert(TupleFactory factory, Expr f) throws Err {
    TupleSet old = ((A4TupleSet) (partial.eval(f))).debugGetKodkodTupleset();
    TupleSet ans = factory.noneOf(old.arity());
    for(Tuple oldT: old) {
        Tuple newT = null;
        for(int i=0; i<oldT.arity(); i++) {
            if (newT==null) newT=factory.tuple(oldT.atom(i)); else newT=newT.product(factory.tuple(oldT.atom(i)));
        }
        ans.add(newT);
    }
    return ans;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:13,代码来源:TranslateAlloyToKodkod.java

示例5: join

import kodkod.instance.Tuple; //导入方法依赖的package包/类
public static TupleSet join(TupleSet ts1, TupleSet ts2, TupleFactory f) {
    int arity = ts1.arity() + ts2.arity() - 2;
    TupleSet result = f.noneOf(arity);
    for (Tuple t1 : ts1)
        for (Tuple t2 : ts2) 
            if (t1.atom(t1.arity() - 1) == t2.atom(0)) {
                Object[] atoms = new Object[arity]; 
                for (int i = 0; i < t1.arity() - 1; i++) atoms[i] = t1.atom(i);
                for (int i = 1; i < t2.arity(); i++) atoms[t1.arity() + i - 2] = t2.atom(i);
                result.add(f.tuple(atoms));
            }
    return result;
}
 
开发者ID:aleksandarmilicevic,项目名称:squander,代码行数:14,代码来源:TupleSetUtils.java


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