本文整理汇总了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));
}
示例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));
}
示例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;
}
示例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);
}
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}