|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.puppycrawl.tools.checkstyle.checks.indentation.ExpressionHandler
Abstract base class for all handlers.
Constructor Summary | |
ExpressionHandler(IndentationCheck aIndentCheck,
java.lang.String aTypeName,
DetailAST aExpr,
ExpressionHandler aParent)
Construct an instance of this handler with the given indentation check, name, abstract syntax tree, and parent handler. |
Method Summary | |
protected boolean |
atLevelOrGreater(DetailAST aParent)
Determines if the gieven parent expression is equal to or greater than the correct indentation level. |
protected void |
checkChildren(DetailAST aParent,
int[] aTokenTypes,
int aStartLevel,
boolean aFirstLineMatches,
boolean aAllowNesting)
Check the indent level of the children of the specified parent expression. |
protected void |
checkExpressionSubtree(DetailAST aTree,
int aLevel,
boolean aFirstLineMatches,
boolean aAllowNesting)
Check the indentation level for an expression subtree. |
abstract void |
checkIndentation()
Check the indentation of the expression we are handling. |
protected void |
checkLinesIndent(int aStartLine,
int aEndLine,
int aIndentLevel)
Check the indentation of consecutive lines for the expression we are handling. |
protected void |
checkModifiers()
Check the indentation level of modifiers. |
protected int |
expandedTabsColumnNo(DetailAST aAst)
Get the column number for the start of a given expression, expanding tabs out into spaces in the process. |
protected void |
findSubtreeLines(LineSet aLines,
DetailAST aTree,
boolean aAllowNesting)
Find the set of lines for a given subtree. |
protected int |
getFirstLine(int aStartLine,
DetailAST aTree)
Get the first line for a given expression. |
protected IndentationCheck |
getIndentCheck()
Accessor for the IndentCheck attribute. |
int |
getLevel()
Get the indentation amount for this handler. |
protected int |
getLevelImpl()
Compute the indentation amount for this handler. |
protected int |
getLineStart(DetailAST aAst)
Get the start of the line for the given expression. |
protected int |
getLineStart(java.lang.String aLine)
Get the start of the specified line. |
protected DetailAST |
getMainAst()
Accessor for the MainAst attribute. |
protected ExpressionHandler |
getParent()
Accessor for the Parent attribute. |
protected void |
logChildError(int aLine,
int aActualLevel,
int aExpectedLevel)
Log child indentation error. |
protected void |
logError(DetailAST aAst,
java.lang.String aSubtypeName,
int aActualLevel)
Log an indentation error. |
protected void |
logError(DetailAST aAst,
java.lang.String aSubtypeName,
int aActualLevel,
int aExpectedLevel)
Log an indentation error. |
protected boolean |
shouldIncraeseIndent()
|
protected boolean |
startsLine(DetailAST aAst)
Determines if the given expression is at the start of a line. |
int |
suggestedChildLevel(ExpressionHandler aChild)
Indentation level suggested for a child element. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ExpressionHandler(IndentationCheck aIndentCheck, java.lang.String aTypeName, DetailAST aExpr, ExpressionHandler aParent)
aIndentCheck
- the indentation checkaTypeName
- the name of the handleraExpr
- the abstract syntax treeaParent
- the parent handlerMethod Detail |
public final int getLevel()
protected int getLevelImpl()
public int suggestedChildLevel(ExpressionHandler aChild)
aChild
- child AST (so suggestion level can differ based on child
type)
protected final void logError(DetailAST aAst, java.lang.String aSubtypeName, int aActualLevel)
aAst
- the expression that caused the erroraSubtypeName
- the type of the expressionaActualLevel
- the actual indent level of the expressionprotected final void logError(DetailAST aAst, java.lang.String aSubtypeName, int aActualLevel, int aExpectedLevel)
aAst
- the expression that caused the erroraSubtypeName
- the type of the expressionaActualLevel
- the actual indent level of the expressionaExpectedLevel
- the expected indent level of the expressionprotected final void logChildError(int aLine, int aActualLevel, int aExpectedLevel)
aLine
- the expression that caused the erroraActualLevel
- the actual indent level of the expressionaExpectedLevel
- the expected indent level of the expressionprotected final boolean startsLine(DetailAST aAst)
aAst
- the expression to check
protected final boolean atLevelOrGreater(DetailAST aParent)
aParent
- the parent expression
protected final int getLineStart(DetailAST aAst)
aAst
- the expression to find the start of the line for
protected final void checkLinesIndent(int aStartLine, int aEndLine, int aIndentLevel)
aStartLine
- the first line to checkaEndLine
- the last line to checkaIndentLevel
- the required indent levelprotected boolean shouldIncraeseIndent()
protected final int getLineStart(java.lang.String aLine)
aLine
- the specified line number
protected final void checkChildren(DetailAST aParent, int[] aTokenTypes, int aStartLevel, boolean aFirstLineMatches, boolean aAllowNesting)
aParent
- the parent whose children we are checkingaTokenTypes
- the token types to checkaStartLevel
- the starting indent levelaFirstLineMatches
- whether or not the first line needs to matchaAllowNesting
- whether or not nested children are allowedprotected final void checkExpressionSubtree(DetailAST aTree, int aLevel, boolean aFirstLineMatches, boolean aAllowNesting)
aTree
- the expression subtree to checkaLevel
- the indentation levelaFirstLineMatches
- whether or not the first line has to matchaAllowNesting
- whether or not subtree nesting is allowedprotected final int getFirstLine(int aStartLine, DetailAST aTree)
aStartLine
- the line we are starting fromaTree
- the expression to find the first line for
protected final int expandedTabsColumnNo(DetailAST aAst)
aAst
- the expression to find the start of
protected final void findSubtreeLines(LineSet aLines, DetailAST aTree, boolean aAllowNesting)
aLines
- the set of lines to add toaTree
- the subtree to examineaAllowNesting
- whether or not to allow nested subtreesprotected final void checkModifiers()
public abstract void checkIndentation()
protected final IndentationCheck getIndentCheck()
protected final DetailAST getMainAst()
protected final ExpressionHandler getParent()
|
Back to the Checkstyle Home Page | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |