public class CountDistributionBuilder extends Object implements MeasureBuilder
An example of usage : you wish to record the number of violations for each level of rules priority
Constructor and Description |
---|
CountDistributionBuilder(Metric metric)
Creates an empty CountDistributionBuilder for a specified metric
|
Modifier and Type | Method and Description |
---|---|
CountDistributionBuilder |
add(Measure measure)
Adds an existing Distribution to the current one.
|
CountDistributionBuilder |
add(Object value)
Increments an entry by one
|
CountDistributionBuilder |
add(Object value,
int count)
Increments an entry
|
CountDistributionBuilder |
addZero(Object value)
Adds an entry without a zero count if it does not exist
|
Measure |
build()
Shortcut for
build(true) |
Measure |
build(boolean allowEmptyData)
Used to build a measure from the current object
|
CountDistributionBuilder |
clear()
Resets all entries to zero
|
boolean |
isEmpty() |
public CountDistributionBuilder(Metric metric)
metric
- the metricpublic CountDistributionBuilder add(Object value, int count)
value
- the value that should be incrementedcount
- the number by which to incrementpublic CountDistributionBuilder add(Object value)
value
- the value that should be incrementedpublic CountDistributionBuilder addZero(Object value)
value
- the entry to be addedpublic CountDistributionBuilder add(Measure measure)
measure
- the measure to add to the current onepublic boolean isEmpty()
public CountDistributionBuilder clear()
public Measure build()
build(true)
build
in interface MeasureBuilder
Copyright © 2009-2014 SonarSource. All Rights Reserved.