Commit 50f6dfa7 authored by Matija Obreza's avatar Matija Obreza

PDCIStatistics using Numbers for input

parent 1b59e1f0
......@@ -26,39 +26,39 @@ public class PDCIStatistics implements Serializable {
private static final long serialVersionUID = -3576941362217038857L;
private Float min = null;
private Float max = null;
private Double min = null;
private Double max = null;
private Double avg = null;
private long[] histogram = new long[21];
private Long count;
public void setMin(Float value) {
this.min = value;
public void setMin(Number value) {
this.min = value == null ? null : value.doubleValue();
}
public Float getMin() {
public Double getMin() {
return min;
}
public void setMax(Float value) {
this.max = value;
public void setMax(Number value) {
this.max = value == null ? null : value.doubleValue();
}
public Float getMax() {
public Double getMax() {
return max;
}
public void setAvg(Double value) {
this.avg = value;
public void setAvg(Number value) {
this.avg = value == null ? null : value.doubleValue();
}
public Double getAvg() {
return avg;
}
public void setCount(Long value) {
this.count = value;
public void setCount(Number value) {
this.count = value == null ? 0 : value.longValue();
}
public Long getCount() {
......@@ -120,10 +120,10 @@ public class PDCIStatistics implements Serializable {
this.max = this.max == null || this.max.floatValue() < updateMax ? updateMax : this.max;
}
public void updateCountAndAvg(Long count, Double avg) {
public void updateCountAndAvg(Long count, Number avg) {
if (count == null || count == 0 || avg == null)
return;
this.avg = this.avg == null || this.count == null || this.count == 0 ? avg : (this.avg * this.count + avg * count) / (this.count + count);
this.avg = this.avg == null || this.count == null || this.count == 0 ? avg.doubleValue() : (this.avg * this.count + avg.doubleValue() * count) / (this.count + count);
this.count = this.count==null ? count : this.count + count;
}
......
......@@ -1443,8 +1443,8 @@ public class GenesysServiceImpl implements GenesysService, DatasetService {
// System.err.println(overall[2].getClass());
// System.err.println(overall[3].getClass());
stats.setMin((Float) overall[0]);
stats.setMax((Float) overall[1]);
stats.setMin((Double) overall[0]);
stats.setMax((Double) overall[1]);
stats.setAvg((Double) overall[2]);
stats.setCount((Long) overall[3]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment