Class AbstractComplexityCheck

  • All Implemented Interfaces:
    Configurable, Contextualizable

    @Deprecated
    public abstract class AbstractComplexityCheck
    extends AbstractCheck
    Deprecated.
    Checkstyle will not support abstract checks anymore. Use AbstractCheck instead.
    Base class for checks the calculate complexity based around methods.
    • 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.
    • Constructor Detail

      • AbstractComplexityCheck

        protected AbstractComplexityCheck​(int max)
        Deprecated.
        Creates an instance.
        Parameters:
        max - the threshold of when to report an error
    • 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 class AbstractCheck
        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 class AbstractCheck
        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 class AbstractCheck
        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