Class DetailAstSet
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.checks.indentation.DetailAstSet
-
public class DetailAstSet extends Object
Represents a set of abstract syntax tree.
-
-
Field Summary
Fields Modifier and Type Field Description private SortedMap<Integer,DetailAST>
astLines
Maps line numbers to their ast.private IndentationCheck
indentCheck
The instance ofIndentationCheck
used by this class.
-
Constructor Summary
Constructors Constructor Description DetailAstSet(IndentationCheck indentCheck)
Construct an instance of this class withIndentationCheck
parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAst(DetailAST ast)
Add ast to the set of ast.private void
addLineWithAst(int lineNo, DetailAST ast)
Map ast with their line number.protected int
expandedTabsColumnNo(DetailAST ast)
Get the column number for the start of a given expression, expanding tabs out into spaces in the process.DetailAST
firstLine()
The first line in set of ast.DetailAST
getAst(int lineNum)
Get the ast corresponding to line number.Integer
getStartColumn(int lineNum)
Get starting column number for the ast.boolean
isEmpty()
Check if this set of ast is empty.Integer
lastLine()
Get the line number of the last line.
-
-
-
Field Detail
-
indentCheck
private final IndentationCheck indentCheck
The instance ofIndentationCheck
used by this class.
-
-
Constructor Detail
-
DetailAstSet
public DetailAstSet(IndentationCheck indentCheck)
Construct an instance of this class withIndentationCheck
parameters.- 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 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 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 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
-
-