本文整理匯總了Java中gnu.trove.list.array.TIntArrayList.size方法的典型用法代碼示例。如果您正苦於以下問題:Java TIntArrayList.size方法的具體用法?Java TIntArrayList.size怎麽用?Java TIntArrayList.size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gnu.trove.list.array.TIntArrayList
的用法示例。
在下文中一共展示了TIntArrayList.size方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getEdgeObjects
import gnu.trove.list.array.TIntArrayList; //導入方法依賴的package包/類
@Override
public List<E> getEdgeObjects(int v1, int v2) {
checkVertex(v1);
checkVertex(v2);
List<E> edgeObjects = new ArrayList<>(1);
TIntArrayList[] adjacencyList = getAdjacencyList();
TIntArrayList adjacentEdges = adjacencyList[v1];
for (int i = 0; i < adjacentEdges.size(); i++) {
int e = adjacentEdges.getQuick(i);
Edge<E> edge = edges.get(e);
if ((edge.getV1() == v1 && edge.getV2() == v2)
|| (edge.getV1() == v2 && edge.getV2() == v1)) {
edgeObjects.add(edge.getObject());
}
}
return edgeObjects;
}
示例2: traverse
import gnu.trove.list.array.TIntArrayList; //導入方法依賴的package包/類
@Override
public void traverse(int v, Traverser<E> traverser, boolean[] encountered) {
checkVertex(v);
TIntArrayList[] adjacencyList = getAdjacencyList();
TIntArrayList adjacentEdges = adjacencyList[v];
encountered[v] = true;
for (int i = 0; i < adjacentEdges.size(); i++) {
int e = adjacentEdges.getQuick(i);
Edge<E> edge = edges.get(e);
int v1 = edge.getV1();
int v2 = edge.getV2();
if (!encountered[v1]) {
if (traverser.traverse(v2, e, v1) == TraverseResult.CONTINUE) {
encountered[v1] = true;
traverse(v1, traverser, encountered);
}
} else if (!encountered[v2] && traverser.traverse(v1, e, v2) == TraverseResult.CONTINUE) {
encountered[v2] = true;
traverse(v2, traverser, encountered);
}
}
}
示例3: convertInitializerBitRange
import gnu.trove.list.array.TIntArrayList; //導入方法依賴的package包/類
@Override
public Init convertInitializerBitRange(TIntArrayList bits)
{
if (!(getType() instanceof BitsRecTy))
return null;
BitsRecTy t = (BitsRecTy)getType();
int numBits = t.getNumBits();
BitsInit bi = new BitsInit(bits.size());
for (int i = 0, e = bits.size(); i < e; i++)
{
if (bits.get(i) >= numBits)
return null;
bi.setBit(i, new VarBitInit(this, bits.get(i)));
}
return bi;
}
示例4: constructCostVector
import gnu.trove.list.array.TIntArrayList; //導入方法依賴的package包/類
private PBQPVector constructCostVector(int vreg,
TIntArrayList allowedReg,
TObjectDoubleHashMap<Pair<Integer, Integer>> coalsceMap,
double spillCost)
{
PBQPVector cost = new PBQPVector(allowedReg.size()+1);
cost.set(0, spillCost);
for (int i = 0, e = allowedReg.size(); i < e; i++)
{
int preg = allowedReg.get(i);
Pair<Integer, Integer> regPair = Pair.get(preg, vreg);
if (coalsceMap.containsKey(regPair))
{
cost.set(i+1, -coalsceMap.get(regPair));
}
}
return cost;
}
示例5: computeConnectedComponents
import gnu.trove.list.array.TIntArrayList; //導入方法依賴的package包/類
private static void computeConnectedComponents(int v1, int c, int[] componentSize, TIntArrayList[] adjacencyList, int[] componentNumber) {
componentNumber[v1] = c;
++componentSize[c];
TIntArrayList ls = adjacencyList[v1];
for (int i = 0; i < ls.size(); i++) {
int v2 = ls.getQuick(i);
if (componentNumber[v2] == -1) {
computeConnectedComponents(v2, c, componentSize, adjacencyList, componentNumber);
}
}
}
示例6: isValid
import gnu.trove.list.array.TIntArrayList; //導入方法依賴的package包/類
@Override
public boolean isValid(UndirectedGraph<? extends TerminalExt, SwitchImpl> graph, TIntArrayList nodes, List<NodeTerminal> terminals) {
int feederCount = 0;
int branchCount = 0;
int busbarSectionCount = 0;
for (int i = 0; i < nodes.size(); i++) {
int node = nodes.get(i);
TerminalExt terminal = graph.getVertexObject(node);
if (terminal != null) {
AbstractConnectable connectable = terminal.getConnectable();
switch (connectable.getType()) {
case LINE:
case TWO_WINDINGS_TRANSFORMER:
case THREE_WINDINGS_TRANSFORMER:
case HVDC_CONVERTER_STATION:
branchCount++;
feederCount++;
break;
case LOAD:
case GENERATOR:
case SHUNT_COMPENSATOR:
case DANGLING_LINE:
case STATIC_VAR_COMPENSATOR:
feederCount++;
break;
case BUSBAR_SECTION:
busbarSectionCount++;
break;
default:
throw new AssertionError();
}
}
}
return (busbarSectionCount >= 1 && feederCount >= 1)
|| (branchCount >= 1 && feederCount >= 2);
}
示例7: formItineraryOperandCycleString
import gnu.trove.list.array.TIntArrayList; //導入方法依賴的package包/類
/**
* Compose a string containing the
* operand cycle initialization for the specified itinerary. N is the
* number of operands that has cycles specified.
* @param itinData
* @param itinString
* @return The number of operand cycles.
*/
private int formItineraryOperandCycleString(Record itinData,
StringBuilder itinString) throws Exception
{
TIntArrayList operandCycleList = itinData.getValueAsListOfInts("OperandCycles");
for (int i = 0, e = operandCycleList.size(); i != e; i++)
{
itinString.append(" ").append(operandCycleList.get(i));
if (i < e - 1) itinString.append(", ");
}
return operandCycleList.size();
}
示例8: convertIntListSlice
import gnu.trove.list.array.TIntArrayList; //導入方法依賴的package包/類
@Override
public Init convertIntListSlice(TIntArrayList elements)
{
ArrayList<Init> vals = new ArrayList<>();
for (int i = 0, e = elements.size(); i< e; i++)
{
if (elements.get(i) >= getSize())
return null;
vals.add(getElement(elements.get(i)));
}
return new ListInit(vals, getType());
}
示例9: lhsIsSubsetOfRHS
import gnu.trove.list.array.TIntArrayList; //導入方法依賴的package包/類
private boolean lhsIsSubsetOfRHS(
TIntArrayList lhs,
TIntArrayList rhs)
{
if (lhs.size() > rhs.size()) return false;
for (int i = 0, e = lhs.size(); i != e; i++)
if (!rhs.contains(lhs.get(i)))
return false;
return true;
}
示例10: filterEVTs
import gnu.trove.list.array.TIntArrayList; //導入方法依賴的package包/類
public static TIntArrayList filterEVTs(TIntArrayList inVTs, Predicate<Integer> filter)
{
TIntArrayList result = new TIntArrayList();
for (int i = 0, e = inVTs.size(); i != e; i++)
{
int val = inVTs.get(i);
if (filter.test(val))
result.add(val);
}
return result;
}
示例11: filterVTs
import gnu.trove.list.array.TIntArrayList; //導入方法依賴的package包/類
public static TIntArrayList filterVTs(TIntArrayList inVTs, Predicate<Integer> filter)
{
TIntArrayList result = new TIntArrayList();
for (int i = 0; i < inVTs.size(); i++)
{
int vt = inVTs.get(i);
if (filter.test(vt))
result.add(vt);
}
return result;
}
示例12: buildCoalscingEdgeCosts
import gnu.trove.list.array.TIntArrayList; //導入方法依賴的package包/類
private PBQPMatrix buildCoalscingEdgeCosts(
TIntArrayList allowedReg1,
TIntArrayList allowedReg2, double cost)
{
PBQPMatrix m = new PBQPMatrix(allowedReg1.size()+1, allowedReg2.size()+1);
boolean isAllZero = true;
int i = 1;
for (TIntIterator itr = allowedReg1.iterator(); itr.hasNext(); )
{
int j = 1;
int reg1 = itr.next();
for (TIntIterator itr2 = allowedReg2.iterator(); itr2.hasNext(); )
{
if (reg1 == itr2.next())
{
m.set(i, j, -cost);
isAllZero = false;
}
j++;
}
i++;
}
if (isAllZero)
return null;
return m;
}
示例13: buildInterferenceEdgeCosts
import gnu.trove.list.array.TIntArrayList; //導入方法依賴的package包/類
private PBQPMatrix buildInterferenceEdgeCosts(
TIntArrayList allowedReg1,
TIntArrayList allowedReg2)
{
PBQPMatrix m = new PBQPMatrix(allowedReg1.size()+1, allowedReg2.size()+1);
boolean isAllZero = true;
int i = 1;
for (TIntIterator itr = allowedReg1.iterator(); itr.hasNext(); )
{
int j = 1;
int reg1 = itr.next();
for (TIntIterator itr2 = allowedReg2.iterator(); itr2.hasNext(); )
{
// If the row/column regs are identical or alias insert an infinity.
int reg2 = itr2.next();
if (tri.regsOverlap(reg1, reg2))
{
m.set(i, j, Double.MAX_VALUE);
isAllZero = false;
}
j++;
}
i++;
}
if (isAllZero)
return null;
return m;
}
示例14: concat
import gnu.trove.list.array.TIntArrayList; //導入方法依賴的package包/類
public static String concat(TIntArrayList list) {
StringBuilder b = new StringBuilder();
for (int i=0; i<list.size(); i++) {
if (i>0) b.append(", ");
b.append(list.get(i));
}
return b.toString();
}
示例15: combineChildVariants
import gnu.trove.list.array.TIntArrayList; //導入方法依賴的package包/類
/**
* Given a bunch of permutations of each child of the
* 'operator' node, put them together in all possible ways.
* @param orig
* @param childVariants
* @param outVariants
* @param cdp
* @param depVars
*/
private static void combineChildVariants(TreePatternNode orig,
ArrayList<ArrayList<TreePatternNode>> childVariants,
ArrayList<TreePatternNode> outVariants,
CodeGenDAGPatterns cdp,
HashSet<String> depVars)
{
for (int i = 0, e = childVariants.size(); i != e; i++)
{
if (childVariants.get(i).isEmpty())
return;
}
TIntArrayList idxs = new TIntArrayList();
idxs.fill(0, childVariants.size(),0);
boolean notDone;
do
{
if (TableGen.DEBUG && !idxs.isEmpty())
{
System.err.printf("%s: Idxs = [ ", orig.getOperator().getName());
for (int i = 0, e = idxs.size(); i != e; i++)
System.err.printf("%d ", idxs.get(i));
System.err.println("]");
}
ArrayList<TreePatternNode> newChildren = new ArrayList<>();
for (int i = 0, e = childVariants.size(); i != e; i++)
newChildren.add(childVariants.get(i).get(idxs.get(i)));
TreePatternNode r = new TreePatternNode(orig.getOperator(), newChildren);
r.setName(orig.getName());
r.setPredicateFns(orig.getPredicateFns());
r.setTransformFn(orig.getTransformFn());
r.setTypes(orig.getExtTypes());
StringBuilder errString = new StringBuilder();
if (r.canPatternMatch(errString, cdp))
{
boolean alreadyExists = false;
for (int i = 0, e = outVariants.size(); i != e; i++)
{
if (r.isIsomorphicTo(outVariants.get(i), depVars))
{
alreadyExists = true;
break;
}
}
if (!alreadyExists)
outVariants.add(r);
}
// Increment indices to the next permutation by incrementing the
// indicies from last index backward, e.g., generate the sequence
// [0, 0], [0, 1], [1, 0], [1, 1].
int j;
for (j = idxs.size() - 1; j >= 0; --j)
{
int tmp = idxs.get(j);
idxs.set(j, tmp + 1);
if (tmp + 1 == childVariants.get(j).size())
idxs.set(j, 0);
else
break;
}
notDone = j >= 0;
}while (notDone);
}