public final class FileContents extends Object implements CommentListener
| Constructor and Description |
|---|
FileContents(FileText aText)
Creates a new
FileContents instance. |
FileContents(String aFilename,
String[] aLines)
Deprecated.
Use
FileContents(FileText) instead
in order to preserve the original line breaks where possible. |
| Modifier and Type | Method and Description |
|---|---|
com.google.common.collect.ImmutableMap<Integer,List<TextBlock>> |
getCComments()
Returns a map of all C style comments.
|
com.google.common.collect.ImmutableMap<Integer,TextBlock> |
getCppComments()
Returns a map of all the C++ style comments.
|
String |
getFilename() |
TextBlock |
getJavadocBefore(int aLineNo)
Returns the Javadoc comment before the specified line.
|
String |
getLine(int aIndex)
Get the line from text of the file.
|
String[] |
getLines() |
FileText |
getText()
Get the full text of the file.
|
boolean |
hasIntersectionWithComment(int aStartLineNo,
int aStartColNo,
int aEndLineNo,
int aEndColNo)
Checks if the specified position intersects with a comment.
|
boolean |
inPackageInfo()
Checks if the current file is a package-info.java file.
|
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 |
reportBlockComment(String aType,
int aStartLineNo,
int aStartColNo,
int aEndLineNo,
int aEndColNo)
Report the location of a block comment that can span multiple lines.
|
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.
|
void |
reportSingleLineComment(String aType,
int aStartLineNo,
int aStartColNo)
Report the location of a single line comment that extends from the
given point to the end of the line.
|
@Deprecated public FileContents(String aFilename, String[] aLines)
FileContents(FileText) instead
in order to preserve the original line breaks where possible.FileContents instance.aFilename - name of the fileaLines - the contents of the filepublic FileContents(FileText aText)
FileContents instance.aText - the contents of the filepublic void reportSingleLineComment(String aType, int aStartLineNo, int aStartColNo)
reportSingleLineComment in interface CommentListeneraType - an identifier for what type of comment it is.aStartLineNo - the starting line numberaStartColNo - the starting column numberpublic void reportBlockComment(String aType, int aStartLineNo, int aStartColNo, int aEndLineNo, int aEndColNo)
reportBlockComment in interface CommentListeneraType - an identifier for what type of comment it is.aStartLineNo - the starting line numberaStartColNo - the starting column numberaEndLineNo - the ending line numberaEndColNo - the ending column numberpublic void reportCppComment(int aStartLineNo,
int aStartColNo)
aStartLineNo - the starting line numberaStartColNo - the starting column numberpublic com.google.common.collect.ImmutableMap<Integer,TextBlock> getCppComments()
TextBlock at the line.public void reportCComment(int aStartLineNo,
int aStartColNo,
int aEndLineNo,
int aEndColNo)
aStartLineNo - the starting line numberaStartColNo - the starting column numberaEndLineNo - the ending line numberaEndColNo - the ending column numberpublic com.google.common.collect.ImmutableMap<Integer,List<TextBlock>> getCComments()
List of C style comment TextBlocks
that start at that line.public TextBlock getJavadocBefore(int aLineNo)
null means there is no such comment.aLineNo - the line number to check beforenull if nonepublic FileText getText()
public String[] getLines()
public String getLine(int aIndex)
aIndex - index of the linepublic String getFilename()
public boolean lineIsBlank(int aLineNo)
aLineNo - the line number to checkpublic boolean lineIsComment(int aLineNo)
aLineNo - the line number to checkpublic boolean hasIntersectionWithComment(int aStartLineNo,
int aStartColNo,
int aEndLineNo,
int aEndColNo)
aStartLineNo - the starting line numberaStartColNo - the starting column numberaEndLineNo - the ending line numberaEndColNo - the ending column numberpublic boolean inPackageInfo()
Copyright © 2001-2014. All Rights Reserved.