SimpleMeasurement.java

biz/hammurapi/metrics/SimpleMeasurement.java

Violations

Inspector Message Severity Location
Java Inspector 048 Copyrights information should be present in each file. 1
Java Inspector 089 Undocumented constructor 2 17:9
Java Inspector 089 Undocumented constructor 2 22:9
Java Inspector 089 Undocumented method 2 27:9
Java Inspector 089 Undocumented method 2 31:9
Java Inspector 089 Undocumented method 2 35:9
Java Inspector 026 Avoid hardwired string literals. Allowed literals: [] 3 36:24
Java Inspector 026 Avoid hardwired string literals. Allowed literals: [] 3 36:49
Java Inspector 026 Avoid hardwired string literals. Allowed literals: [] 3 36:66
Java Inspector 051 It is good practice to call in any case super() in a constructor. 3 17:9
Java Inspector 051 It is good practice to call in any case super() in a constructor. 3 22:9

Source code

1package biz.hammurapi.metrics;
2
3import java.io.Serializable;
4import java.util.Date;
5
6import biz.hammurapi.metrics.Metric.Measurement;
7
8/**
9 * Measurement serializable value object.
10 * @author Pavel
11 */
12public class SimpleMeasurement implements Measurement, Serializable {
13
14 private long time;
15 private double value;
16
17 public SimpleMeasurement(long time, double value) {
18 this.time = time;
19 this.value = value;
20 }
21
22 public SimpleMeasurement(Measurement master) {
23 this.time=master.getTime();
24 this.value=master.getValue();
25 }
26
27 public long getTime() {
28 return time;
29 }
30
31 public double getValue() {
32 return value;
33 }
34
35 public String toString() {
36 return "["+getClass().getName()+"] value="+value+", time="+new Date();
37 }
38
39}
40