org.sonar.api.batch
Class AbstractDivisionDecorator

java.lang.Object
  extended by org.sonar.api.batch.AbstractDivisionDecorator
All Implemented Interfaces:
CheckProject, Decorator, BatchComponent, BatchExtension, Extension

public abstract class AbstractDivisionDecorator
extends Object
implements Decorator

A pre-implementation to decorate metrics that are the result of a division

Since:
1.10

Constructor Summary
AbstractDivisionDecorator()
           
 
Method Summary
protected  double compute(Measure dividend, Measure divisor, boolean shouldResultBeInPercent)
           
 void decorate(Resource resource, DecoratorContext context)
          
 List<Metric> dependsUponMetrics()
          Used to define upstream dependencies
 Metric generatesMetric()
          Used to define downstream dependencies
protected abstract  Metric getDividendMetric()
           
protected abstract  Metric getDivisorMetric()
           
protected abstract  Metric getQuotientMetric()
           
protected  boolean shouldDecorateResource(DecoratorContext context)
           
 boolean shouldExecuteOnProject(Project project)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDivisionDecorator

public AbstractDivisionDecorator()
Method Detail

getQuotientMetric

protected abstract Metric getQuotientMetric()

getDivisorMetric

protected abstract Metric getDivisorMetric()

getDividendMetric

protected abstract Metric getDividendMetric()

dependsUponMetrics

public List<Metric> dependsUponMetrics()
Used to define upstream dependencies


generatesMetric

public Metric generatesMetric()
Used to define downstream dependencies


shouldExecuteOnProject

public boolean shouldExecuteOnProject(Project project)

Specified by:
shouldExecuteOnProject in interface CheckProject

decorate

public void decorate(Resource resource,
                     DecoratorContext context)

Specified by:
decorate in interface Decorator
Parameters:
resource - resource that is currently decorated, equivalent of context.getResource()

shouldDecorateResource

protected boolean shouldDecorateResource(DecoratorContext context)

compute

protected double compute(Measure dividend,
                         Measure divisor,
                         boolean shouldResultBeInPercent)


Copyright © 2009–2015 SonarSource. All rights reserved.