1 package org.kuali.common.devops.jenkins.scan;
2
3 import org.kuali.common.core.build.ValidatingBuilder;
4 import org.kuali.common.core.validate.annotation.IdiotProofImmutable;
5
6 @IdiotProofImmutable
7 public final class SummaryStatistics {
8
9 private final double min;
10 private final double max;
11 private final double avg;
12 private final double sum;
13 private final double standardDeviation;
14 private final double variance;
15 private final long count;
16
17 private SummaryStatistics(Builder builder) {
18 this.min = builder.min;
19 this.max = builder.max;
20 this.avg = builder.avg;
21 this.sum = builder.sum;
22 this.standardDeviation = builder.standardDeviation;
23 this.variance = builder.variance;
24 this.count = builder.count;
25 }
26
27 public static Builder builder() {
28 return new Builder();
29 }
30
31 public static class Builder extends ValidatingBuilder<SummaryStatistics> {
32
33 private double min;
34 private double max;
35 private double sum;
36 private double avg;
37 private double standardDeviation;
38 private double variance;
39 private long count;
40
41 public Builder withMin(double min) {
42 this.min = min;
43 return this;
44 }
45
46 public Builder withMax(double max) {
47 this.max = max;
48 return this;
49 }
50
51 public Builder withSum(double sum) {
52 this.sum = sum;
53 return this;
54 }
55
56 public Builder withAvg(double avg) {
57 this.avg = avg;
58 return this;
59 }
60
61 public Builder withStandardDeviation(double standardDeviation) {
62 this.standardDeviation = standardDeviation;
63 return this;
64 }
65
66 public Builder withVariance(double variance) {
67 this.variance = variance;
68 return this;
69 }
70
71 public Builder withCount(long count) {
72 this.count = count;
73 return this;
74 }
75
76 @Override
77 public SummaryStatistics build() {
78 return validate(new SummaryStatistics(this));
79 }
80 }
81
82 public double getMin() {
83 return min;
84 }
85
86 public double getMax() {
87 return max;
88 }
89
90 public double getSum() {
91 return sum;
92 }
93
94 public double getAvg() {
95 return avg;
96 }
97
98 public double getStandardDeviation() {
99 return standardDeviation;
100 }
101
102 public double getVariance() {
103 return variance;
104 }
105
106 public long getCount() {
107 return count;
108 }
109
110 }