Class AbstractComplexityCheck
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.api.AutomaticBean
-
- com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
-
- com.puppycrawl.tools.checkstyle.api.AbstractCheck
-
- com.puppycrawl.tools.checkstyle.checks.metrics.AbstractComplexityCheck
-
- All Implemented Interfaces:
Configurable
,Contextualizable
@Deprecated public abstract class AbstractComplexityCheck extends AbstractCheck
Deprecated.Checkstyle will not support abstract checks anymore. UseAbstractCheck
instead.Base class for checks the calculate complexity based around methods.
-
-
Field Summary
Fields Modifier and Type Field Description private java.math.BigInteger
currentValue
Deprecated.The current value.private static java.math.BigInteger
INITIAL_VALUE
Deprecated.The initial current value.private int
max
Deprecated.Threshold to report error for.private java.util.Deque<java.math.BigInteger>
valueStack
Deprecated.Stack of values - all but the current value.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractComplexityCheck(int max)
Deprecated.Creates an instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected java.math.BigInteger
getCurrentValue()
Deprecated.Gets the current value.protected abstract java.lang.String
getMessageID()
Deprecated.Gets the message ID to log violations with.int[]
getRequiredTokens()
Deprecated.The tokens that this check must be registered for.protected void
incrementCurrentValue(java.math.BigInteger amount)
Deprecated.Increments the current value by a specified amount.private void
leaveMethodDef(DetailAST ast)
Deprecated.Process the end of a method definition.void
leaveToken(DetailAST ast)
Deprecated.Called after all the child nodes have been process.protected abstract void
leaveTokenHook(DetailAST ast)
Deprecated.Hook called when leaving a token.protected java.math.BigInteger
popValue()
Deprecated.Pops a value off the stack and makes it the current value.protected void
pushValue()
Deprecated.Push the current value on the stack.protected void
setCurrentValue(java.math.BigInteger value)
Deprecated.Set the current value.void
setMax(int max)
Deprecated.Set the maximum threshold allowed.private void
visitMethodDef()
Deprecated.Process the start of the method definition.void
visitToken(DetailAST ast)
Deprecated.Called to process a token.protected abstract void
visitTokenHook(DetailAST ast)
Deprecated.Hook called when visiting a token.-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractCheck
beginTree, destroy, finishTree, getAcceptableTokens, getClassLoader, getDefaultTokens, getFileContents, getLine, getLines, getTabWidth, getTokenNames, init, isCommentNodesRequired, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens
-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverity
-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
configure, contextualize, finishLocalSetup, getConfiguration, setupChild
-
-
-
-
Field Detail
-
INITIAL_VALUE
private static final java.math.BigInteger INITIAL_VALUE
Deprecated.The initial current value.
-
valueStack
private final java.util.Deque<java.math.BigInteger> valueStack
Deprecated.Stack of values - all but the current value.
-
currentValue
private java.math.BigInteger currentValue
Deprecated.The current value.
-
max
private int max
Deprecated.Threshold to report error for.
-
-
Method Detail
-
getMessageID
protected abstract java.lang.String getMessageID()
Deprecated.Gets the message ID to log violations with.- Returns:
- the message ID to log violations with
-
visitTokenHook
protected abstract void visitTokenHook(DetailAST ast)
Deprecated.Hook called when visiting a token. Will not be called the method definition tokens.- Parameters:
ast
- the token being visited
-
leaveTokenHook
protected abstract void leaveTokenHook(DetailAST ast)
Deprecated.Hook called when leaving a token. Will not be called the method definition tokens.- Parameters:
ast
- the token being left
-
getRequiredTokens
public final int[] getRequiredTokens()
Deprecated.Description copied from class:AbstractCheck
The tokens that this check must be registered for.- Specified by:
getRequiredTokens
in classAbstractCheck
- Returns:
- the token set this must be registered for.
- See Also:
TokenTypes
-
setMax
public final void setMax(int max)
Deprecated.Set the maximum threshold allowed.- Parameters:
max
- the maximum threshold
-
visitToken
public void visitToken(DetailAST ast)
Deprecated.Description copied from class:AbstractCheck
Called to process a token.- Overrides:
visitToken
in classAbstractCheck
- Parameters:
ast
- the token to process
-
leaveToken
public void leaveToken(DetailAST ast)
Deprecated.Description copied from class:AbstractCheck
Called after all the child nodes have been process.- Overrides:
leaveToken
in classAbstractCheck
- Parameters:
ast
- the token leaving
-
getCurrentValue
protected final java.math.BigInteger getCurrentValue()
Deprecated.Gets the current value.- Returns:
- the current value
-
setCurrentValue
protected final void setCurrentValue(java.math.BigInteger value)
Deprecated.Set the current value.- Parameters:
value
- the new value
-
incrementCurrentValue
protected final void incrementCurrentValue(java.math.BigInteger amount)
Deprecated.Increments the current value by a specified amount.- Parameters:
amount
- the amount to increment by
-
pushValue
protected final void pushValue()
Deprecated.Push the current value on the stack.
-
popValue
protected final java.math.BigInteger popValue()
Deprecated.Pops a value off the stack and makes it the current value.- Returns:
- pop a value off the stack and make it the current value
-
visitMethodDef
private void visitMethodDef()
Deprecated.Process the start of the method definition.
-
leaveMethodDef
private void leaveMethodDef(DetailAST ast)
Deprecated.Process the end of a method definition.- Parameters:
ast
- the token representing the method definition
-
-