本文整理匯總了Java中gnu.trove.list.array.TIntArrayList.getQuick方法的典型用法代碼示例。如果您正苦於以下問題:Java TIntArrayList.getQuick方法的具體用法?Java TIntArrayList.getQuick怎麽用?Java TIntArrayList.getQuick使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gnu.trove.list.array.TIntArrayList
的用法示例。
在下文中一共展示了TIntArrayList.getQuick方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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);
}
}
}