1 package com.stateofflow.eclipse.metrics.metric;
2
3 import com.stateofflow.eclipse.metrics.location.MetricLocation;
4
5 public final class Metric {
6 private final MetricLocation location;
7 private final MetricId id;
8 private final int value;
9 private int aggregationSteps;
10
11 public Metric(final MetricId id, final MetricLocation location, final int value) {
12 this.location = location;
13 this.id = id;
14 this.value = value;
15 }
16
17 public Metric(final MetricLocation location, final Metric derivedFrom) {
18 this(derivedFrom.getId(), location, derivedFrom.value);
19 aggregationSteps = derivedFrom.aggregationSteps + 1;
20 }
21
22 public MetricId getId() {
23 return id;
24 }
25
26 public MetricLocation getLocation() {
27 return location;
28 }
29
30 public int getValue() {
31 return value;
32 }
33
34 public int getAggregationSteps() {
35 return aggregationSteps;
36 }
37
38 public String toString() {
39 return id + ", location=(" + location.toString() + "), value=" + value;
40 }
41 }
42