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


Java IntArrayList类代码示例

本文整理汇总了Java中com.intellij.util.containers.IntArrayList的典型用法代码示例。如果您正苦于以下问题:Java IntArrayList类的具体用法?Java IntArrayList怎么用?Java IntArrayList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IntArrayList类属于com.intellij.util.containers包,在下文中一共展示了IntArrayList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildVisitor

import com.intellij.util.containers.IntArrayList; //导入依赖的package包/类
@Override
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
    final List<PsiMethod> patternMethods = new ArrayList<>();
    final IntArrayList indices = new IntArrayList();
    return new JavaElementVisitor() {
        @Override
        public void visitReferenceExpression(final PsiReferenceExpression expression) {
            visitExpression(expression);
        }

        @Override
        public void visitMethodCallExpression(PsiMethodCallExpression methodCall) {
            super.visitMethodCallExpression(methodCall);
            final String message = getSuspiciousMethodCallMessage(methodCall,
                                                                  REPORT_CONVERTIBLE_METHOD_CALLS,
                                                                  patternMethods,
                                                                  indices
            );
            if (message != null) {
                holder.registerProblem(methodCall.getArgumentList().getExpressions()[0], message);
            }
        }
    };
}
 
开发者ID:aewhite,项目名称:intellij-eclipse-collections-plugin,代码行数:26,代码来源:EclipseCollectionsSuspiciousMethodCallsInspection.java

示例2: processGoto

