Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.puppycrawl.tools.checkstyle.checks.metrics
Class AbstractComplexityCheck  view AbstractComplexityCheck download AbstractComplexityCheck.java

java.lang.Object
  extended bycom.puppycrawl.tools.checkstyle.api.AutomaticBean
      extended bycom.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
          extended bycom.puppycrawl.tools.checkstyle.api.Check
              extended bycom.puppycrawl.tools.checkstyle.checks.metrics.AbstractComplexityCheck
All Implemented Interfaces:
com.puppycrawl.tools.checkstyle.api.Configurable, com.puppycrawl.tools.checkstyle.api.Contextualizable
Direct Known Subclasses:
CyclomaticComplexityCheck

public abstract class AbstractComplexityCheck
extends com.puppycrawl.tools.checkstyle.api.Check

Base class for checks the calculate complexity based around methods.


Field Summary
private static int INITIAL_VALUE
          the initial current value
private  int mCurrentValue
          the current value
private  int mMax
          threshold to report error for
private  java.util.Stack mValueStack
          stack of values - all but the current value
 
Fields inherited from class com.puppycrawl.tools.checkstyle.api.Check
 
Fields inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
 
Fields inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
 
Constructor Summary
AbstractComplexityCheck(int aMax)
          Creates an instance.
 
Method Summary
protected  int getCurrentValue()
           
 int getMax()
           
protected abstract  java.lang.String getMessageID()
           
 int[] getRequiredTokens()
          null
protected  void incrementCurrentValue(int aBy)
          Increments the current value by a specified amount.
private  void leaveMethodDef(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
          Process the end of a method definition.
 void leaveToken(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
          null
protected  void leaveTokenHook(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
          Hook called when leaving a token.
protected  int popValue()
           
protected  void pushValue()
          Push the current value on the stack
protected  void setCurrentValue(int aValue)
          Set the current value
 void setMax(int aMax)
          Set the maximum threshold allowed.
private  void visitMethodDef()
          Process the start of the method definition
 void visitToken(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
          null
protected  void visitTokenHook(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
          Hook called when visiting a token.
 
Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check
beginTree, destroy, finishTree, getAcceptableTokens, getClassLoader, getDefaultTokens, getFileContents, getLines, getTabWidth, getTokenNames, init, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens
 
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, setSeverity
 
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
configure, contextualize, finishLocalSetup, getConfiguration, setupChild
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIAL_VALUE

private static final int INITIAL_VALUE
the initial current value

See Also:
Constant Field Values

mValueStack

private final java.util.Stack mValueStack
stack of values - all but the current value


mCurrentValue

private int mCurrentValue
the current value


mMax

private int mMax
threshold to report error for

Constructor Detail

AbstractComplexityCheck

public AbstractComplexityCheck(int aMax)
Creates an instance.

Method Detail

getMessageID

protected abstract java.lang.String getMessageID()

visitTokenHook

protected void visitTokenHook(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
Hook called when visiting a token. Will not be called the method definition tokens.


leaveTokenHook

protected void leaveTokenHook(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
Hook called when leaving a token. Will not be called the method definition tokens.


getRequiredTokens

public final int[] getRequiredTokens()
null


getMax

public final int getMax()

setMax

public final void setMax(int aMax)
Set the maximum threshold allowed.


visitToken

public final void visitToken(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
null


leaveToken

public final void leaveToken(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
null


getCurrentValue

protected final int getCurrentValue()

setCurrentValue

protected final void setCurrentValue(int aValue)
Set the current value


incrementCurrentValue

protected final void incrementCurrentValue(int aBy)
Increments the current value by a specified amount.


pushValue

protected final void pushValue()
Push the current value on the stack


popValue

protected final int popValue()

visitMethodDef

private void visitMethodDef()
Process the start of the method definition


leaveMethodDef

private void leaveMethodDef(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
Process the end of a method definition.