本文整理汇总了Java中gnu.trove.TIntHashSet.size方法的典型用法代码示例。如果您正苦于以下问题:Java TIntHashSet.size方法的具体用法?Java TIntHashSet.size怎么用?Java TIntHashSet.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnu.trove.TIntHashSet
的用法示例。
在下文中一共展示了TIntHashSet.size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSafeToDeleteOutputs
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
public Collection<String> getSafeToDeleteOutputs(Collection<String> outputPaths, int currentTargetId) throws IOException {
final int size = outputPaths.size();
if (size == 0) {
return outputPaths;
}
final Collection<String> result = new ArrayList<String>(size);
for (String outputPath : outputPaths) {
final int key = FileUtil.pathHashCode(outputPath);
synchronized (myDataLock) {
final TIntHashSet associatedTargets = getState(key);
if (associatedTargets == null || associatedTargets.size() != 1) {
continue;
}
if (associatedTargets.contains(currentTargetId)) {
result.add(outputPath);
}
}
}
return result;
}
示例2: findRowsToSelectAndScroll
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
@NotNull
private Pair<TIntHashSet, Integer> findRowsToSelectAndScroll(@NotNull GraphTableModel model,
@NotNull VisibleGraph<Integer> visibleGraph) {
TIntHashSet rowsToSelect = new TIntHashSet();
if (model.getRowCount() == 0) {
// this should have been covered by facade.getVisibleCommitCount,
// but if the table is empty (no commits match the filter), the GraphFacade is not updated, because it can't handle it
// => it has previous values set.
return Pair.create(rowsToSelect, null);
}
Integer rowToScroll = null;
for (int row = 0;
row < visibleGraph.getVisibleCommitCount() && (rowsToSelect.size() < mySelectedCommits.size() || rowToScroll == null);
row++) { //stop iterating if found all hashes
int commit = visibleGraph.getRowInfo(row).getCommit();
if (mySelectedCommits.contains(commit)) {
rowsToSelect.add(row);
}
if (myVisibleSelectedCommit != null && myVisibleSelectedCommit == commit) {
rowToScroll = row;
}
}
return Pair.create(rowsToSelect, rowToScroll);
}
示例3: saveTo
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
@Override
public void saveTo(DataOutput out, DataExternalizer<Value> externalizer) throws IOException {
if (needsCompacting()) {
getMergedData().saveTo(out, externalizer);
} else {
final TIntHashSet set = myInvalidated;
if (set != null && set.size() > 0) {
for (int inputId : set.toArray()) {
DataInputOutputUtil.writeINT(out, -inputId); // mark inputId as invalid, to be processed on load in ValueContainerImpl.readFrom
}
}
final ValueContainer<Value> toAppend = getAddedDelta();
if (toAppend != null && toAppend.size() > 0) {
toAppend.saveTo(out, externalizer);
}
}
}
示例4: removeOccurence
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
public void removeOccurence(int key, int value) {
if (mySingle.containsKey(key)) {
mySingle.remove(key);
return;
}
TIntHashSet items = myMulti.get(key);
if (items != null) {
items.remove(value);
if (items.size() == 1) {
mySingle.put(key, items.toArray()[0]);
myMulti.remove(key);
}
}
}
示例5: getMinDefinitelyReachedOffset
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
/**
* @return min offset after sourceOffset which is definitely reachable from all references
*/
public static int getMinDefinitelyReachedOffset(final ControlFlow flow, final int sourceOffset,
final List references) {
class MyVisitor extends InstructionClientVisitor<Integer> {
// set of exit posint reached from this offset
final TIntHashSet[] exitPoints = new TIntHashSet[flow.getSize()];
@Override
public void visitInstruction(Instruction instruction, int offset, int nextOffset) {
if (nextOffset > flow.getSize()) nextOffset = flow.getSize();
if (exitPoints[offset] == null) {
exitPoints[offset] = new TIntHashSet();
}
if (isLeaf(nextOffset)) {
exitPoints[offset].add(offset);
}
else if (exitPoints[nextOffset] != null) {
exitPoints[offset].addAll(exitPoints[nextOffset].toArray());
}
}
@Override
public Integer getResult() {
int minOffset = flow.getSize();
int maxExitPoints = 0;
nextOffset:
for (int i = sourceOffset; i < exitPoints.length; i++) {
TIntHashSet exitPointSet = exitPoints[i];
final int size = exitPointSet == null ? 0 : exitPointSet.size();
if (size > maxExitPoints) {
// this offset should be reachable from all other references
for (Object reference : references) {
PsiElement element = (PsiElement)reference;
final PsiElement statement = PsiUtil.getEnclosingStatement(element);
if (statement == null) continue;
final int endOffset = flow.getEndOffset(statement);
if (endOffset == -1) continue;
if (i != endOffset && !isInstructionReachable(flow, i, endOffset)) continue nextOffset;
}
minOffset = i;
maxExitPoints = size;
}
}
return minOffset;
}
}
MyVisitor visitor = new MyVisitor();
depthFirstSearch(flow, visitor);
return visitor.getResult().intValue();
}