当前位置: 首页>>代码示例>>Java>>正文


Java TIntHashSet.size方法代码示例

本文整理汇总了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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:OutputToTargetRegistry.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:VcsLogGraphTable.java

示例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);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ChangeTrackingValueContainer.java

示例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);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:IntToIntSetMap.java

示例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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:54,代码来源:ControlFlowUtil.java


注:本文中的gnu.trove.TIntHashSet.size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。