import com.intellij.util.containers.IntArrayList; //导入依赖的package包/类
private static void processGoto(ControlFlow flow, int start, int end,
                                IntArrayList exitPoints,
                                Collection<PsiStatement> exitStatements, BranchingInstruction instruction, Class[] classesFilter, final PsiStatement statement) {
  if (statement == null) return;
  int gotoOffset = instruction.offset;
  if (start > gotoOffset || gotoOffset >= end || isElementOfClass(statement, classesFilter)) {
    // process chain of goto's
    gotoOffset = promoteThroughGotoChain(flow, gotoOffset);

    if (!exitPoints.contains(gotoOffset) && (gotoOffset >= end || gotoOffset < start)) {
      exitPoints.add(gotoOffset);
    }
    if (gotoOffset >= end || gotoOffset < start) {
      processGotoStatement(classesFilter, exitStatements, statement);
    }
    else {
      boolean isReturn = instruction instanceof GoToInstruction && ((GoToInstruction)instruction).isReturn;
      final Instruction gotoInstruction = flow.getInstructions().get(gotoOffset);
      isReturn |= gotoInstruction instanceof GoToInstruction && ((GoToInstruction)gotoInstruction).isReturn;
      if (isReturn) {
        processGotoStatement(classesFilter, exitStatements, statement);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ControlFlowUtil.java

示例3: buildVisitor

import com.intellij.util.containers.IntArrayList; //导入依赖的package包/类
@Override
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
  final List<PsiMethod> patternMethods = new ArrayList<PsiMethod>();
  final IntArrayList indices = new IntArrayList();
  return new JavaElementVisitor() {
    @Override
    public void visitReferenceExpression(final PsiReferenceExpression expression) {
      visitExpression(expression);
    }

    @Override
    public void visitMethodCallExpression(PsiMethodCallExpression methodCall) {
      super.visitMethodCallExpression(methodCall);
      final String message = getSuspiciousMethodCallMessage(methodCall, REPORT_CONVERTIBLE_METHOD_CALLS, patternMethods, indices
      );
      if (message != null) {
        holder.registerProblem(methodCall.getArgumentList().getExpressions()[0], message);
      }
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:SuspiciousCollectionsMethodCallsInspection.java

示例4: getSuspiciousMethodCallMessage

import com.intellij.util.containers.IntArrayList; //导入依赖的package包/类
@Nullable
private static String getSuspiciousMethodCallMessage(final PsiMethodCallExpression methodCall,
                                                     final boolean reportConvertibleMethodCalls, final List<PsiMethod> patternMethods,
                                                     final IntArrayList indices) {
  final PsiExpression[] args = methodCall.getArgumentList().getExpressions();
  if (args.length != 1) return null;

  PsiType argType = args[0].getType();
  final String plainMessage = SuspiciousMethodCallUtil
    .getSuspiciousMethodCallMessage(methodCall, argType, reportConvertibleMethodCalls, patternMethods, indices);
  if (plainMessage != null) {
    final PsiType dfaType = GuessManager.getInstance(methodCall.getProject()).getControlFlowExpressionType(args[0]);
    if (dfaType != null && SuspiciousMethodCallUtil
                             .getSuspiciousMethodCallMessage(methodCall, dfaType, reportConvertibleMethodCalls, patternMethods, indices) == null) {
      return null;
    }
  }

  return plainMessage;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:SuspiciousCollectionsMethodCallsInspection.java

示例5: highlightExitPoints

import com.intellij.util.containers.IntArrayList; //导入依赖的package包/类
private void highlightExitPoints(final PsiStatement parent, final PsiCodeBlock body) throws AnalysisCanceledException {
  final Project project = myTarget.getProject();
  ControlFlow flow = ControlFlowFactory.getInstance(project).getControlFlow(body, LocalsOrMyInstanceFieldsControlFlowPolicy.getInstance(), false);

  Collection<PsiStatement> exitStatements = ControlFlowUtil.findExitPointsAndStatements(flow, 0, flow.getSize(), new IntArrayList(),
                                                                                        PsiReturnStatement.class, PsiBreakStatement.class,
                                                                                        PsiContinueStatement.class, PsiThrowStatement.class);
  if (!exitStatements.contains(parent)) return;

  PsiElement originalTarget = getExitTarget(parent);

  final Iterator<PsiStatement> it = exitStatements.iterator();
  while (it.hasNext()) {
    PsiStatement psiStatement = it.next();
    if (getExitTarget(psiStatement) != originalTarget) {
      it.remove();
    }
  }

  for (PsiElement e : exitStatements) {
    addOccurrence(e);
  }
  myStatusText = CodeInsightBundle.message("status.bar.exit.points.highlighted.message", exitStatements.size(),
                                                                    HighlightUsagesHandler.getShortcutText());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:HighlightExitPointsHandler.java

示例6: prepareExitStatements

import com.intellij.util.containers.IntArrayList; //导入依赖的package包/类
public Collection<PsiStatement> prepareExitStatements(final PsiElement[] elements) throws ExitStatementsNotSameException {
  myExitPoints = new IntArrayList();
  myExitStatements = ControlFlowUtil
    .findExitPointsAndStatements(myControlFlow, myFlowStart, myFlowEnd, myExitPoints, ControlFlowUtil.DEFAULT_EXIT_STATEMENTS_CLASSES);
  if (LOG.isDebugEnabled()) {
    LOG.debug("exit points:");
    for (int i = 0; i < myExitPoints.size(); i++) {
      LOG.debug("  " + myExitPoints.get(i));
    }
    LOG.debug("exit statements:");
    for (PsiStatement exitStatement : myExitStatements) {
      LOG.debug("  " + exitStatement);
    }
  }
  if (myExitPoints.isEmpty()) {
    // if the fragment never exits assume as if it exits in the end
    myExitPoints.add(myControlFlow.getEndOffset(elements[elements.length - 1]));
  }

  if (myExitPoints.size() != 1) {
    myGenerateConditionalExit = true;
    areExitStatementsTheSame();
  }
  return myExitStatements;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ControlFlowWrapper.java

示例7: testOverloadConstructors

import com.intellij.util.containers.IntArrayList; //导入依赖的package包/类
public void testOverloadConstructors() throws Exception {
  PsiClass aClass = myJavaFacade.findClass("B", GlobalSearchScope.allScope(myProject));
  PsiMethod constructor = aClass.findMethodsByName("B", false)[0];
  PsiMethodCallExpression superCall = (PsiMethodCallExpression) constructor.getBody().getStatements()[0].getFirstChild();
  PsiReferenceExpression superExpr = superCall.getMethodExpression();
  String[] fileNames = {"B.java", "A.java", "A.java", "B.java"};
  int[] starts = {};
  int[] ends = {};
  final ArrayList<PsiFile> filesList = new ArrayList<PsiFile>();
  final IntArrayList startsList = new IntArrayList();
  final IntArrayList endsList = new IntArrayList();
  PsiReference[] refs =
    MethodReferencesSearch.search((PsiMethod)superExpr.resolve(), GlobalSearchScope.projectScope(myProject), false).toArray(PsiReference.EMPTY_ARRAY);
  for (PsiReference ref : refs) {
    addReference(ref, filesList, startsList, endsList);
  }
  checkResult(fileNames, filesList, starts, startsList, ends, endsList);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:FindUsagesTest.java

示例8: checkResult

import com.intellij.util.containers.IntArrayList; //导入依赖的package包/类
private static void checkResult(String[] fileNames, final ArrayList<PsiFile> filesList, int[] starts, final IntArrayList startsList, int[] ends, final IntArrayList endsList) {
  List<SearchResult> expected = new ArrayList<SearchResult>();
  for (int i = 0; i < fileNames.length; i++) {
    String fileName = fileNames[i];
    expected.add(new SearchResult(fileName, i < starts.length ? starts[i] : -1, i < ends.length ? ends[i] : -1));
  }

  List<SearchResult> actual = new ArrayList<SearchResult>();
  for (int i = 0; i < filesList.size(); i++) {
    PsiFile psiFile = filesList.get(i);
    actual.add(
      new SearchResult(psiFile.getName(), i < starts.length ? startsList.get(i) : -1, i < ends.length ? endsList.get(i) : -1));
  }

  Collections.sort(expected);
  Collections.sort(actual);

  assertEquals("Usages don't match", expected, actual);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:FindUsagesTest.java

示例9: checkRecordSanity

import com.intellij.util.containers.IntArrayList; //导入依赖的package包/类
private static void checkRecordSanity(final int id, final int recordCount, final IntArrayList usedAttributeRecordIds,
                                      final IntArrayList validAttributeIds) {
  int parentId = getParent(id);
  assert parentId >= 0 && parentId < recordCount;
  if (parentId > 0 && getParent(parentId) > 0) {
    int parentFlags = getFlags(parentId);
    assert (parentFlags & FREE_RECORD_FLAG) == 0 : parentId + ": "+Integer.toHexString(parentFlags);
    assert (parentFlags & PersistentFS.IS_DIRECTORY_FLAG) != 0 : parentId + ": "+Integer.toHexString(parentFlags);
  }

  String name = getName(id);
  LOG.assertTrue(parentId == 0 || !name.isEmpty(), "File with empty name found under " + getName(parentId) + ", id=" + id);

  checkContentsStorageSanity(id);
  checkAttributesStorageSanity(id, usedAttributeRecordIds, validAttributeIds);

  long length = getLength(id);
  assert length >= -1 : "Invalid file length found for " + name + ": " + length;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:FSRecords.java

示例10: doReformat

import com.intellij.util.containers.IntArrayList; //导入依赖的package包/类
private void doReformat(final TextRange range) {
  RangeMarker rangeMarker = null;
  if (range != null) {
    rangeMarker = myDocument.createRangeMarker(range);
    rangeMarker.setGreedyToLeft(true);
    rangeMarker.setGreedyToRight(true);
  }
  final RangeMarker finalRangeMarker = rangeMarker;
  final Runnable action = new Runnable() {
    @Override
    public void run() {
      IntArrayList indices = initEmptyVariables();
      mySegments.setSegmentsGreedy(false);
      LOG.assertTrue(myTemplateRange.isValid(),
                     "template key: " + myTemplate.getKey() + "; " +
                     "template text" + myTemplate.getTemplateText() + "; " +
                     "variable number: " + getCurrentVariableNumber());
      reformat(finalRangeMarker);
      mySegments.setSegmentsGreedy(true);
      restoreEmptyVariables(indices);
    }
  };
  ApplicationManager.getApplication().runWriteAction(action);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:TemplateState.java

示例11: shortenReferences

import com.intellij.util.containers.IntArrayList; //导入依赖的package包/类
private void shortenReferences() {
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      final PsiFile file = getPsiFile();
      if (file != null) {
        IntArrayList indices = initEmptyVariables();
        mySegments.setSegmentsGreedy(false);
        for (TemplateOptionalProcessor processor : Extensions.getExtensions(TemplateOptionalProcessor.EP_NAME)) {
          processor.processText(myProject, myTemplate, myDocument, myTemplateRange, myEditor);
        }
        mySegments.setSegmentsGreedy(true);
        restoreEmptyVariables(indices);
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:TemplateState.java

示例12: initEmptyVariables

import com.intellij.util.containers.IntArrayList; //导入依赖的package包/类
private IntArrayList initEmptyVariables() {
  int endSegmentNumber = myTemplate.getEndSegmentNumber();
  int selStart = myTemplate.getSelectionStartSegmentNumber();
  int selEnd = myTemplate.getSelectionEndSegmentNumber();
  IntArrayList indices = new IntArrayList();
  for (int i = 0; i < myTemplate.getSegmentsCount(); i++) {
    int length = mySegments.getSegmentEnd(i) - mySegments.getSegmentStart(i);
    if (length != 0) continue;
    if (i == endSegmentNumber || i == selStart || i == selEnd) continue;

    String name = myTemplate.getSegmentName(i);
    for (int j = 0; j < myTemplate.getVariableCount(); j++) {
      if (myTemplate.getVariableNameAt(j).equals(name)) {
        Expression e = myTemplate.getExpressionAt(j);
        @NonNls String marker = "a";
        if (e instanceof MacroCallNode) {
          marker = ((MacroCallNode)e).getMacro().getDefaultValue();
        }
        replaceString(marker, mySegments.getSegmentStart(i), mySegments.getSegmentEnd(i), i);
        indices.add(i);
        break;
      }
    }
  }
  return indices;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:TemplateState.java

示例13: calcBreakOffsets

import com.intellij.util.containers.IntArrayList; //导入依赖的package包/类
public static IntArrayList calcBreakOffsets(char[] text, int startOffset, int endOffset, int column, double x, double clipX, WidthProvider widthProvider) {
  IntArrayList breakOffsets = new IntArrayList();
  int nextOffset = startOffset;
  while (true) {
    int prevOffset = nextOffset;
    nextOffset = calcWordBreakOffset(text, nextOffset, endOffset, x, clipX, widthProvider);
    if (nextOffset == prevOffset && column == 0) {
      nextOffset = calcCharBreakOffset(text, nextOffset, endOffset, x, clipX, widthProvider);
      if (nextOffset == prevOffset) {
        nextOffset++; // extremal case when even one character doesn't fit into clip width
      }
    }
    if (nextOffset >= endOffset) {
      break;
    }
    breakOffsets.add(nextOffset);
    column = 0;
    x = 0;
  }
  return breakOffsets;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:LineWrapper.java

示例14: addIfWithinInclusive

import com.intellij.util.containers.IntArrayList; //导入依赖的package包/类
private static void addIfWithinInclusive(int min, int max, int value, IntArrayList list, @Nullable List<ResourceItem> items) {
  if (value >= min && value <= max) {
    // Make sure we have a compatible match for this version for this resources
    boolean foundCompatible = true;
    if (items != null) {
      foundCompatible = false;
      // Make sure that if you're looking at a layout only present in say -v14, we don't attempt
      // to render this in -v9.
      for (ResourceItem item : items) {
        FolderConfiguration configuration = item.getConfiguration();
        VersionQualifier qualifier = configuration.getVersionQualifier();
        if (qualifier == null || qualifier.getVersion() <= value) {
          foundCompatible = true;
          break;
        }
      }
    }

    if (foundCompatible) {
      list.add(value);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:RenderPreviewManager.java

示例15: storeState

import com.intellij.util.containers.IntArrayList; //导入依赖的package包/类
protected void storeState() {
  if (myRootComponent != null && myExpandedState == null && mySelectionState == null) {
    myExpandedState = new int[myExpandedComponents == null ? 0 : myExpandedComponents.size()][];
    for (int i = 0; i < myExpandedState.length; i++) {
      IntArrayList path = new IntArrayList();
      componentToPath((RadComponent)myExpandedComponents.get(i), path);
      myExpandedState[i] = path.toArray();
    }

    mySelectionState = getSelectionState();

    myExpandedComponents = null;

    InputTool tool = myToolProvider.getActiveTool();
    if (!(tool instanceof MarqueeTracker) &&
        !(tool instanceof CreationTool) &&
        !(tool instanceof PasteTool)) {
      myToolProvider.loadDefaultTool();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:DesignerEditorPanel.java


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