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. UseAbstractCheckinstead.Base class for checks the calculate complexity based around methods.
-
-
Field Summary
Fields Modifier and Type Field Description private java.math.BigIntegercurrentValueDeprecated.The current value.private static java.math.BigIntegerINITIAL_VALUEDeprecated.The initial current value.private intmaxDeprecated.Threshold to report error for.private java.util.Deque<java.math.BigInteger>valueStackDeprecated.Stack of values - all but the current value.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractComplexityCheck(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.BigIntegergetCurrentValue()Deprecated.Gets the current value.protected abstract java.lang.StringgetMessageID()Deprecated.Gets the message ID to log violations with.int[]getRequiredTokens()Deprecated.The tokens that this check must be registered for.protected voidincrementCurrentValue(java.math.BigInteger amount)Deprecated.Increments the current value by a specified amount.private voidleaveMethodDef(DetailAST ast)Deprecated.Process the end of a method definition.voidleaveToken(DetailAST ast)Deprecated.Called after all the child nodes have been process.protected abstract voidleaveTokenHook(DetailAST ast)Deprecated.Hook called when leaving a token.protected java.math.BigIntegerpopValue()Deprecated.Pops a value off the stack and makes it the current value.protected voidpushValue()Deprecated.Push the current value on the stack.protected voidsetCurrentValue(java.math.BigInteger value)Deprecated.Set the current value.voidsetMax(int max)Deprecated.Set the maximum threshold allowed.private voidvisitMethodDef()Deprecated.Process the start of the method definition.voidvisitToken(DetailAST ast)Deprecated.Called to process a token.protected abstract voidvisitTokenHook(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:AbstractCheckThe tokens that this check must be registered for.- Specified by:
getRequiredTokensin 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:AbstractCheckCalled to process a token.- Overrides:
visitTokenin classAbstractCheck- Parameters:
ast- the token to process
-
leaveToken
public void leaveToken(DetailAST ast)
Deprecated.Description copied from class:AbstractCheckCalled after all the child nodes have been process.- Overrides:
leaveTokenin 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
-
-