當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。