Changed getUnivariateStatistic() implementation to return a new instance (so tests can use multiple instances).

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@141301 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2004-06-17 21:37:05 +00:00
parent 297d6c9d5b
commit a749d017bf
15 changed files with 33 additions and 92 deletions

View File

@ -20,7 +20,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/**
* Test cases for the {@link UnivariateStatistic} class.
* @version $Revision: 1.1 $ $Date: 2004/04/27 16:42:33 $
* @version $Revision: 1.2 $ $Date: 2004/06/17 21:37:05 $
*/
public class FirstMomentTest extends StorelessUnivariateStatisticAbstractTest{
@ -38,11 +38,7 @@ public class FirstMomentTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/
public UnivariateStatistic getUnivariateStatistic() {
if(stat == null)
stat = new FirstMoment();
return stat;
return new FirstMoment();
}
/**

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/**
* Test cases for the {@link UnivariateStatistic} class.
* @version $Revision: 1.9 $ $Date: 2004/02/21 21:35:18 $
* @version $Revision: 1.10 $ $Date: 2004/06/17 21:37:05 $
*/
public class GeometricMeanTest extends StorelessUnivariateStatisticAbstractTest{
@ -46,11 +46,7 @@ public class GeometricMeanTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/
public UnivariateStatistic getUnivariateStatistic() {
if(stat == null)
stat = new GeometricMean();
return stat;
return new GeometricMean();
}
/* (non-Javadoc)

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/**
* Test cases for the {@link UnivariateStatistic} class.
* @version $Revision: 1.10 $ $Date: 2004/02/21 21:35:18 $
* @version $Revision: 1.11 $ $Date: 2004/06/17 21:37:05 $
*/
public class KurtosisTest extends StorelessUnivariateStatisticAbstractTest{
@ -46,11 +46,7 @@ public class KurtosisTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/
public UnivariateStatistic getUnivariateStatistic() {
if(stat == null)
stat = new Kurtosis();
return stat;
return new Kurtosis();
}
/* (non-Javadoc)

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/**
* Test cases for the {@link UnivariateStatistic} class.
* @version $Revision: 1.10 $ $Date: 2004/02/21 21:35:18 $
* @version $Revision: 1.11 $ $Date: 2004/06/17 21:37:05 $
*/
public class MeanTest extends StorelessUnivariateStatisticAbstractTest{
@ -46,11 +46,7 @@ public class MeanTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/
public UnivariateStatistic getUnivariateStatistic() {
if(stat == null)
stat = new Mean();
return stat;
return new Mean();
}
/* (non-Javadoc)

View File

@ -24,7 +24,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/**
* Test cases for the {@link UnivariateStatistic} class.
*
* @version $Revision: 1.10 $ $Date: 2004/02/21 21:35:18 $
* @version $Revision: 1.11 $ $Date: 2004/06/17 21:37:05 $
*/
public class SkewnessTest extends StorelessUnivariateStatisticAbstractTest{
@ -41,11 +41,7 @@ public class SkewnessTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/
public UnivariateStatistic getUnivariateStatistic() {
if(stat == null)
stat = new Skewness();
return stat;
return new Skewness();
}
public static Test suite() {

View File

@ -24,7 +24,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/**
* Test cases for the {@link UnivariateStatistic} class.
*
* @version $Revision: 1.10 $ $Date: 2004/02/21 21:35:18 $
* @version $Revision: 1.11 $ $Date: 2004/06/17 21:37:05 $
*/
public class StandardDeviationTest extends StorelessUnivariateStatisticAbstractTest{
@ -41,11 +41,7 @@ public class StandardDeviationTest extends StorelessUnivariateStatisticAbstractT
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/
public UnivariateStatistic getUnivariateStatistic() {
if(stat == null)
stat = new StandardDeviation();
return stat;
return new StandardDeviation();
}
public static Test suite() {

View File

@ -24,7 +24,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/**
* Test cases for the {@link UnivariateStatistic} class.
*
* @version $Revision: 1.10 $ $Date: 2004/02/21 21:35:18 $
* @version $Revision: 1.11 $ $Date: 2004/06/17 21:37:05 $
*/
public class VarianceTest extends StorelessUnivariateStatisticAbstractTest{
@ -41,11 +41,7 @@ public class VarianceTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/
public UnivariateStatistic getUnivariateStatistic() {
if(stat == null)
stat = new Variance();
return stat;
return new Variance();
}
public static Test suite() {

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/**
* Test cases for the {@link UnivariateStatistic} class.
* @version $Revision: 1.10 $ $Date: 2004/02/21 21:35:18 $
* @version $Revision: 1.11 $ $Date: 2004/06/17 21:37:05 $
*/
public class MaxTest extends StorelessUnivariateStatisticAbstractTest{
@ -46,11 +46,7 @@ public class MaxTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/
public UnivariateStatistic getUnivariateStatistic() {
if(stat == null)
stat = new Max();
return stat;
return new Max();
}
/* (non-Javadoc)

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest;
/**
* Test cases for the {@link UnivariateStatistic} class.
* @version $Revision: 1.9 $ $Date: 2004/02/21 21:35:18 $
* @version $Revision: 1.10 $ $Date: 2004/06/17 21:37:05 $
*/
public class MedianTest extends UnivariateStatisticAbstractTest{
@ -45,12 +45,8 @@ public class MedianTest extends UnivariateStatisticAbstractTest{
/* (non-Javadoc)
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/
public UnivariateStatistic getUnivariateStatistic() {
if(stat == null)
stat = new Median();
return stat;
public UnivariateStatistic getUnivariateStatistic() {
return new Median();
}
/* (non-Javadoc)

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/**
* Test cases for the {@link UnivariateStatistic} class.
* @version $Revision: 1.10 $ $Date: 2004/02/21 21:35:18 $
* @version $Revision: 1.11 $ $Date: 2004/06/17 21:37:05 $
*/
public class MinTest extends StorelessUnivariateStatisticAbstractTest{
@ -46,11 +46,7 @@ public class MinTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/
public UnivariateStatistic getUnivariateStatistic() {
if(stat == null)
stat = new Min();
return stat;
return new Min();
}
/* (non-Javadoc)

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest;
/**
* Test cases for the {@link UnivariateStatistic} class.
* @version $Revision: 1.12 $ $Date: 2004/03/21 04:26:54 $
* @version $Revision: 1.13 $ $Date: 2004/06/17 21:37:05 $
*/
public class PercentileTest extends UnivariateStatisticAbstractTest{
@ -45,11 +45,8 @@ public class PercentileTest extends UnivariateStatisticAbstractTest{
/* (non-Javadoc)
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/
public UnivariateStatistic getUnivariateStatistic() {
if(stat == null)
stat = new Percentile(95.0);
return stat;
public UnivariateStatistic getUnivariateStatistic() {
return new Percentile(95.0);
}
/* (non-Javadoc)

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/**
* Test cases for the {@link UnivariateStatistic} class.
* @version $Revision: 1.11 $ $Date: 2004/03/21 04:29:20 $
* @version $Revision: 1.12 $ $Date: 2004/06/17 21:37:05 $
*/
public class ProductTest extends StorelessUnivariateStatisticAbstractTest{
@ -46,11 +46,7 @@ public class ProductTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/
public UnivariateStatistic getUnivariateStatistic() {
if(stat == null)
stat = new Product();
return stat;
return new Product();
}
public double getTolerance() {

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/**
* Test cases for the {@link UnivariateStatistic} class.
* @version $Revision: 1.10 $ $Date: 2004/02/21 21:35:18 $
* @version $Revision: 1.11 $ $Date: 2004/06/17 21:37:05 $
*/
public class SumLogTest extends StorelessUnivariateStatisticAbstractTest{
@ -45,12 +45,8 @@ public class SumLogTest extends StorelessUnivariateStatisticAbstractTest{
/* (non-Javadoc)
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/
public UnivariateStatistic getUnivariateStatistic() {
if(stat == null)
stat = new SumOfLogs();
return stat;
public UnivariateStatistic getUnivariateStatistic() {
return new SumOfLogs();
}
/* (non-Javadoc)

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/**
* Test cases for the {@link UnivariateStatistic} class.
* @version $Revision: 1.10 $ $Date: 2004/02/21 21:35:18 $
* @version $Revision: 1.11 $ $Date: 2004/06/17 21:37:05 $
*/
public class SumSqTest extends StorelessUnivariateStatisticAbstractTest{
@ -46,11 +46,7 @@ public class SumSqTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/
public UnivariateStatistic getUnivariateStatistic() {
if(stat == null)
stat = new SumOfSquares();
return stat;
return new SumOfSquares();
}
/* (non-Javadoc)

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/**
* Test cases for the {@link UnivariateStatistic} class.
* @version $Revision: 1.10 $ $Date: 2004/02/21 21:35:18 $
* @version $Revision: 1.11 $ $Date: 2004/06/17 21:37:05 $
*/
public class SumTest extends StorelessUnivariateStatisticAbstractTest{
@ -46,11 +46,7 @@ public class SumTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/
public UnivariateStatistic getUnivariateStatistic() {
if(stat == null)
stat = new Sum();
return stat;
return new Sum();
}
/* (non-Javadoc)