public class BlockParentHandler extends AbstractExpressionHandler
The "block" handler classes use a common superclass BlockParentHandler, employing the Template Method pattern.
Constructor and Description |
---|
BlockParentHandler(IndentationCheck indentCheck,
String name,
DetailAST ast,
AbstractExpressionHandler parent)
Construct an instance of this handler with the given indentation check,
name, abstract syntax tree, and parent handler.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
canChildrenBeNested()
Determines if child elements within the expression may be nested.
|
void |
checkIndentation()
Check the indentation of the expression we are handling.
|
protected void |
checkLeftCurly()
Check the indentation of the left curly brace.
|
protected void |
checkRightCurly()
Check the indentation of the right curly brace.
|
protected void |
checkTopLevelToken()
Check the indent of the top level token.
|
protected IndentLevel |
curlyIndent()
Get the expected indentation level for the curly braces.
|
protected int[] |
getCheckedChildren()
Returns array of token types which should be checked among children.
|
protected IndentLevel |
getChildrenExpectedIndent()
Gets indentation level expected for children.
|
protected DetailAST |
getLeftCurly()
Get the left curly brace portion of the expression we are handling.
|
protected DetailAST |
getLeftParen()
Get the left parenthesis portion of the expression we are handling.
|
protected DetailAST |
getListChild()
Get the child element representing the list of statements.
|
protected DetailAST |
getNonListChild()
Get the child element that is not a list of statements.
|
protected DetailAST |
getRightCurly()
Get the right curly brace portion of the expression we are handling.
|
protected DetailAST |
getRightParen()
Get the right parenthesis portion of the expression we are handling.
|
IndentLevel |
getSuggestedChildIndent(AbstractExpressionHandler child)
Indentation level suggested for a child element.
|
protected DetailAST |
getTopLevelAst()
Get the top level expression being managed by this handler.
|
protected boolean |
hasCurlies()
Determines if this block expression has curly braces.
|
protected boolean |
hasLabelBefore()
Check if the top level token has label before.
|
protected boolean |
shouldTopLevelStartLine()
Determines if the top level token must start the line.
|
areOnSameLine, checkChildren, checkExpressionSubtree, checkLeftParen, checkModifiers, checkRightParen, checkWrappingIndentation, checkWrappingIndentation, expandedTabsColumnNo, findSubtreeLines, getBasicOffset, getBraceAdjustment, getFirstLine, getFirstToken, getIndent, getIndentCheck, getIndentImpl, getLineStart, getLineStart, getMainAst, getParent, isOnStartOfLine, logError, logError, shouldIncreaseIndent
public BlockParentHandler(IndentationCheck indentCheck, String name, DetailAST ast, AbstractExpressionHandler parent)
indentCheck
- the indentation checkname
- the name of the handlerast
- the abstract syntax treeparent
- the parent handlerprotected int[] getCheckedChildren()
protected DetailAST getTopLevelAst()
protected void checkTopLevelToken()
protected boolean hasLabelBefore()
protected boolean shouldTopLevelStartLine()
protected boolean hasCurlies()
protected DetailAST getLeftCurly()
protected DetailAST getRightCurly()
protected void checkLeftCurly()
protected IndentLevel curlyIndent()
protected boolean canChildrenBeNested()
protected void checkRightCurly()
protected DetailAST getNonListChild()
protected DetailAST getListChild()
protected DetailAST getRightParen()
protected DetailAST getLeftParen()
public void checkIndentation()
AbstractExpressionHandler
checkIndentation
in class AbstractExpressionHandler
protected IndentLevel getChildrenExpectedIndent()
public IndentLevel getSuggestedChildIndent(AbstractExpressionHandler child)
AbstractExpressionHandler
getSuggestedChildIndent
in class AbstractExpressionHandler
child
- child AST (so suggestion level can differ based on child
type)Copyright © 2001-2017. All Rights Reserved.