com.jcoverage.coverage
Class InstrumentationImpl

java.lang.Object
  extended bycom.jcoverage.coverage.InstrumentationImpl
All Implemented Interfaces:
HasBeenInstrumented, Instrumentation, InstrumentationInternal, java.io.Serializable

class InstrumentationImpl
extends java.lang.Object
implements InstrumentationInternal, HasBeenInstrumented


Field Summary
(package private)  java.util.Map conditionalsByMethod
           
(package private)  java.util.Map lineCounts
           
(package private)  int linesOfCode
           
(package private) static org.apache.log4j.Logger logger
           
(package private)  java.util.Set methodNamesAndSignatures
           
(package private) static long serialVersionUID
           
(package private)  java.lang.String sourceFileName
           
(package private)  java.util.Set sourceLineNumbers
           
(package private)  java.util.Map sourceLineNumbersByMethod
           
(package private) static java.lang.Long ZERO
           
 
Fields inherited from interface com.jcoverage.coverage.Instrumentation
FILE_NAME
 
Constructor Summary
(package private) InstrumentationImpl()
           
 
Method Summary
(package private)  java.lang.Integer findNextSourceLineAfter(java.lang.String methodNameAndSignature, int thisOne)
           
 double getBranchCoverageRate()
           
 double getBranchCoverageRate(java.lang.String methodNameAndSignature)
           
 java.util.Map getConditionalsByMethod()
           
 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()
           
 java.util.Map getSourceLineNumbersByMethod()
           
(package private)  java.util.Set getTouchedLines(java.lang.String methodNameAndSignature)
           
 void merge(Instrumentation instrumentation)
          Merge some existing instrumentation with this instrumentation.
 void setConditionalsByMethod(java.util.Map conditionalsByMethod)
           
 void setMethodNamesAndSignatures(java.util.Set x)
           
 void setSourceFileName(java.lang.String sourceFileName)
           
 void setSourceLineNumbers(java.util.Set sourceLineNumbers)
           
 void setSourceLineNumbersByMethod(java.util.Map sourceLineNumbersByMethod)
           
 void touch(int lineNumber)
          Increment the number of hits for a particular line of code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

logger

static final transient org.apache.log4j.Logger logger

ZERO

static final transient java.lang.Long ZERO

lineCounts

final java.util.Map lineCounts

sourceLineNumbers

final java.util.Set sourceLineNumbers

sourceLineNumbersByMethod

final java.util.Map sourceLineNumbersByMethod

conditionalsByMethod

final java.util.Map conditionalsByMethod

methodNamesAndSignatures

final java.util.Set methodNamesAndSignatures

linesOfCode

int linesOfCode

sourceFileName

java.lang.String sourceFileName
Constructor Detail

InstrumentationImpl

InstrumentationImpl()
Method Detail

getCoverage

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

getCoverage

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

touch

public void touch(int lineNumber)
Description copied from interface: Instrumentation
Increment the number of hits for a particular line of code.

Specified by:
touch in interface Instrumentation
Parameters:
lineNumber - the line of code to increment the number of hits.

merge

public void merge(Instrumentation instrumentation)
Description copied from interface: Instrumentation
Merge some existing instrumentation with this instrumentation.

Specified by:
merge in interface Instrumentation
Parameters:
instrumentation - some existing instrumentation.

getSourceLineNumbers

public java.util.Set getSourceLineNumbers()
Specified by:
getSourceLineNumbers in interface Instrumentation
Returns:
the set of valid source line numbers

setSourceLineNumbers

public void setSourceLineNumbers(java.util.Set sourceLineNumbers)
Specified by:
setSourceLineNumbers in interface InstrumentationInternal
Parameters:
sourceLineNumbers - the set of valid source line numbers.

getLineCoverageRate

public double getLineCoverageRate()
Specified by:
getLineCoverageRate in interface Instrumentation
Returns:
the line coverage rate for the class

getBranchCoverageRate

public double getBranchCoverageRate()
Specified by:
getBranchCoverageRate in interface Instrumentation
Returns:
the branch coverage rate for the class

getLineCoverageRate

public double getLineCoverageRate(java.lang.String methodNameAndSignature)
Specified by:
getLineCoverageRate in interface Instrumentation
Returns:
the line coverage rate for particular method

getTouchedLines

java.util.Set getTouchedLines(java.lang.String methodNameAndSignature)

getBranchCoverageRate

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

findNextSourceLineAfter

java.lang.Integer findNextSourceLineAfter(java.lang.String methodNameAndSignature,
                                          int thisOne)

setSourceFileName

public void setSourceFileName(java.lang.String sourceFileName)
Specified by:
setSourceFileName in interface InstrumentationInternal
Parameters:
sourceFileName - the source file name.

getSourceFileName

public java.lang.String getSourceFileName()
Specified by:
getSourceFileName in interface Instrumentation
Returns:
the source file name.

getSourceLineNumbersByMethod

public java.util.Map getSourceLineNumbersByMethod()

setSourceLineNumbersByMethod

public void setSourceLineNumbersByMethod(java.util.Map sourceLineNumbersByMethod)
Specified by:
setSourceLineNumbersByMethod in interface InstrumentationInternal

getConditionalsByMethod

public java.util.Map getConditionalsByMethod()

setConditionalsByMethod

public void setConditionalsByMethod(java.util.Map conditionalsByMethod)
Specified by:
setConditionalsByMethod in interface InstrumentationInternal

getMethodNamesAndSignatures

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

setMethodNamesAndSignatures

public void setMethodNamesAndSignatures(java.util.Set x)
Specified by:
setMethodNamesAndSignatures in interface InstrumentationInternal