Package org.sonar.api.ce.measure
Class RangeDistributionBuilder
- java.lang.Object
-
- org.sonar.api.ce.measure.RangeDistributionBuilder
-
public class RangeDistributionBuilder extends java.lang.Object
Utility to build a distribution based on defined rangesAn example of usage : you wish to record the percentage of lines of code that belong to method with pre-defined ranges of complexity.
- Since:
- 5.2
-
-
Constructor Summary
Constructors Constructor Description RangeDistributionBuilder()
RangeDistributionBuilder(java.lang.Number[] bottomLimits)
RangeDistributionBuilder for a defined range Each entry is initialized at zero
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RangeDistributionBuilder
add(java.lang.Number value)
Increments an entry by 1RangeDistributionBuilder
add(java.lang.Number value, int count)
Increments an entryRangeDistributionBuilder
add(java.lang.String data)
Adds an existing Distribution to the current one.java.lang.String
build()
Used to build a measure from the current objectboolean
isEmpty()
-
-
-
Constructor Detail
-
RangeDistributionBuilder
public RangeDistributionBuilder()
-
RangeDistributionBuilder
public RangeDistributionBuilder(java.lang.Number[] bottomLimits)
RangeDistributionBuilder for a defined range Each entry is initialized at zero- Parameters:
bottomLimits
- the bottom limits of ranges to be used
-
-
Method Detail
-
add
public RangeDistributionBuilder add(java.lang.Number value)
Increments an entry by 1- Parameters:
value
- the value to use to pick the entry to increment
-
add
public RangeDistributionBuilder add(java.lang.Number value, int count)
Increments an entry- Parameters:
value
- the value to use to pick the entry to incrementcount
- the number by which to increment
-
add
public RangeDistributionBuilder add(java.lang.String data)
Adds an existing Distribution to the current one. It will create the entries if they don't exist. Can be used to add the values of children resources for example
The returned distribution will be invalidated in case the given value does not use the same bottom limits- Parameters:
data
- the data to add to the current one
-
isEmpty
public boolean isEmpty()
- Returns:
- whether the current object is empty or not
-
build
@CheckForNull public java.lang.String build()
Used to build a measure from the current object- Returns:
- the built measure
-
-