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. * 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{ public class FirstMomentTest extends StorelessUnivariateStatisticAbstractTest{
@ -38,11 +38,7 @@ public class FirstMomentTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic() * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/ */
public UnivariateStatistic getUnivariateStatistic() { public UnivariateStatistic getUnivariateStatistic() {
return new FirstMoment();
if(stat == null)
stat = new FirstMoment();
return stat;
} }
/** /**

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/** /**
* Test cases for the {@link UnivariateStatistic} class. * 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{ public class GeometricMeanTest extends StorelessUnivariateStatisticAbstractTest{
@ -46,11 +46,7 @@ public class GeometricMeanTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic() * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/ */
public UnivariateStatistic getUnivariateStatistic() { public UnivariateStatistic getUnivariateStatistic() {
return new GeometricMean();
if(stat == null)
stat = new GeometricMean();
return stat;
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/** /**
* Test cases for the {@link UnivariateStatistic} class. * 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{ public class KurtosisTest extends StorelessUnivariateStatisticAbstractTest{
@ -46,11 +46,7 @@ public class KurtosisTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic() * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/ */
public UnivariateStatistic getUnivariateStatistic() { public UnivariateStatistic getUnivariateStatistic() {
return new Kurtosis();
if(stat == null)
stat = new Kurtosis();
return stat;
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/** /**
* Test cases for the {@link UnivariateStatistic} class. * 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{ public class MeanTest extends StorelessUnivariateStatisticAbstractTest{
@ -46,11 +46,7 @@ public class MeanTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic() * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/ */
public UnivariateStatistic getUnivariateStatistic() { public UnivariateStatistic getUnivariateStatistic() {
return new Mean();
if(stat == null)
stat = new Mean();
return stat;
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@ -24,7 +24,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/** /**
* Test cases for the {@link UnivariateStatistic} class. * 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{ public class SkewnessTest extends StorelessUnivariateStatisticAbstractTest{
@ -41,11 +41,7 @@ public class SkewnessTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic() * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/ */
public UnivariateStatistic getUnivariateStatistic() { public UnivariateStatistic getUnivariateStatistic() {
return new Skewness();
if(stat == null)
stat = new Skewness();
return stat;
} }
public static Test suite() { 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. * 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{ public class StandardDeviationTest extends StorelessUnivariateStatisticAbstractTest{
@ -41,11 +41,7 @@ public class StandardDeviationTest extends StorelessUnivariateStatisticAbstractT
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic() * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/ */
public UnivariateStatistic getUnivariateStatistic() { public UnivariateStatistic getUnivariateStatistic() {
return new StandardDeviation();
if(stat == null)
stat = new StandardDeviation();
return stat;
} }
public static Test suite() { 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. * 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{ public class VarianceTest extends StorelessUnivariateStatisticAbstractTest{
@ -41,11 +41,7 @@ public class VarianceTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic() * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/ */
public UnivariateStatistic getUnivariateStatistic() { public UnivariateStatistic getUnivariateStatistic() {
return new Variance();
if(stat == null)
stat = new Variance();
return stat;
} }
public static Test suite() { 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. * 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{ public class MaxTest extends StorelessUnivariateStatisticAbstractTest{
@ -46,11 +46,7 @@ public class MaxTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic() * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/ */
public UnivariateStatistic getUnivariateStatistic() { public UnivariateStatistic getUnivariateStatistic() {
return new Max();
if(stat == null)
stat = new Max();
return stat;
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest;
/** /**
* Test cases for the {@link UnivariateStatistic} class. * 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{ public class MedianTest extends UnivariateStatisticAbstractTest{
@ -46,11 +46,7 @@ public class MedianTest extends UnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic() * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/ */
public UnivariateStatistic getUnivariateStatistic() { public UnivariateStatistic getUnivariateStatistic() {
return new Median();
if(stat == null)
stat = new Median();
return stat;
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/** /**
* Test cases for the {@link UnivariateStatistic} class. * 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{ public class MinTest extends StorelessUnivariateStatisticAbstractTest{
@ -46,11 +46,7 @@ public class MinTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic() * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/ */
public UnivariateStatistic getUnivariateStatistic() { public UnivariateStatistic getUnivariateStatistic() {
return new Min();
if(stat == null)
stat = new Min();
return stat;
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest;
/** /**
* Test cases for the {@link UnivariateStatistic} class. * 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{ public class PercentileTest extends UnivariateStatisticAbstractTest{
@ -46,10 +46,7 @@ public class PercentileTest extends UnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic() * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/ */
public UnivariateStatistic getUnivariateStatistic() { public UnivariateStatistic getUnivariateStatistic() {
return new Percentile(95.0);
if(stat == null)
stat = new Percentile(95.0);
return stat;
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/** /**
* Test cases for the {@link UnivariateStatistic} class. * 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{ public class ProductTest extends StorelessUnivariateStatisticAbstractTest{
@ -46,11 +46,7 @@ public class ProductTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic() * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/ */
public UnivariateStatistic getUnivariateStatistic() { public UnivariateStatistic getUnivariateStatistic() {
return new Product();
if(stat == null)
stat = new Product();
return stat;
} }
public double getTolerance() { public double getTolerance() {

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/** /**
* Test cases for the {@link UnivariateStatistic} class. * 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{ public class SumLogTest extends StorelessUnivariateStatisticAbstractTest{
@ -46,11 +46,7 @@ public class SumLogTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic() * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/ */
public UnivariateStatistic getUnivariateStatistic() { public UnivariateStatistic getUnivariateStatistic() {
return new SumOfLogs();
if(stat == null)
stat = new SumOfLogs();
return stat;
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/** /**
* Test cases for the {@link UnivariateStatistic} class. * 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{ public class SumSqTest extends StorelessUnivariateStatisticAbstractTest{
@ -46,11 +46,7 @@ public class SumSqTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic() * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/ */
public UnivariateStatistic getUnivariateStatistic() { public UnivariateStatistic getUnivariateStatistic() {
return new SumOfSquares();
if(stat == null)
stat = new SumOfSquares();
return stat;
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@ -23,7 +23,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
/** /**
* Test cases for the {@link UnivariateStatistic} class. * 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{ public class SumTest extends StorelessUnivariateStatisticAbstractTest{
@ -46,11 +46,7 @@ public class SumTest extends StorelessUnivariateStatisticAbstractTest{
* @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic() * @see org.apache.commons.math.stat.univariate.UnivariateStatisticAbstractTest#getUnivariateStatistic()
*/ */
public UnivariateStatistic getUnivariateStatistic() { public UnivariateStatistic getUnivariateStatistic() {
return new Sum();
if(stat == null)
stat = new Sum();
return stat;
} }
/* (non-Javadoc) /* (non-Javadoc)