|
|||||||||
| Home >> All >> com >> puppycrawl >> tools >> checkstyle >> [ api overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.puppycrawl.tools.checkstyle.api
Class FileContents

java.lang.Objectcom.puppycrawl.tools.checkstyle.api.FileContents
- public final class FileContents
- extends java.lang.Object
Represents the contents of a file.
- Version:
- 1.0
| Field Summary | |
private static org.apache.regexp.RE |
MATCH_SINGLELINE_COMMENT
compiled regexp to match a single-line comment line |
private static java.lang.String |
MATCH_SINGLELINE_COMMENT_PAT
the pattern to match a single line comment containing only the comment itself -- no code. |
private java.util.Map |
mCComments
map of the C comments indexed on the first line of the comment to a list of comments on that line |
private java.util.Map |
mCPlusPlusComments
map of the C++ comments indexed on the first line of the comment. |
private java.lang.String |
mFilename
the file name |
private java.util.Map |
mJavadocComments
map of the Javadoc comments indexed on the last line of the comment. |
private java.lang.String[] |
mLines
the lines |
| Constructor Summary | |
FileContents(java.lang.String aFilename,
java.lang.String[] aLines)
Creates a new FileContents instance. |
|
| Method Summary | |
private java.lang.String[] |
extractCComment(int aStartLineNo,
int aStartColNo,
int aEndLineNo,
int aEndColNo)
Returns the specified C comment as a String array. |
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()
|
boolean |
lineIsBlank(int aLineNo)
Checks if the specified line is blank. |
boolean |
lineIsComment(int aLineNo)
Checks if the specified line is a single-line comment without code. |
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 |
| Field Detail |
MATCH_SINGLELINE_COMMENT_PAT
private static final java.lang.String MATCH_SINGLELINE_COMMENT_PAT
- the pattern to match a single line comment containing only the comment
itself -- no code.
- See Also:
- Constant Field Values
MATCH_SINGLELINE_COMMENT
private static final org.apache.regexp.RE MATCH_SINGLELINE_COMMENT
- compiled regexp to match a single-line comment line
mFilename
private final java.lang.String mFilename
- the file name
mLines
private final java.lang.String[] mLines
- the lines
mJavadocComments
private final java.util.Map mJavadocComments
- map of the Javadoc comments indexed on the last line of the comment.
The hack is it assumes that there is only one Javadoc comment per line.
mCPlusPlusComments
private final java.util.Map mCPlusPlusComments
- map of the C++ comments indexed on the first line of the comment.
mCComments
private final java.util.Map mCComments
- map of the C comments indexed on the first line of the comment to a
list of comments on that line
| Constructor Detail |
FileContents
public FileContents(java.lang.String aFilename, java.lang.String[] aLines)
- Creates a new
FileContentsinstance.
| Method Detail |
reportCppComment
public void reportCppComment(int aStartLineNo,
int aStartColNo)
- Report the location of a C++ style comment.
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.
reportCComment
public void reportCComment(int aStartLineNo,
int aStartColNo,
int aEndLineNo,
int aEndColNo)
- Report the location of a C-style comment.
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.
extractCComment
private java.lang.String[] extractCComment(int aStartLineNo, int aStartColNo, int aEndLineNo, int aEndColNo)
- Returns the specified C comment as a String array.
getJavadocBefore
public java.lang.String[] getJavadocBefore(int aLineNo)
- Returns the Javadoc comment before the specified line.
A return value of
nullmeans there is no such comment.
getLines
public java.lang.String[] getLines()
getFilename
public java.lang.String getFilename()
lineIsBlank
public boolean lineIsBlank(int aLineNo)
- Checks if the specified line is blank.
lineIsComment
public boolean lineIsComment(int aLineNo)
- Checks if the specified line is a single-line comment without code.
|
|||||||||
| Home >> All >> com >> puppycrawl >> tools >> checkstyle >> [ api overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.puppycrawl.tools.checkstyle.api.FileContents