1 package com.stateofflow.eclipse.metrics.collator;
2
3 import com.stateofflow.eclipse.metrics.util.ProgressMonitor;
4
5 public final class MetricsCollatorSet {
6 private final MetricsCollator typeMetricsCollator;
7 private final MetricsCollator methodMetricsCollator;
8 private final MetricsCollator packageMetricsCollator;
9
10 public MetricsCollatorSet(final MetricsCollator methodMetricsCollator, final MetricsCollator typeMetricsCollator, final MetricsCollator packageMetricsCollator) {
11 this.methodMetricsCollator = methodMetricsCollator;
12 this.typeMetricsCollator = typeMetricsCollator;
13 this.packageMetricsCollator = packageMetricsCollator;
14 }
15
16 public MetricsCollator getMethodMetrics() {
17 return methodMetricsCollator;
18 }
19
20 public MetricsCollator getTypeMetrics() {
21 return typeMetricsCollator;
22 }
23
24 public MetricsCollator getPackageMetrics() {
25 return packageMetricsCollator;
26 }
27
28 public void aggregate(final ProgressMonitor progressMonitor) {
29 progressMonitor.beginTask("Aggregating metrics", 2);
30 final MetricAggregator metricAggregator = new MetricAggregator();
31 metricAggregator.aggregate(typeMetricsCollator, methodMetricsCollator, progressMonitor.newChild(1));
32 metricAggregator.aggregate(packageMetricsCollator, typeMetricsCollator, progressMonitor.newChild(1));
33 }
34
35 public int getNumberOfMethodAndTypeMetrics() {
36 return methodMetricsCollator.getNumberOfMetrics() + typeMetricsCollator.getNumberOfMetrics();
37 }
38 }
39