Class Comment
java.lang.Object
com.puppycrawl.tools.checkstyle.api.Comment
- All Implemented Interfaces:
TextBlock
Representation of the comment block.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intNumber of last column of the comment.private final intNumber of last line of the comment.private final intNumber of first column of the comment.private final intNumber of first line of the comment.private final String[]Text of the comment. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintThe column in the input file where the text block ends.final intThe last line of the text block in the input file.intThe column in the input file where the text block starts.final intThe line in the input file where the text block starts.final String[]getText()The text content of the text block.booleanintersects(int startLine, int startCol, int endLine, int endCol) Checks if this comment intersects with a specified part of the file.toString()
-
Field Details
-
text
Text of the comment. -
startLineNo
Number of first line of the comment. -
endLineNo
Number of last line of the comment. -
startColNo
Number of first column of the comment. -
endColNo
Number of last column of the comment.
-
-
Constructor Details
-
Comment
Creates new instance.- Parameters:
text- the lines that make up the comment.firstCol- number of the first column of the comment.lastLine- number of the last line of the comment.lastCol- number of the last column of the comment.
-
-
Method Details
-
getText
Description copied from interface:TextBlockThe text content of the text block. Each line is represented by one array entry. The linebreak characters are not part of the text content. -
getStartLineNo
Description copied from interface:TextBlockThe line in the input file where the text block starts. Counting starts from 1.- Specified by:
getStartLineNoin interfaceTextBlock- Returns:
- first line of the text block
-
getEndLineNo
Description copied from interface:TextBlockThe last line of the text block in the input file. Counting starts from 1.- Specified by:
getEndLineNoin interfaceTextBlock- Returns:
- last line of the text block
-
getStartColNo
Description copied from interface:TextBlockThe column in the input file where the text block starts. Counting starts from 0.- Specified by:
getStartColNoin interfaceTextBlock- Returns:
- first line of the text block
-
getEndColNo
Description copied from interface:TextBlockThe column in the input file where the text block ends. Counting starts from 0.- Specified by:
getEndColNoin interfaceTextBlock- Returns:
- last line of the text block
-
intersects
Description copied from interface:TextBlockChecks if this comment intersects with a specified part of the file.- Specified by:
intersectsin interfaceTextBlock- Parameters:
startLine- the starting line number in the filestartCol- the starting column number in the fileendLine- the ending line number in the fileendCol- the ending column number in the file- Returns:
- true if the positions intersects with this comment.
-
toString
-