org.sonar.api.measures.Metric.equals()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(11.2k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中org.sonar.api.measures.Metric.equals()方法的一些代码示例,展示了Metric.equals()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metric.equals()方法的具体详情如下:
包路径:org.sonar.api.measures.Metric
类名称:Metric
方法名:equals

Metric.equals介绍

暂无

代码示例

代码示例来源:origin: org.codehaus.sonar/sonar-batch

@Override
public boolean equals(Object o) {
 if (this == o) {
  return true;
 }
 if (o == null || getClass() != o.getClass()) {
  return false;
 }
 FormulaDecorator that = (FormulaDecorator) o;
 return !(metric != null ? !metric.equals(that.metric) : that.metric != null);
}

代码示例来源:origin: org.codehaus.sonar-plugins/sonar-web-plugin

public Measure getMeasure(Metric metric) {
 for (Measure measure : measures) {
  if (measure.getMetric().equals(metric)) {
   return measure;
  }
 }
 return null;
}

代码示例来源:origin: org.codehaus.sonar/sonar-plugin-api

@Override
 public Measure filter(Collection<Measure> measures) {
  if (measures == null) {
   return null;
  }
  for (Measure measure : measures) {
   if (measure.getClass().equals(Measure.class) &&
    measure.getMetric().equals(metric) &&
    measure.getPersonId() == null &&
    isSameRequirement(measure, requirement)) {
    return measure;
   }
  }
  return null;
 }
};

代码示例来源:origin: org.codehaus.sonar/sonar-plugin-api

@Override
 public Measure filter(Collection<Measure> measures) {
  if (measures == null) {
   return null;
  }
  for (Measure measure : measures) {
   if (measure.getClass().equals(Measure.class) &&
    measure.getMetric().equals(metric) &&
    measure.getPersonId() == null &&
    isSameCharacteristic(measure, characteristic)) {
    return measure;
   }
  }
  return null;
 }
};

代码示例来源:origin: org.codehaus.sonar/sonar-plugin-api

private boolean apply(Measure measure) {
 return measure instanceof RuleMeasure && metric.equals(measure.getMetric())
  && measure.getPersonId() == null && ((RuleMeasure) measure).ruleKey() != null;
}

代码示例来源:origin: Stratio/sonar-scala-plugin

private Measure convertForOverall(Measure measure) {
    Measure itMeasure = null;
    if (CoreMetrics.LINES_TO_COVER.equals(measure.getMetric())) {
      itMeasure = new Measure(CoreMetrics.OVERALL_LINES_TO_COVER, measure.getValue());
    } else if (CoreMetrics.UNCOVERED_LINES.equals(measure.getMetric())) {
      itMeasure = new Measure(CoreMetrics.OVERALL_UNCOVERED_LINES, measure.getValue());
    } else if (CoreMetrics.COVERAGE_LINE_HITS_DATA.equals(measure.getMetric())) {
      itMeasure = new Measure(CoreMetrics.OVERALL_COVERAGE_LINE_HITS_DATA, measure.getData());
    } else if (CoreMetrics.CONDITIONS_TO_COVER.equals(measure.getMetric())) {
      itMeasure = new Measure(CoreMetrics.OVERALL_CONDITIONS_TO_COVER, measure.getValue());
    } else if (CoreMetrics.UNCOVERED_CONDITIONS.equals(measure.getMetric())) {
      itMeasure = new Measure(CoreMetrics.OVERALL_UNCOVERED_CONDITIONS, measure.getValue());
    } else if (CoreMetrics.COVERED_CONDITIONS_BY_LINE.equals(measure.getMetric())) {
      itMeasure = new Measure(CoreMetrics.OVERALL_COVERED_CONDITIONS_BY_LINE, measure.getData());
    } else if (CoreMetrics.CONDITIONS_BY_LINE.equals(measure.getMetric())) {
      itMeasure = new Measure(CoreMetrics.OVERALL_CONDITIONS_BY_LINE, measure.getData());
    }
    return itMeasure;
  }
}

代码示例来源:origin: org.codehaus.sonar-plugins.java/java-jacoco

private Measure convertForOverall(Measure measure) {
  Measure itMeasure = null;
  if (CoreMetrics.LINES_TO_COVER.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.OVERALL_LINES_TO_COVER, measure.getValue());
  } else if (CoreMetrics.UNCOVERED_LINES.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.OVERALL_UNCOVERED_LINES, measure.getValue());
  } else if (CoreMetrics.COVERAGE_LINE_HITS_DATA.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.OVERALL_COVERAGE_LINE_HITS_DATA, measure.getData());
  } else if (CoreMetrics.CONDITIONS_TO_COVER.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.OVERALL_CONDITIONS_TO_COVER, measure.getValue());
  } else if (CoreMetrics.UNCOVERED_CONDITIONS.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.OVERALL_UNCOVERED_CONDITIONS, measure.getValue());
  } else if (CoreMetrics.COVERED_CONDITIONS_BY_LINE.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.OVERALL_COVERED_CONDITIONS_BY_LINE, measure.getData());
  } else if (CoreMetrics.CONDITIONS_BY_LINE.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.OVERALL_CONDITIONS_BY_LINE, measure.getData());
  }
  return itMeasure;
 }
}

