org.sonar.api.measures
Class RangeDistributionBuilder

java.lang.Object
  extended by org.sonar.api.measures.RangeDistributionBuilder
All Implemented Interfaces:
MeasureBuilder

public class RangeDistributionBuilder
extends Object
implements MeasureBuilder

An utility to build a range distribution based on 2 criteria: one is measure, the other one is recorded.

An example of usage : you wish to save the number of lines that belong to methods that have complexity belonging to certain ranges.

Since:
1.10

Constructor Summary
RangeDistributionBuilder(Metric metric, Number[] bottomLimits)
          RangeDistributionBuilder for a metric and a defined range
 
Method Summary
 RangeDistributionBuilder add(Measure measure)
           
 RangeDistributionBuilder add(Number object)
          Add 1 to the range object belongs to
 RangeDistributionBuilder add(Number object, int count)
           
 Measure build()
           
 Measure build(boolean allowEmptyData)
           
 RangeDistributionBuilder clear()
           
 Number[] getBottomLimits()
          Gets the defined bottom limits
 boolean isEmpty()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RangeDistributionBuilder

public RangeDistributionBuilder(Metric metric,
                                Number[] bottomLimits)
RangeDistributionBuilder for a metric and a defined range

Parameters:
metric - the metric for the measure being built
bottomLimits - the bottom limits for lookup
Method Detail

getBottomLimits

public Number[] getBottomLimits()
Gets the defined bottom limits

Returns:
the bottom limits of defined range for the distribution

add

public RangeDistributionBuilder add(Number object)
Add 1 to the range object belongs to

Parameters:
object - the Number to use to pick the range
Returns:
this

add

public RangeDistributionBuilder add(Number object,
                                    int count)

add

public RangeDistributionBuilder add(Measure measure)

clear

public RangeDistributionBuilder clear()

isEmpty

public boolean isEmpty()

build

public Measure build()
Specified by:
build in interface MeasureBuilder

build

public Measure build(boolean allowEmptyData)


Copyright © 2009 SonarSource SA. All Rights Reserved.