1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 package org.apache.commons.math.stat.descriptive; 18 19 /** 20 * Implementation of 21 * {@link org.apache.commons.math.stat.descriptive.SummaryStatistics} that 22 * is safe to use in a multithreaded environment. Multiple threads can safely 23 * operate on a single instance without causing runtime exceptions due to race 24 * conditions. In effect, this implementation makes modification and access 25 * methods atomic operations for a single instance. That is to say, as one 26 * thread is computing a statistic from the instance, no other thread can modify 27 * the instance nor compute another statistic. 28 * 29 * @since 1.2 30 * @version $Revision: 618097 $ $Date: 2008-02-03 14:39:08 -0700 (Sun, 03 Feb 2008) $ 31 */ 32 public class SynchronizedSummaryStatistics extends SummaryStatistics { 33 34 /** Serialization UID */ 35 private static final long serialVersionUID = 1909861009042253704L; 36 37 /** 38 * Construct a SynchronizedSummaryStatistics instance 39 */ 40 public SynchronizedSummaryStatistics() { 41 super(); 42 } 43 44 /** 45 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#getSummary() 46 */ 47 public synchronized StatisticalSummary getSummary() { 48 return super.getSummary(); 49 } 50 51 /** 52 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#addValue(double) 53 */ 54 public synchronized void addValue(double value) { 55 super.addValue(value); 56 } 57 58 /** 59 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#getN() 60 */ 61 public synchronized long getN() { 62 return super.getN(); 63 } 64 65 /** 66 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#getSum() 67 */ 68 public synchronized double getSum() { 69 return super.getSum(); 70 } 71 72 /** 73 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#getSumsq() 74 */ 75 public synchronized double getSumsq() { 76 return super.getSumsq(); 77 } 78 79 /** 80 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#getMean() 81 */ 82 public synchronized double getMean() { 83 return super.getMean(); 84 } 85 86 /** 87 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#getStandardDeviation() 88 */ 89 public synchronized double getStandardDeviation() { 90 return super.getStandardDeviation(); 91 } 92 93 /** 94 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#getVariance() 95 */ 96 public synchronized double getVariance() { 97 return super.getVariance(); 98 } 99 100 /** 101 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#getMax() 102 */ 103 public synchronized double getMax() { 104 return super.getMax(); 105 } 106 107 /** 108 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#getMin() 109 */ 110 public synchronized double getMin() { 111 return super.getMin(); 112 } 113 114 /** 115 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#getGeometricMean() 116 */ 117 public synchronized double getGeometricMean() { 118 return super.getGeometricMean(); 119 } 120 121 /** 122 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#toString() 123 */ 124 public synchronized String toString() { 125 return super.toString(); 126 } 127 128 /** 129 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#clear() 130 */ 131 public synchronized void clear() { 132 super.clear(); 133 } 134 135 /** 136 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#equals(Object) 137 */ 138 public synchronized boolean equals(Object object) { 139 return super.equals(object); 140 } 141 142 /** 143 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#hashCode() 144 */ 145 public synchronized int hashCode() { 146 return super.hashCode(); 147 } 148 149 /** 150 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#getSumImpl() 151 */ 152 public synchronized StorelessUnivariateStatistic getSumImpl() { 153 return super.getSumImpl(); 154 } 155 156 /** 157 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#setSumImpl(StorelessUnivariateStatistic) 158 */ 159 public synchronized void setSumImpl(StorelessUnivariateStatistic sumImpl) { 160 super.setSumImpl(sumImpl); 161 } 162 163 /** 164 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#getSumsqImpl() 165 */ 166 public synchronized StorelessUnivariateStatistic getSumsqImpl() { 167 return super.getSumsqImpl(); 168 } 169 170 /** 171 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#setSumsqImpl(StorelessUnivariateStatistic) 172 */ 173 public synchronized void setSumsqImpl(StorelessUnivariateStatistic sumsqImpl) { 174 super.setSumsqImpl(sumsqImpl); 175 } 176 177 /** 178 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#getMinImpl() 179 */ 180 public synchronized StorelessUnivariateStatistic getMinImpl() { 181 return super.getMinImpl(); 182 } 183 184 /** 185 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#setMinImpl(StorelessUnivariateStatistic) 186 */ 187 public synchronized void setMinImpl(StorelessUnivariateStatistic minImpl) { 188 super.setMinImpl(minImpl); 189 } 190 191 /** 192 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#getMaxImpl() 193 */ 194 public synchronized StorelessUnivariateStatistic getMaxImpl() { 195 return super.getMaxImpl(); 196 } 197 198 /** 199 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#setMaxImpl(StorelessUnivariateStatistic) 200 */ 201 public synchronized void setMaxImpl(StorelessUnivariateStatistic maxImpl) { 202 super.setMaxImpl(maxImpl); 203 } 204 205 /** 206 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#getSumLogImpl() 207 */ 208 public synchronized StorelessUnivariateStatistic getSumLogImpl() { 209 return super.getSumLogImpl(); 210 } 211 212 /** 213 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#setSumLogImpl(StorelessUnivariateStatistic) 214 */ 215 public synchronized void setSumLogImpl(StorelessUnivariateStatistic sumLogImpl) { 216 super.setSumLogImpl(sumLogImpl); 217 } 218 219 /** 220 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#getGeoMeanImpl() 221 */ 222 public synchronized StorelessUnivariateStatistic getGeoMeanImpl() { 223 return super.getGeoMeanImpl(); 224 } 225 226 /** 227 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#setGeoMeanImpl(StorelessUnivariateStatistic) 228 */ 229 public synchronized void setGeoMeanImpl(StorelessUnivariateStatistic geoMeanImpl) { 230 super.setGeoMeanImpl(geoMeanImpl); 231 } 232 233 /** 234 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#getMeanImpl() 235 */ 236 public synchronized StorelessUnivariateStatistic getMeanImpl() { 237 return super.getMeanImpl(); 238 } 239 240 /** 241 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#setMeanImpl(StorelessUnivariateStatistic) 242 */ 243 public synchronized void setMeanImpl(StorelessUnivariateStatistic meanImpl) { 244 super.setMeanImpl(meanImpl); 245 } 246 247 /** 248 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#getVarianceImpl() 249 */ 250 public synchronized StorelessUnivariateStatistic getVarianceImpl() { 251 return super.getVarianceImpl(); 252 } 253 254 /** 255 * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#setVarianceImpl(StorelessUnivariateStatistic) 256 */ 257 public synchronized void setVarianceImpl(StorelessUnivariateStatistic varianceImpl) { 258 super.setVarianceImpl(varianceImpl); 259 } 260 261 }