代码示例来源:origin: org.codehaus.sonar-plugins.java/java-jacoco

private Measure convertForIT(Measure measure) {
  Measure itMeasure = null;
  if (CoreMetrics.LINES_TO_COVER.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.IT_LINES_TO_COVER, measure.getValue());
  } else if (CoreMetrics.UNCOVERED_LINES.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.IT_UNCOVERED_LINES, measure.getValue());
  } else if (CoreMetrics.COVERAGE_LINE_HITS_DATA.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.IT_COVERAGE_LINE_HITS_DATA, measure.getData());
  } else if (CoreMetrics.CONDITIONS_TO_COVER.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.IT_CONDITIONS_TO_COVER, measure.getValue());
  } else if (CoreMetrics.UNCOVERED_CONDITIONS.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.IT_UNCOVERED_CONDITIONS, measure.getValue());
  } else if (CoreMetrics.COVERED_CONDITIONS_BY_LINE.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.IT_COVERED_CONDITIONS_BY_LINE, measure.getData());
  } else if (CoreMetrics.CONDITIONS_BY_LINE.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.IT_CONDITIONS_BY_LINE, measure.getData());
  }
  return itMeasure;
 }
}

代码示例来源:origin: org.codehaus.sonar-plugins.java/sonar-jacoco-plugin

private Measure convertForOverall(Measure measure) {
  Measure itMeasure = null;
  if (CoreMetrics.LINES_TO_COVER.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.OVERALL_LINES_TO_COVER, measure.getValue());
  } else if (CoreMetrics.UNCOVERED_LINES.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.OVERALL_UNCOVERED_LINES, measure.getValue());
  } else if (CoreMetrics.COVERAGE_LINE_HITS_DATA.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.OVERALL_COVERAGE_LINE_HITS_DATA, measure.getData());
  } else if (CoreMetrics.CONDITIONS_TO_COVER.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.OVERALL_CONDITIONS_TO_COVER, measure.getValue());
  } else if (CoreMetrics.UNCOVERED_CONDITIONS.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.OVERALL_UNCOVERED_CONDITIONS, measure.getValue());
  } else if (CoreMetrics.COVERED_CONDITIONS_BY_LINE.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.OVERALL_COVERED_CONDITIONS_BY_LINE, measure.getData());
  } else if (CoreMetrics.CONDITIONS_BY_LINE.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.OVERALL_CONDITIONS_BY_LINE, measure.getData());
  }
  return itMeasure;
 }
}

代码示例来源:origin: org.codehaus.sonar-plugins.java/sonar-jacoco-plugin

private Measure convertForIT(Measure measure) {
  Measure itMeasure = null;
  if (CoreMetrics.LINES_TO_COVER.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.IT_LINES_TO_COVER, measure.getValue());
  } else if (CoreMetrics.UNCOVERED_LINES.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.IT_UNCOVERED_LINES, measure.getValue());
  } else if (CoreMetrics.COVERAGE_LINE_HITS_DATA.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.IT_COVERAGE_LINE_HITS_DATA, measure.getData());
  } else if (CoreMetrics.CONDITIONS_TO_COVER.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.IT_CONDITIONS_TO_COVER, measure.getValue());
  } else if (CoreMetrics.UNCOVERED_CONDITIONS.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.IT_UNCOVERED_CONDITIONS, measure.getValue());
  } else if (CoreMetrics.COVERED_CONDITIONS_BY_LINE.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.IT_COVERED_CONDITIONS_BY_LINE, measure.getData());
  } else if (CoreMetrics.CONDITIONS_BY_LINE.equals(measure.getMetric())) {
   itMeasure = new Measure(CoreMetrics.IT_CONDITIONS_BY_LINE, measure.getData());
  }
  return itMeasure;
 }
}

代码示例来源:origin: Stratio/sonar-scala-plugin

