com.puppycrawl.tools.checkstyle.checks.coding

Class AbstractNestedDepthCheck

public abstract class AbstractNestedDepthCheck extends Check

Abstract class which provides helpers functionality for nestedchecks.

Author: Simon Harris

Constructor Summary
AbstractNestedDepthCheck(int aMax)
Creates new instance of checks.
Method Summary
voidbeginTree(DetailAST aRootAST)
{@inheritDoc}
intgetMax()
Getter for maximum allowed nesting depth.
int[]getRequiredTokens()
{@inheritDoc}
protected voidnestIn(DetailAST aAST, String aMessageId)
Increasing current nesting depth.
protected voidnestOut()
Decreasing current nesting depth
voidsetMax(int aMax)
Setter for maximum allowed nesting depth.

Constructor Detail

AbstractNestedDepthCheck

public AbstractNestedDepthCheck(int aMax)
Creates new instance of checks.

Parameters: aMax default allowed nesting depth.

Method Detail

beginTree

public void beginTree(DetailAST aRootAST)
{@inheritDoc}

getMax

public final int getMax()
Getter for maximum allowed nesting depth.

Returns: maximum allowed nesting depth.

getRequiredTokens

public final int[] getRequiredTokens()
{@inheritDoc}

nestIn

protected final void nestIn(DetailAST aAST, String aMessageId)
Increasing current nesting depth.

Parameters: aAST note which increases nesting. aMessageId message id for logging error.

nestOut

protected final void nestOut()
Decreasing current nesting depth

setMax

public final void setMax(int aMax)
Setter for maximum allowed nesting depth.

Parameters: aMax maximum allowed nesting depth.