net.sourceforge.cobertura.coveragedata

Class CoverageDataContainer

Implemented Interfaces:
CoverageData, HasBeenInstrumented, Serializable

public abstract class CoverageDataContainer
extends java.lang.Object
implements CoverageData, HasBeenInstrumented, Serializable

Coverage data information is typically serialized to a file.

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

(package private) Map
children
Each key is the name of a child, usually stored as a String or an Integer object.

Method Summary

boolean
equals(Object obj)
Determine if this CoverageDataContainer is equal to another one.
double
getBranchCoverageRate()
CoverageData
getChild(String name)
Get a child from this container with the specified key.
double
getLineCoverageRate()
int
getNumberOfChildren()
int
getNumberOfCoveredBranches()
int
getNumberOfCoveredLines()
int
getNumberOfValidBranches()
int
getNumberOfValidLines()
int
hashCode()
It is highly recommended that classes extending this class override this hashCode method and generate a more effective hash code.
void
merge(CoverageData coverageData)
Merge two CoverageDataContainers.

Field Details

children

(package private)  Map children
Each key is the name of a child, usually stored as a String or an Integer object. Each value is information about the child, stored as an object that implements the CoverageData interface.

Method Details

equals

public boolean equals(Object obj)
Determine if this CoverageDataContainer is equal to another one. Subclasses should override this and make sure they implement the hashCode method.
Parameters:
obj - An object to test for equality.
Returns:
True if the objects are equal.

getBranchCoverageRate

public double getBranchCoverageRate()
Returns:
The average branch coverage rate for all children in this container.

getChild

public CoverageData getChild(String name)
Get a child from this container with the specified key.
Parameters:
name - The key used to lookup the child in the map.
Returns:
The child object, if found, or null if not found.

getLineCoverageRate

public double getLineCoverageRate()
Returns:
The average line coverage rate for all children in this container. This number will be a decimal between 0 and 1, inclusive.

getNumberOfChildren

public int getNumberOfChildren()
Returns:
The number of children in this container.

getNumberOfCoveredBranches

public int getNumberOfCoveredBranches()

getNumberOfCoveredLines

public int getNumberOfCoveredLines()

getNumberOfValidBranches

public int getNumberOfValidBranches()

getNumberOfValidLines

public int getNumberOfValidLines()

hashCode

public int hashCode()
It is highly recommended that classes extending this class override this hashCode method and generate a more effective hash code.

merge

public void merge(CoverageData coverageData)
Merge two CoverageDataContainers.
Parameters:
coverageData - The container to merge into this one.