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