本文整理汇总了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;
}
示例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
}
}
示例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;
}
示例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
}
}
示例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;
}
示例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;
}