AItest
/
111.java
50 строк · 1.1 Кб
1
2if (x > max) {
3max = x;
4}
5}
6
7public long numSamples() {
8return mN;
9}
10
11public double mean() {
12return mM;
13}
14
15public double variance() {
16return mN > 1 ? mS / mN : 0.0;
17}
18
19public double varianceUnbiased() {
20return mN > 1 ? mS / (mN - 1) : 0.0;
21}
22
23public double standardDeviation() {
24return Math.sqrt(variance());
25}
26
27public double standardDeviationUnbiased() {
28return Math.sqrt(varianceUnbiased());
29}
30
31public double min() {
32return min;
33}
34
35public double max() {
36return max;
37}
38
39public double sum() {
40return sum;
41}
42
43private static final Comparator<String> NULL_SAFE_STRING_COMPARATOR = Comparator.nullsFirst(String::compareTo);
44
45@Override
46public int compareTo(Stats stats) {
47return Comparator.comparing(Stats::getX2, NULL_SAFE_STRING_COMPARATOR)
48.thenComparing(Stats::getX1)
49.compare(this, stats);
50}
51}
52