com.puppycrawl.tools.checkstyle.api
Class Comment

java.lang.Object
  extended by com.puppycrawl.tools.checkstyle.api.Comment
All Implemented Interfaces:
TextBlock

public class Comment
extends Object
implements TextBlock

Representation of the comment block.

Author:
o_sukhodolsky

Constructor Summary
Comment(String[] aText, int aFirstCol, int aLastLine, int aLastCol)
          Creates new instance.
 
Method Summary
 int getEndColNo()
          The column in the inputfile where the text block ends.
 int getEndLineNo()
          The last line of the text block in the inputfile.
 int getStartColNo()
          The column in the inputfile where the text block starts.
 int getStartLineNo()
          The line in the inputfile where the text block starts.
 String[] getText()
          The text content of the text block.
 boolean intersects(int aStartLineNo, int aStartColNo, int aEndLineNo, int aEndColNo)
          Checks if this comment intersects with a specified part of the file.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Comment

public Comment(String[] aText,
               int aFirstCol,
               int aLastLine,
               int aLastCol)
Creates new instance.

Parameters:
aText - the lines that make up the comment.
aFirstCol - number of the first column of the comment.
aLastLine - number of the last line of the comment.
aLastCol - number of the last column of the comment.
Method Detail

getText

public final String[] getText()
The text content of the text block. Each line is represented by one array entry. The linebreak characters are not part of the text content.

Specified by:
getText in interface TextBlock
Returns:
the text content of the text block.

getStartLineNo

public final int getStartLineNo()
The line in the inputfile where the text block starts. Counting starts from 1.

Specified by:
getStartLineNo in interface TextBlock
Returns:
first line of the text block

getEndLineNo

public final int getEndLineNo()
The last line of the text block in the inputfile. Counting starts from 1.

Specified by:
getEndLineNo in interface TextBlock
Returns:
last line of the text block

getStartColNo

public int getStartColNo()
The column in the inputfile where the text block starts. Counting starts from 0.

Specified by:
getStartColNo in interface TextBlock
Returns:
first line of the text block

getEndColNo

public int getEndColNo()
The column in the inputfile where the text block ends. Counting starts from 0.

Specified by:
getEndColNo in interface TextBlock
Returns:
last line of the text block

intersects

public boolean intersects(int aStartLineNo,
                          int aStartColNo,
                          int aEndLineNo,
                          int aEndColNo)
Checks if this comment intersects with a specified part of the file.

Specified by:
intersects in interface TextBlock
Parameters:
aStartLineNo - the starting line number in the file
aStartColNo - the starting column number in the file
aEndLineNo - the ending line number in the file
aEndColNo - the ending column number in the file
Returns:
true if the positions intersects with this comment.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2001-2014. All Rights Reserved.