net.sourceforge.cobertura.metrics.api
Class AbstractCoverageCalculator
java.lang.Object
net.sourceforge.cobertura.metrics.api.AbstractCoverageCalculator
- All Implemented Interfaces:
- CoverageCalculator
public abstract class AbstractCoverageCalculator
- extends Object
- implements CoverageCalculator
Abstract implementation of a CoverageCalculator, providing
some utility method implementations and synchronization primitives.
- Author:
- Lennart Jörelid, jGuru Europe AB
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractCoverageCalculator
public AbstractCoverageCalculator()
getCoverageRate
public final Rate getCoverageRate(SourceLocationFilter filter,
CoverageType type)
- Retrieves the coverage rate for the supplied CoverageType.
- Specified by:
getCoverageRate in interface CoverageCalculator
- Parameters:
filter - The SourceLocationFilter defining which CoverageRecords should be
included in the retrieved Rate.type - The CoverageType for which coverage is desired.
- Returns:
- the coverage Rate for the given CoverageType.
getRate
protected abstract Rate getRate(SourceLocationFilter nonNullFilter,
CoverageType nonNullCoverageType)
- Retrieves the coverage rate for the supplied CoverageType.
The getRate method should be implemented to be atomic/synchronized, in regards
to any call to the addExecutionStep methods. In plain english, the internal state of this
AbstractCoverageCalculator subclass must be permitted to complete changing its internal
storage state before enabling the
getRate method to calculate its value.
- Parameters:
nonNullCoverageType - The CoverageType for which coverage is desired. Guaranteed not to be null.nonNullFilter - The SourceLocationFilter instance used to filter out all relevant CoverageRate
object on record, and collect a correct Rate from them all.
- Returns:
- the coverage Rate for the given CoverageType.
getCoverage
public final double getCoverage(SourceLocationFilter filter,
CoverageType type)
- Convenience method, retrieving Coverage rate as a supplied type
- Specified by:
getCoverage in interface CoverageCalculator
- Parameters:
filter - The SourceLocationFilter defining which CoverageRecords should be
included in the retrieved Rate.type - The CoverageType for which coverage is desired.
- Returns:
- the coverage, given as a value between 0 and 1.
Copyright © 2013–2015 Cobertura. All rights reserved.