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


Java PsiMethod.accept方法代码示例

本文整理汇总了Java中com.intellij.psi.PsiMethod.accept方法的典型用法代码示例。如果您正苦于以下问题:Java PsiMethod.accept方法的具体用法?Java PsiMethod.accept怎么用?Java PsiMethod.accept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.PsiMethod的用法示例。


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

示例1: calculateReturnPointCount

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
private int calculateReturnPointCount(PsiMethod method) {
  final ReturnPointCountVisitor visitor =
    new ReturnPointCountVisitor(ignoreGuardClauses);
  method.accept(visitor);
  final int count = visitor.getCount();
  if (!mayFallThroughBottom(method)) {
    return count;
  }
  final PsiCodeBlock body = method.getBody();
  if (body == null) {
    return count;
  }
  final PsiStatement[] statements = body.getStatements();
  if (statements.length == 0) {
    return count + 1;
  }
  final PsiStatement lastStatement =
    statements[statements.length - 1];
  if (ControlFlowUtils.statementMayCompleteNormally(lastStatement)) {
    return count + 1;
  }
  return count;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:MultipleReturnPointsPerMethodInspection.java

示例2: visitMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  // note: no call to super
  if (method.getNameIdentifier() == null) {
    return;
  }
  final CouplingVisitor visitor = new CouplingVisitor(
    method, m_includeJavaClasses, m_includeLibraryClasses);
  method.accept(visitor);
  final int coupling = visitor.getNumDependencies();

  if (coupling <= getLimit()) {
    return;
  }
  registerMethodError(method, Integer.valueOf(coupling));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:MethodCouplingInspection.java

示例3: visitMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  // note: no call to super
  if (method.getNameIdentifier() == null) {
    return;
  }
  final NegationCountVisitor visitor = new NegationCountVisitor(ignoreInAssert);
  method.accept(visitor);
  final int negationCount = visitor.getCount();
  if (negationCount <= 3) {
    return;
  }
  if (m_ignoreInEquals && MethodUtils.isEquals(method)) {
    return;
  }
  registerMethodError(method, Integer.valueOf(negationCount));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ThreeNegationsPerMethodInspection.java

示例4: calculateComplexityForMethods

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
private int calculateComplexityForMethods(PsiMethod[] methods) {
  final CyclomaticComplexityVisitor visitor = new CyclomaticComplexityVisitor();
  int complexity = 0;
  for (final PsiMethod method : methods) {
    visitor.reset();
    method.accept(visitor);
    complexity += visitor.getComplexity();
  }
  return complexity;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ClassComplexityInspection.java

示例5: visitMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  final PsiClass containingClass = method.getContainingClass();
  final ClassAccessVisitor visitor = new ClassAccessVisitor(containingClass);
  method.accept(visitor);
  final Set<PsiClass> overAccessedClasses = visitor.getOveraccessedClasses();
  for (PsiClass aClass : overAccessedClasses) {
    registerMethodError(method, aClass, method);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:FeatureEnvyInspectionBase.java

示例6: visitMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  // note: no call to super
  if (method.getNameIdentifier() == null) {
    return;
  }
  final LoopCountVisitor visitor = new LoopCountVisitor();
  method.accept(visitor);
  final int negationCount = visitor.getCount();
  if (negationCount <= 1) {
    return;
  }
  registerMethodError(method, Integer.valueOf(negationCount));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:MethodWithMultipleLoopsInspection.java

示例7: visitMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  // note: no call to super
  if (method.getNameIdentifier() == null) {
    return;
  }
  final CyclomaticComplexityVisitor visitor =
    new CyclomaticComplexityVisitor();
  method.accept(visitor);
  final int complexity = visitor.getComplexity();
  if (complexity <= getLimit()) {
    return;
  }
  registerMethodError(method, Integer.valueOf(complexity));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:CyclomaticComplexityInspection.java

示例8: visitMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  // note: no call to super
  if (method.getNameIdentifier() == null) {
    return;
  }
  final NCSSVisitor visitor = new NCSSVisitor();
  method.accept(visitor);
  final int count = visitor.getStatementCount();
  if (count <= getLimit()) {
    return;
  }
  registerMethodError(method, Integer.valueOf(count));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:NonCommentSourceStatementsInspection.java

示例9: visitMethod

import com.intellij.psi.PsiMethod; //导入方法依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
  // note: no call to super
  if (method.getNameIdentifier() == null) {
    return;
  }
  final NestingDepthVisitor visitor = new NestingDepthVisitor(getLimit());
  method.accept(visitor);
  final int count = visitor.getMaximumDepth();
  if (count <= getLimit()) {
    return;
  }
  registerMethodError(method, Integer.valueOf(count));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:NestingDepthInspection.java


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