ProjectData information is typically serialized to a file. An
instance of this class records coverage information for a single
class that has been instrumented.
This class implements HasBeenInstrumented so that when cobertura
instruments itself, it will omit this class. It does this to
avoid an infinite recursion problem because instrumented classes
make use of this class.
addLine
public void addLine(int lineNumber,
String methodName,
String methodDescriptor)
compareTo
public int compareTo(Object o)
This is required because we implement Comparable.
equals
public boolean equals(Object obj)
Returns true if the given object is an instance of the
ClassData class, and it contains the same data as this
class.
getBranchCoverageRate
public double getBranchCoverageRate(String methodNameAndDescriptor)
- The branch coverage rate for a particular method.
getHitCount
public long getHitCount(int lineNumber)
lineNumber
- The source code line number.
- The number of hits a particular line of code has.
getLineCoverageRate
public double getLineCoverageRate(String methodNameAndDescriptor)
- The line coverage rate for particular method
getLineData
private LineData getLineData(int lineNumber)
getLines
public Collection getLines(String methodNameAndDescriptor)
getMethodNamesAndDescriptors
public Set getMethodNamesAndDescriptors()
- The method name and descriptor of each method found in the
class represented by this instrumentation.
isBranch
public boolean isBranch(int lineNumber)
- True if the line contains a branch statement.
isValidSourceLineNumber
public boolean isValidSourceLineNumber(int lineNumber)
Determine if a given line number is a valid line of code.
- True if the line contains executable code. False
if the line is empty, or a comment, etc.
merge
public void merge(CoverageData coverageData)
Merge some existing instrumentation with this instrumentation.
coverageData
- Some existing coverage data.
touch
public void touch(int lineNumber)
Increment the number of hits for a particular line of code.
lineNumber
- the line of code to increment the number of hits.