com.puppycrawl.tools.checkstyle.api
Class FileContents

java.lang.Object
  extended bycom.puppycrawl.tools.checkstyle.api.FileContents

public final class FileContents
extends java.lang.Object

Represents the contents of a file.

Version:
1.0
Author:
Oliver Burn

Constructor Summary
FileContents(java.lang.String aFilename, java.lang.String[] aLines)
          Creates a new FileContents instance.
 
Method Summary
 java.util.Map getCComments()
          Returns a map of all C style comments.
 java.util.Map getCppComments()
          Returns a map of all the C++ style comments.
 java.lang.String getFilename()
           
 java.lang.String[] getJavadocBefore(int aLineNo)
          Returns the Javadoc comment before the specified line.
 java.lang.String[] getLines()
           
 void reportCComment(int aStartLineNo, int aStartColNo, int aEndLineNo, int aEndColNo)
          Report the location of a C-style comment.
 void reportCppComment(int aStartLineNo, int aStartColNo)
          Report the location of a C++ style comment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileContents

public FileContents(java.lang.String aFilename,
                    java.lang.String[] aLines)
Creates a new FileContents instance.

Parameters:
aFilename - name of the file
aLines - the contents of the file
Method Detail

reportCppComment

public void reportCppComment(int aStartLineNo,
                             int aStartColNo)
Report the location of a C++ style comment.

Parameters:
aStartLineNo - the starting line number
aStartColNo - the starting column number

getCppComments

public java.util.Map getCppComments()
Returns a map of all the C++ style comments. The key is a line number, the value is the comment at the line.

Returns:
the Map of comments

reportCComment

public void reportCComment(int aStartLineNo,
                           int aStartColNo,
                           int aEndLineNo,
                           int aEndColNo)
Report the location of a C-style comment.

Parameters:
aStartLineNo - the starting line number
aStartColNo - the starting column number
aEndLineNo - the ending line number
aEndColNo - the ending column number

getCComments

public java.util.Map getCComments()
Returns a map of all C style comments. The key is the line number, the value is a list of C style comments at the line.

Returns:
the map of comments

getJavadocBefore

public java.lang.String[] getJavadocBefore(int aLineNo)
Returns the Javadoc comment before the specified line. A return value of null means there is no such comment.

Parameters:
aLineNo - the line number to check before
Returns:
the Javadoc comment, or null if none

getLines

public java.lang.String[] getLines()
Returns:
the lines in the file

getFilename

public java.lang.String getFilename()
Returns:
the name of the file

Back to the Checkstyle Home Page