本文整理汇总了Java中com.carrotsearch.hppc.IntArrayList.remove方法的典型用法代码示例。如果您正苦于以下问题:Java IntArrayList.remove方法的具体用法?Java IntArrayList.remove怎么用?Java IntArrayList.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.carrotsearch.hppc.IntArrayList
的用法示例。
在下文中一共展示了IntArrayList.remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: gms
import com.carrotsearch.hppc.IntArrayList; //导入方法依赖的package包/类
private IntOpenHashSet gms(IntArrayList choiceVertex,
IntOpenHashSet chosenVertices, Graph g) {
if (choiceVertex.size() == 0) {
// we have made our choice - let's compute it
IntOpenHashSet neighbours = new IntOpenHashSet(chosenVertices.size() << 1);
for (IntCursor vertex : chosenVertices) {
neighbours.addAll(g.getN1(vertex.value));
}
/*
* for (Integer l : chosenVertices) { System.out.print(l);
* System.out.print(" "); } System.out.print(" --> "); for (Integer l :
* neighbours) { System.out.print(l); System.out.print(" "); }
*/
if (neighbours.size() == g.getNumberOfVertices()) {
// System.out.println("*");
return chosenVertices;
} else {
// System.out.println("");
return null;
}
} else {
int v = choiceVertex.get(choiceVertex.size() - 1);
IntArrayList ch = new IntArrayList(choiceVertex);
ch.remove(choiceVertex.size() - 1);
// choose vertices
// don't choose current
IntOpenHashSet set1 = gms(ch, chosenVertices, g);
// choose current
IntOpenHashSet chV = new IntOpenHashSet(chosenVertices);
chV.add(v);
IntOpenHashSet set2 = gms(ch, chV, g);
if (set1 == null)
return set2;
if ((set2 != null) && (set2.size() <= set1.size()))
return set2;
return set1;
}
}