|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sonar.api.measures.AverageFormula
public class AverageFormula
Formula used to compute an average for a given metric A, which is the result of the sum of measures of this metric (A) divided by another metric (B).
For example: to compute the metric "complexity by file", the main metric (A) is "complexity" and the other metric (B) is "file".
Method Summary | |
---|---|
Measure |
calculate(FormulaData data,
FormulaContext context)
|
static AverageFormula |
create(Metric main,
Metric by)
Creates a new AverageFormula class. |
List<Metric> |
dependsUponMetrics()
|
AverageFormula |
setFallbackForMainMetric(Metric fallbackMetric)
Set a fallback metric if no measures found for the main metric. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static AverageFormula create(Metric main, Metric by)
AverageFormula
class.
main
- The metric on which average should be calculated (ex.: "complexity")by
- The metric used to divide the main metric to compute average (ex.: "file" for "complexity by file")public AverageFormula setFallbackForMainMetric(Metric fallbackMetric)
fallbackMetric
- The fallback metricpublic List<Metric> dependsUponMetrics()
dependsUponMetrics
in interface Formula
public Measure calculate(FormulaData data, FormulaContext context)
calculate
in interface Formula
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |