Class FractionValue
- java.lang.Object
-
- com.parasoft.findings.jenkins.coverage.model.Value
-
- com.parasoft.findings.jenkins.coverage.model.FractionValue
-
- All Implemented Interfaces:
Serializable
public final class FractionValue extends Value
Represents the value of a rational number based metric. Internally the rational number is stored using aFraction
instance.- Author:
- Ullrich Hafner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FractionValue(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Value
add(Value other)
Add the coverage from the specified instance to the coverage of this instance.org.apache.commons.lang3.math.Fraction
delta(Value other)
Computes the delta of this value with the specified value.boolean
equals(Object o)
org.apache.commons.lang3.math.Fraction
getFraction()
int
hashCode()
boolean
isOutOfValidRange(double threshold)
Returns whether this fraction is out of the valid range.Value
max(Value other)
Merge this coverage with the specified coverage.String
serialize()
Serializes this instance into a String.String
toString()
-
-
-
Constructor Detail
-
FractionValue
public FractionValue(Metric metric, org.apache.commons.lang3.math.Fraction fraction)
Creates a newFractionValue
with the specified value for the given metric.- Parameters:
metric
- the coverage metricfraction
- the value to store
-
FractionValue
public FractionValue(Metric metric, int numerator, int denominator)
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 Detail
-
getFraction
public org.apache.commons.lang3.math.Fraction getFraction()
-
add
public Value add(Value other)
Description copied from class:Value
Add the coverage from the specified instance to the coverage of this instance.
-
delta
public org.apache.commons.lang3.math.Fraction delta(Value other)
Description copied from class:Value
Computes the delta of this value with the specified value.
-
max
public Value max(Value other)
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
)
-
serialize
public String serialize()
Description copied from class:Value
Serializes this instance into a String.
-
-