Class FractionValue
java.lang.Object
com.parasoft.findings.jenkins.coverage.model.Value
com.parasoft.findings.jenkins.coverage.model.FractionValue
- All Implemented Interfaces:
Serializable
Represents the value of a rational number based metric. Internally the rational number is stored using a
Fraction
instance.- Author:
- Ullrich Hafner
- See Also:
-
Constructor Summary
ConstructorDescriptionFractionValue
(Metric metric, int numerator, int denominator) Creates a newFractionValue
from the specified counters for the given metric.FractionValue
(Metric metric, org.apache.commons.lang3.math.Fraction fraction) Creates a newFractionValue
with the specified value for the given metric. -
Method Summary
Modifier and TypeMethodDescriptionAdd the coverage from the specified instance to the coverage of this instance.org.apache.commons.lang3.math.Fraction
Computes the delta of this value with the specified value.boolean
org.apache.commons.lang3.math.Fraction
int
hashCode()
boolean
isOutOfValidRange
(double threshold) Returns whether this fraction is out of the valid range.Merge this coverage with the specified coverage.Serializes this instance into a String.toString()
-
Constructor Details
-
FractionValue
Creates a newFractionValue
with the specified value for the given metric.- Parameters:
metric
- the coverage metricfraction
- the value to store
-
FractionValue
Creates a newFractionValue
from the specified counters for the given metric.- Parameters:
metric
- the coverage metricnumerator
- the numerator of the rational numberdenominator
- the denominator of the rational number
-
-
Method Details
-
getFraction
public org.apache.commons.lang3.math.Fraction getFraction() -
add
Description copied from class:Value
Add the coverage from the specified instance to the coverage of this instance. -
delta
Description copied from class:Value
Computes the delta of this value with the specified value. -
max
Description copied from class:Value
Merge this coverage with the specified coverage. -
isOutOfValidRange
public boolean isOutOfValidRange(double threshold) Returns whether this fraction is out of the valid range. For values that have a metric that is getting better when values are increasing (e.g., coverage), the method will returntrue
if the fraction value is smaller than the threshold. For values that have a metric that is getting better when values are decreasing (e.g., complexity), the method will returntrue
if the fraction value is larger than the threshold.- Specified by:
isOutOfValidRange
in classValue
- Parameters:
threshold
- the threshold to compare with- Returns:
true
, if this value is larger or smaller than specified threshold (seeMetric.MetricTendency
)
-
toString
-
serialize
Description copied from class:Value
Serializes this instance into a String. -
equals
-
hashCode
public int hashCode()
-