1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.math4.legacy.stat.descriptive;
18
19 import org.apache.commons.math4.legacy.exception.MathIllegalArgumentException;
20 import org.apache.commons.math4.legacy.exception.NullArgumentException;
21
22
23
24
25
26
27
28
29
30
31
32
33
34 public class SynchronizedDescriptiveStatistics extends DescriptiveStatistics {
35
36
37
38 public SynchronizedDescriptiveStatistics() {
39
40 this(INFINITE_WINDOW);
41 }
42
43
44
45
46
47
48
49 public SynchronizedDescriptiveStatistics(int window) throws MathIllegalArgumentException {
50 super(window);
51 }
52
53
54
55
56
57
58
59 public SynchronizedDescriptiveStatistics(SynchronizedDescriptiveStatistics original)
60 throws NullArgumentException {
61 copy(original, this);
62 }
63
64
65
66
67 @Override
68 public synchronized void addValue(double v) {
69 super.addValue(v);
70 }
71
72
73
74
75 @Override
76 public synchronized double apply(UnivariateStatistic stat) {
77 return super.apply(stat);
78 }
79
80
81
82
83 @Override
84 public synchronized void clear() {
85 super.clear();
86 }
87
88
89
90
91 @Override
92 public synchronized double getElement(int index) {
93 return super.getElement(index);
94 }
95
96
97
98
99 @Override
100 public synchronized long getN() {
101 return super.getN();
102 }
103
104
105
106
107 @Override
108 public synchronized double getStandardDeviation() {
109 return super.getStandardDeviation();
110 }
111
112
113
114
115 @Override
116 public synchronized double getQuadraticMean() {
117 return super.getQuadraticMean();
118 }
119
120
121
122
123 @Override
124 public synchronized double[] getValues() {
125 return super.getValues();
126 }
127
128
129
130
131 @Override
132 public synchronized int getWindowSize() {
133 return super.getWindowSize();
134 }
135
136
137
138
139 @Override
140 public synchronized void setWindowSize(int windowSize) throws MathIllegalArgumentException {
141 super.setWindowSize(windowSize);
142 }
143
144
145
146
147 @Override
148 public synchronized String toString() {
149 return super.toString();
150 }
151
152
153
154
155
156
157
158 @Override
159 public synchronized SynchronizedDescriptiveStatistics copy() {
160 SynchronizedDescriptiveStatistics result =
161 new SynchronizedDescriptiveStatistics();
162
163 copy(this, result);
164 return result;
165 }
166
167
168
169
170
171
172
173
174
175
176 public static void copy(SynchronizedDescriptiveStatistics source,
177 SynchronizedDescriptiveStatistics dest)
178 throws NullArgumentException {
179 NullArgumentException.check(source);
180 NullArgumentException.check(dest);
181 synchronized (source) {
182 synchronized (dest) {
183 DescriptiveStatistics.copy(source, dest);
184 }
185 }
186 }
187 }