com.jcoverage.coverage
Interface Instrumentation

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
InstrumentationInternal
All Known Implementing Classes:
InstrumentationImpl

public interface Instrumentation
extends java.io.Serializable

Instrumentation information is typically serialized to a file. An instance of this class records coverage information for a single class that has been instrumented.


Field Summary
static java.lang.String FILE_NAME
          default file name used to write instrumentation information.
 
Method Summary
 double getBranchCoverageRate()
           
 double getBranchCoverageRate(java.lang.String methodNameAndSignature)
           
 java.util.Map getCoverage()
           
 long getCoverage(int lineNumber)
           
 double getLineCoverageRate()
           
 double getLineCoverageRate(java.lang.String methodNameAndSignature)
           
 java.util.Set getMethodNamesAndSignatures()
           
 java.lang.String getSourceFileName()
           
 java.util.Set getSourceLineNumbers()
           
 void merge(Instrumentation instrumentation)
          Merge some existing instrumentation with this instrumentation.
 void touch(int lineNumber)
          Increment the number of hits for a particular line of code.
 

Field Detail

FILE_NAME

public static final java.lang.String FILE_NAME
default file name used to write instrumentation information.

See Also:
Constant Field Values
Method Detail

touch

public void touch(int lineNumber)
Increment the number of hits for a particular line of code.

Parameters:
lineNumber - the line of code to increment the number of hits.

getCoverage

public java.util.Map getCoverage()
Returns:
a sorted coverage mapping from source line to number of hits.

getCoverage

public long getCoverage(int lineNumber)
Parameters:
lineNumber - the source code line number.
Returns:
the number of hits a particular line of code has.

merge

public void merge(Instrumentation instrumentation)
Merge some existing instrumentation with this instrumentation.

Parameters:
instrumentation - some existing instrumentation.

getSourceLineNumbers

public java.util.Set getSourceLineNumbers()
Returns:
the set of valid source line numbers

getLineCoverageRate

public double getLineCoverageRate()
Returns:
the line coverage rate for the class

getBranchCoverageRate

public double getBranchCoverageRate()
Returns:
the branch coverage rate for the class

getLineCoverageRate

public double getLineCoverageRate(java.lang.String methodNameAndSignature)
Returns:
the line coverage rate for particular method

getBranchCoverageRate

public double getBranchCoverageRate(java.lang.String methodNameAndSignature)
Returns:
the branch coverage rate for a particular method

getSourceFileName

public java.lang.String getSourceFileName()
Returns:
the source file name.

getMethodNamesAndSignatures

public java.util.Set getMethodNamesAndSignatures()
Returns:
the method name and signature of each method found in the class represented by this instrumentation.