Class Comment
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.api.Comment
-
-
Field Summary
Fields Modifier and Type Field Description private intendColNoNumber of last column of the comment.private intendLineNoNumber of last line of the comment.private intstartColNoNumber of first column of the comment.private intstartLineNoNumber of first line of the comment.private java.lang.String[]textText of the comment.
-
Constructor Summary
Constructors Constructor Description Comment(java.lang.String[] text, int firstCol, int lastLine, int lastCol)Creates new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetEndColNo()The column in the input file where the text block ends.intgetEndLineNo()The last line of the text block in the input file.intgetStartColNo()The column in the input file where the text block starts.intgetStartLineNo()The line in the input file where the text block starts.java.lang.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.java.lang.StringtoString()
-
-
-
Field Detail
-
text
private final java.lang.String[] text
Text of the comment.
-
startLineNo
private final int startLineNo
Number of first line of the comment.
-
endLineNo
private final int endLineNo
Number of last line of the comment.
-
startColNo
private final int startColNo
Number of first column of the comment.
-
endColNo
private final int endColNo
Number of last column of the comment.
-
-
Constructor Detail
-
Comment
public Comment(java.lang.String[] text, int firstCol, int lastLine, int lastCol)
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 Detail
-
getText
public final java.lang.String[] 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
public final int 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
public final int 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
public int 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
public int 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
public boolean intersects(int startLine, int startCol, int endLine, int endCol)
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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-