private Measure convertForIT(Measure measure) {
    Measure itMeasure = null;
    if (CoreMetrics.LINES_TO_COVER.equals(measure.getMetric())) {
      itMeasure = new Measure(CoreMetrics.IT_LINES_TO_COVER, measure.getValue());
    } else if (CoreMetrics.UNCOVERED_LINES.equals(measure.getMetric())) {
      itMeasure = new Measure(CoreMetrics.IT_UNCOVERED_LINES, measure.getValue());
    } else if (CoreMetrics.COVERAGE_LINE_HITS_DATA.equals(measure.getMetric())) {
      itMeasure = new Measure(CoreMetrics.IT_COVERAGE_LINE_HITS_DATA, measure.getData());
    } else if (CoreMetrics.CONDITIONS_TO_COVER.equals(measure.getMetric())) {
      itMeasure = new Measure(CoreMetrics.IT_CONDITIONS_TO_COVER, measure.getValue());
    } else if (CoreMetrics.UNCOVERED_CONDITIONS.equals(measure.getMetric())) {
      itMeasure = new Measure(CoreMetrics.IT_UNCOVERED_CONDITIONS, measure.getValue());
    } else if (CoreMetrics.COVERED_CONDITIONS_BY_LINE.equals(measure.getMetric())) {
      itMeasure = new Measure(CoreMetrics.IT_COVERED_CONDITIONS_BY_LINE, measure.getData());
    } else if (CoreMetrics.CONDITIONS_BY_LINE.equals(measure.getMetric())) {
      itMeasure = new Measure(CoreMetrics.IT_CONDITIONS_BY_LINE, measure.getData());
    }
    return itMeasure;
  }
}

代码示例来源:origin: fr.sii.sonar/sonar-report-core

/**
 * Copied from Java plugin... This is how they handle it...
 * 
 * @param measure
 * @return converted measure
 */
private Measure convertForOverall(Measure measure) {
  Measure itMeasure = null;
  if (CoreMetrics.LINES_TO_COVER.equals(measure.getMetric())) {
    itMeasure = new Measure(CoreMetrics.OVERALL_LINES_TO_COVER, measure.getValue());
  } else if (CoreMetrics.UNCOVERED_LINES.equals(measure.getMetric())) {
    itMeasure = new Measure(CoreMetrics.OVERALL_UNCOVERED_LINES, measure.getValue());
  } else if (CoreMetrics.COVERAGE_LINE_HITS_DATA.equals(measure.getMetric())) {
    itMeasure = new Measure(CoreMetrics.OVERALL_COVERAGE_LINE_HITS_DATA, measure.getData());
  } else if (CoreMetrics.CONDITIONS_TO_COVER.equals(measure.getMetric())) {
    itMeasure = new Measure(CoreMetrics.OVERALL_CONDITIONS_TO_COVER, measure.getValue());
  } else if (CoreMetrics.UNCOVERED_CONDITIONS.equals(measure.getMetric())) {
    itMeasure = new Measure(CoreMetrics.OVERALL_UNCOVERED_CONDITIONS, measure.getValue());
  } else if (CoreMetrics.COVERED_CONDITIONS_BY_LINE.equals(measure.getMetric())) {
    itMeasure = new Measure(CoreMetrics.OVERALL_COVERED_CONDITIONS_BY_LINE, measure.getData());
  } else if (CoreMetrics.CONDITIONS_BY_LINE.equals(measure.getMetric())) {
    itMeasure = new Measure(CoreMetrics.OVERALL_CONDITIONS_BY_LINE, measure.getData());
  }
  return itMeasure;
}

代码示例来源:origin: fr.sii.sonar/sonar-report-core

/**
 * Copied from Java plugin... This is how they handle it...
 * 
 * @param measure
 * @return converted measure
 */
private Measure convertForIT(Measure measure) {
  Measure itMeasure = null;
  if (CoreMetrics.LINES_TO_COVER.equals(measure.getMetric())) {
    itMeasure = new Measure(CoreMetrics.IT_LINES_TO_COVER, measure.getValue());
  } else if (CoreMetrics.UNCOVERED_LINES.equals(measure.getMetric())) {
    itMeasure = new Measure(CoreMetrics.IT_UNCOVERED_LINES, measure.getValue());
  } else if (CoreMetrics.COVERAGE_LINE_HITS_DATA.equals(measure.getMetric())) {
    itMeasure = new Measure(CoreMetrics.IT_COVERAGE_LINE_HITS_DATA, measure.getData());
  } else if (CoreMetrics.CONDITIONS_TO_COVER.equals(measure.getMetric())) {
    itMeasure = new Measure(CoreMetrics.IT_CONDITIONS_TO_COVER, measure.getValue());
  } else if (CoreMetrics.UNCOVERED_CONDITIONS.equals(measure.getMetric())) {
    itMeasure = new Measure(CoreMetrics.IT_UNCOVERED_CONDITIONS, measure.getValue());
  } else if (CoreMetrics.COVERED_CONDITIONS_BY_LINE.equals(measure.getMetric())) {
    itMeasure = new Measure(CoreMetrics.IT_COVERED_CONDITIONS_BY_LINE, measure.getData());
  } else if (CoreMetrics.CONDITIONS_BY_LINE.equals(measure.getMetric())) {
    itMeasure = new Measure(CoreMetrics.IT_CONDITIONS_BY_LINE, measure.getData());
  }
  return itMeasure;
}

相关文章