Class DetailAstSet
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.checks.indentation.DetailAstSet
-
public class DetailAstSet extends java.lang.Object
Represents a set of abstract syntax tree.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.SortedMap<java.lang.Integer,DetailAST>astLinesMaps line numbers to their ast.private IndentationCheckindentCheckThe instance ofIndentationCheckused by this class.
-
Constructor Summary
Constructors Constructor Description DetailAstSet(IndentationCheck indentCheck)Construct an instance of this class withIndentationCheckparameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAst(DetailAST ast)Add ast to the set of ast.private voidaddLineWithAst(int lineNo, DetailAST ast)Map ast with their line number.protected intexpandedTabsColumnNo(DetailAST ast)Get the column number for the start of a given expression, expanding tabs out into spaces in the process.DetailASTfirstLine()The first line in set of ast.DetailASTgetAst(int lineNum)Get the ast corresponding to line number.java.lang.IntegergetStartColumn(int lineNum)Get starting column number for the ast.booleanisEmpty()Check if the this set of ast is empty.java.lang.IntegerlastLine()Get the line number of the last line.
-
-
-
Field Detail
-
indentCheck
private final IndentationCheck indentCheck
The instance ofIndentationCheckused by this class.
-
-
Constructor Detail
-
DetailAstSet
public DetailAstSet(IndentationCheck indentCheck)
Construct an instance of this class withIndentationCheckparameters.- Parameters:
indentCheck- IndentationCheck parameters
-
-
Method Detail
-
addAst
public void addAst(DetailAST ast)
Add ast to the set of ast.- Parameters:
ast- the ast to add
-
addLineWithAst
private void addLineWithAst(int lineNo, DetailAST ast)
Map ast with their line number.- Parameters:
lineNo- line number of ast to addast- ast to add
-
getStartColumn
public java.lang.Integer getStartColumn(int lineNum)
Get starting column number for the ast.- Parameters:
lineNum- the line number as key- Returns:
- start column for ast
-
isEmpty
public boolean isEmpty()
Check if the this set of ast is empty.- Returns:
- true if empty, false otherwise
-
firstLine
public DetailAST firstLine()
The first line in set of ast.- Returns:
- first line in set of ast.
-
getAst
public DetailAST getAst(int lineNum)
Get the ast corresponding to line number.- Parameters:
lineNum- line number of ast.- Returns:
- ast with their corresponding line number or null if no mapping is present
-
lastLine
public java.lang.Integer lastLine()
Get the line number of the last line.- Returns:
- the line number of the last line
-
expandedTabsColumnNo
protected final int expandedTabsColumnNo(DetailAST ast)
Get the column number for the start of a given expression, expanding tabs out into spaces in the process.- Parameters:
ast- the expression to find the start of- Returns:
- the column number for the start of the expression
-
-