Moving intersects() method to TextComment interface.Minor javadoc changes in Comment.src/checkstyle/com/puppycrawl/tools/checkstyle/api/Comment.java

This commit is contained in:
Oleg Sukhodolsky 2004-03-01 06:27:28 +00:00
parent 417a132e0e
commit c4288bb3bc
2 changed files with 15 additions and 3 deletions

View File

@ -262,7 +262,7 @@ public final class FileContents implements CommentListener
List row = (List) it.next();
Iterator rowIterator = row.iterator();
while (rowIterator.hasNext()) {
Comment comment = (Comment) rowIterator.next();
TextBlock comment = (TextBlock) rowIterator.next();
if (comment.intersects(
aStartLineNo, aStartColNo, aEndLineNo, aEndColNo))
{
@ -275,8 +275,8 @@ public final class FileContents implements CommentListener
for (int lineNumber = aStartLineNo; lineNumber <= aEndLineNo;
lineNumber++)
{
Comment comment = (Comment) mCPlusPlusComments.get(
new Integer(lineNumber));
TextBlock comment =
(TextBlock) mCPlusPlusComments.get(new Integer(lineNumber));
if (comment != null && comment.intersects(aStartLineNo, aStartColNo,
aEndLineNo, aEndColNo))
{

View File

@ -63,4 +63,16 @@ public interface TextBlock
*/
int getEndColNo();
/**
* Checks if this comment intersects with a specified
* part of the file.
*
* @param aStartLineNo the starting line number in the file
* @param aStartColNo the starting column number in the file
* @param aEndLineNo the ending line number in the file
* @param aEndColNo the ending column number in the file
* @return true if the positions intersects with this comment.
*/
boolean intersects(int aStartLineNo, int aStartColNo,
int aEndLineNo, int aEndColNo);
}