當前位置: 首頁>>代碼示例>>Java>>正文


Java TempList.addAll方法代碼示例

本文整理匯總了Java中edu.mit.csail.sdg.alloy4.ConstList.TempList.addAll方法的典型用法代碼示例。如果您正苦於以下問題:Java TempList.addAll方法的具體用法?Java TempList.addAll怎麽用?Java TempList.addAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在edu.mit.csail.sdg.alloy4.ConstList.TempList的用法示例。


在下文中一共展示了TempList.addAll方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: override

import edu.mit.csail.sdg.alloy4.ConstList.TempList; //導入方法依賴的package包/類
/**
 * Return the relational override of this and that; (if this tupleset and
 * that tupleset does not have compatible arity, then we return this
 * tupleset as is). <br/>
 * Note: in general, the tuples may be ordered arbitrarily in the result.
 */
public SimTupleset override(SimTupleset that) throws ErrorAPI {
	if (arity() == 1)
		return union(that);
	if (this.empty() || this == that)
		return that;
	if (that.empty() || this.arity() != that.arity())
		return this;
	if (that.longsize() == 1)
		return override(that.getTuple()); // very common case, so let's
											// optimize it
	TempList<SimTuple> ans = new TempList<SimTuple>(size());
	for (SimTuple x : this)
		if (!that.has(x))
			ans.add(x);
	ans.addAll(that);
	return new SimTupleset(ans.makeConst());
}
 
開發者ID:AlloyTools,項目名稱:org.alloytools.alloy,代碼行數:24,代碼來源:SimTupleset.java

示例2: closure

import edu.mit.csail.sdg.alloy4.ConstList.TempList; //導入方法依賴的package包/類
/** Returns the closure of this tupleset (NOTE: if this.arity!=2, we will return an empty set) */
public SimTupleset closure() {
   if (arity()!=2) return EMPTY;
   TempList<SimTuple> ar = new TempList<SimTuple>(size());
   ar.addAll(this);
   while(true) {
      int n = ar.size();
      for(int i=0; i<n; i++) {
         SimTuple left = ar.get(i);
         if (left.head()==left.tail()) continue;      // whatever "right" is, "left.right" won't add any new tuple to the final answer
         for(int j=0; j<n; j++) if (i!=j) {           // whatever "left" is,  "left.left"  won't add any new tuple to the final answer
            SimTuple right = ar.get(j);
            if (right.head()==right.tail()) continue; // whatever "left" is,  "left.right" won't add any new tuple to the final answer
            if (left.tail()==right.head() && find(ar, left.head(), right.tail())<0) ar.add(SimTuple.make(left.head(), right.tail()));
         }
      }
      if (n == ar.size()) return ar.size()==longsize() ? this : new SimTupleset(ar.makeConst()); // if we went through the loop without making any change, we're done
   }
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:20,代碼來源:SimTupleset.java

示例3: closure

import edu.mit.csail.sdg.alloy4.ConstList.TempList; //導入方法依賴的package包/類
/**
 * Returns the closure of this tupleset (NOTE: if this.arity!=2, we will
 * return an empty set)
 */
public SimTupleset closure() {
	if (arity() != 2)
		return EMPTY;
	TempList<SimTuple> ar = new TempList<SimTuple>(size());
	ar.addAll(this);
	while (true) {
		int n = ar.size();
		for (int i = 0; i < n; i++) {
			SimTuple left = ar.get(i);
			if (left.head() == left.tail())
				continue; // whatever "right" is, "left.right" won't add any
							// new tuple to the final answer
			for (int j = 0; j < n; j++)
				if (i != j) { // whatever "left" is, "left.left" won't add
								// any new tuple to the final answer
					SimTuple right = ar.get(j);
					if (right.head() == right.tail())
						continue; // whatever "left" is, "left.right" won't
									// add any new tuple to the final answer
					if (left.tail() == right.head() && find(ar, left.head(), right.tail()) < 0)
						ar.add(SimTuple.make(left.head(), right.tail()));
				}
		}
		if (n == ar.size())
			return ar.size() == longsize() ? this : new SimTupleset(ar.makeConst()); // if
																						// we
																						// went
																						// through
																						// the
																						// loop
																						// without
																						// making
																						// any
																						// change,
																						// we're
																						// done
	}
}
 
開發者ID:AlloyTools,項目名稱:org.alloytools.alloy,代碼行數:43,代碼來源:SimTupleset.java

示例4: getAllReachableSigs

import edu.mit.csail.sdg.alloy4.ConstList.TempList; //導入方法依賴的package包/類
/**
 * Return the list containing UNIV, SIGINT, SEQIDX, STRING, NONE, and all
 * sigs defined in this module or a reachable submodule.
 */
public ConstList<Sig> getAllReachableSigs() {
	TempList<Sig> x = new TempList<Sig>();
	x.add(UNIV);
	x.add(SIGINT);
	x.add(SEQIDX);
	x.add(STRING);
	x.add(NONE);
	x.addAll(getAllReachableUserDefinedSigs());
	return x.makeConst();
}
 
開發者ID:AlloyTools,項目名稱:org.alloytools.alloy,代碼行數:15,代碼來源:CompModule.java

示例5: getAllReachableUserDefinedSigs

import edu.mit.csail.sdg.alloy4.ConstList.TempList; //導入方法依賴的package包/類
/**
 * Return the list containing all sigs defined in this module or a reachable
 * submodule.
 */
public ConstList<Sig> getAllReachableUserDefinedSigs() {
	TempList<Sig> x = new TempList<Sig>();
	for (CompModule m : getAllReachableModules())
		x.addAll(m.sigs.values());
	return x.makeConst();
}
 
開發者ID:AlloyTools,項目名稱:org.alloytools.alloy,代碼行數:11,代碼來源:CompModule.java

示例6: override

import edu.mit.csail.sdg.alloy4.ConstList.TempList; //導入方法依賴的package包/類
/** Return the relational override of this and that; (if this tupleset and that tupleset does not have compatible arity, then we return this tupleset as is).
 * <br/> Note: in general, the tuples may be ordered arbitrarily in the result.
 */
public SimTupleset override(SimTupleset that) throws ErrorAPI {
   if (arity()==1) return union(that);
   if (this.empty() || this==that) return that;
   if (that.empty() || this.arity()!=that.arity()) return this;
   if (that.longsize()==1) return override(that.getTuple()); // very common case, so let's optimize it
   TempList<SimTuple> ans = new TempList<SimTuple>(size());
   for(SimTuple x: this) if (!that.has(x)) ans.add(x);
   ans.addAll(that);
   return new SimTupleset(ans.makeConst());
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:14,代碼來源:SimTupleset.java

示例7: getAllReachableSigs

import edu.mit.csail.sdg.alloy4.ConstList.TempList; //導入方法依賴的package包/類
/** Return the list containing UNIV, SIGINT, SEQIDX, STRING, NONE, and all sigs defined in this module or a reachable submodule. */
public ConstList<Sig> getAllReachableSigs() {
   TempList<Sig> x = new TempList<Sig>();
   x.add(UNIV);
   x.add(SIGINT);
   x.add(SEQIDX);
   x.add(STRING);
   x.add(NONE);
   for(CompModule m:getAllReachableModules()) x.addAll(m.sigs.values());
   return x.makeConst();
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:12,代碼來源:CompModule.java


注:本文中的edu.mit.csail.sdg.alloy4.ConstList.TempList.addAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。