net.sourceforge.cobertura.coveragedata
public class ClassData extends CoverageDataContainer implements Comparable, HasBeenInstrumented
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.
Field Summary | |
---|---|
Map | branches
Each key is a line number in this class, stored as an Integer object.
|
boolean | containsInstrumentationInfo |
Set | methodNamesAndDescriptors |
String | name |
static long | serialVersionUID |
String | sourceFileName |
Constructor Summary | |
---|---|
ClassData(String name) |
Method Summary | |
---|---|
LineData | addLine(int lineNumber, String methodName, String methodDescriptor) |
void | addLineJump(int lineNumber, int branchNumber) |
void | addLineSwitch(int lineNumber, int switchNumber, int[] keys) |
void | addLineSwitch(int lineNumber, int switchNumber, int min, int max) |
int | compareTo(Object o)
This is required because we implement Comparable. |
boolean | containsInstrumentationInfo() |
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. |
String | getBaseName() |
double | getBranchCoverageRate(String methodNameAndDescriptor) |
Collection | getBranches() |
LineData | getLineCoverage(int lineNumber) |
double | getLineCoverageRate(String methodNameAndDescriptor) |
LineData | getLineData(int lineNumber) |
SortedSet | getLines() |
Collection | getLines(String methodNameAndDescriptor) |
Set | getMethodNamesAndDescriptors() |
String | getName() |
int | getNumberOfCoveredBranches() |
int | getNumberOfValidBranches() |
String | getPackageName() |
String | getSourceFileName()
Return the name of the file containing this class. |
boolean | hasBranch(int lineNumber) |
int | hashCode() |
boolean | isValidSourceLineNumber(int lineNumber)
Determine if a given line number is a valid line of code.
|
void | merge(CoverageData coverageData)
Merge some existing instrumentation with this instrumentation.
|
void | removeLine(int lineNumber) |
void | setContainsInstrumentationInfo() |
void | setSourceFileName(String sourceFileName) |
void | touch(int lineNumber)
Increment the number of hits for a particular line of code.
|
void | touchJump(int lineNumber, int branchNumber, boolean branch)
Increments the number of hits for particular hit counter of particular branch on particular line number.
|
void | touchSwitch(int lineNumber, int switchNumber, int branch)
Increments the number of hits for particular hit counter of particular switch branch on particular line number.
|
Parameters: name In the format "net.sourceforge.cobertura.coveragedata.ClassData"
Returns: The branch coverage rate for a particular method.
Parameters: lineNumber The source code line number.
Returns: The coverage of the line
Returns: The line coverage rate for particular method
Returns: The method name and descriptor of each method found in the class represented by this instrumentation.
See Also: getNumberOfCoveredBranches
Returns: The number of branches in this class.
Returns: The name of the source file, for example net/sourceforge/cobertura/coveragedata/ClassData.java
Returns: True if the line contains at least one condition jump (branch)
Returns: True if the line contains executable code. False if the line is empty, or a comment, etc.
Parameters: coverageData Some existing coverage data.
Parameters: lineNumber the line of code to increment the number of hits.
Parameters: lineNumber The line of code where the branch is branchNumber The branch on the line to change the hit counter branch The hit counter (true or false)
Parameters: lineNumber The line of code where the branch is switchNumber The switch on the line to change the hit counter branch The hit counter