net.sourceforge.cobertura.coveragedata

Class CoverageDataContainer

public abstract class CoverageDataContainer extends 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
Mapchildren
Each key is the name of a child, usually stored as a String or an Integer object.
static longserialVersionUID
Method Summary
booleanequals(Object obj)
Determine if this CoverageDataContainer is equal to another one.
doublegetBranchCoverageRate()
CoverageDatagetChild(String name)
Get a child from this container with the specified key.
doublegetLineCoverageRate()
intgetNumberOfChildren()
intgetNumberOfCoveredBranches()
intgetNumberOfCoveredLines()
intgetNumberOfValidBranches()
intgetNumberOfValidLines()
inthashCode()
It is highly recommended that classes extending this class override this hashCode method and generate a more effective hash code.
voidmerge(CoverageData coverageData)
Merge two CoverageDataContainers.

Field Detail

children

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.

serialVersionUID

private static final long serialVersionUID

Method Detail

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.