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


Java TempList.get方法代碼示例

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


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

示例1: add

import edu.mit.csail.sdg.alloy4.ConstList.TempList; //導入方法依賴的package包/類
/**
 * Merge "x" into the set of entries, then return the new arity bitmask.
 * <br>
 * Precondition: entries and arities are consistent
 */
private static int add(TempList<ProductType> entries, int arities, ProductType x) {
	if (x == null || x.types.length == 0)
		return arities;
	final int arity = x.types.length;
	// If x is subsumed by a ProductType in this, return. Likewise, remove
	// all entries in this that are subsumed by x.
	for (int n = entries.size(), i = n - 1; i >= 0; i--) {
		ProductType y = entries.get(i);
		if (y.types.length != arity)
			continue;
		if (x.isSubtypeOf(y))
			return arities;
		if (y.isSubtypeOf(x)) {
			n--;
			entries.set(i, entries.get(n)).remove(n);
		}
	}
	if (arity > 30)
		arities = arities | 1;
	else
		arities = arities | (1 << arity);
	entries.add(x);
	return arities;
}
 
開發者ID:AlloyTools,項目名稱:org.alloytools.alloy,代碼行數:30,代碼來源:Type.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: find

import edu.mit.csail.sdg.alloy4.ConstList.TempList; //導入方法依賴的package包/類
/**
 * Returns the index position if the list of tuples contains the tuple (a,b)
 * (or return -1 if not found).
 */
private static int find(TempList<SimTuple> tuples, SimAtom a, SimAtom b) {
	if (tuples.size() == 0 || tuples.get(0).arity() != 2)
		return -1;
	for (int i = tuples.size() - 1; i >= 0; i--) {
		SimTuple x = tuples.get(i);
		if (x.head() == a && x.tail() == b)
			return i;
	}
	return -1;
}
 
開發者ID:AlloyTools,項目名稱:org.alloytools.alloy,代碼行數:15,代碼來源:SimTupleset.java

示例4: 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

示例5: find

import edu.mit.csail.sdg.alloy4.ConstList.TempList; //導入方法依賴的package包/類
/** Returns the index position if the list of tuples contains the tuple (a,b) (or return -1 if not found). */
private static int find(TempList<SimTuple> tuples, SimAtom a, SimAtom b) {
   if (tuples.size() == 0 || tuples.get(0).arity() != 2) return -1;
   for(int i=tuples.size()-1; i >= 0; i--) {
      SimTuple x = tuples.get(i);
      if (x.head()==a && x.tail()==b) return i;
   }
   return -1;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:10,代碼來源:SimTupleset.java

示例6: add

import edu.mit.csail.sdg.alloy4.ConstList.TempList; //導入方法依賴的package包/類
/** Merge "x" into the set of entries, then return the new arity bitmask.
 * <br> Precondition: entries and arities are consistent
 */
private static int add(TempList<ProductType> entries, int arities, ProductType x) {
    if (x==null || x.types.length==0) return arities;
    final int arity=x.types.length;
    // If x is subsumed by a ProductType in this, return. Likewise, remove all entries in this that are subsumed by x.
    for(int n=entries.size(), i=n-1; i>=0; i--) {
        ProductType y=entries.get(i);
        if (y.types.length != arity) continue;
        if (x.isSubtypeOf(y)) return arities;
        if (y.isSubtypeOf(x)) { n--; entries.set(i, entries.get(n)).remove(n); }
    }
    if (arity>30) arities = arities | 1; else arities = arities | (1 << arity);
    entries.add(x);
    return arities;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:18,代碼來源:Type.java


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