commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From billbar...@apache.org
Subject svn commit: r780541 - in /commons/proper/math/trunk/src: java/org/apache/commons/math/stat/ java/org/apache/commons/math/stat/descriptive/ java/org/apache/commons/math/stat/descriptive/moment/ java/org/apache/commons/math/stat/descriptive/rank/ java/or...
Date Mon, 01 Jun 2009 00:47:02 GMT
Author: billbarker
Date: Mon Jun  1 00:47:02 2009
New Revision: 780541

URL: http://svn.apache.org/viewvc?rev=780541&view=rev
Log:
Serialization changes for stats

Modified:
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/Frequency.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/AbstractStorelessUnivariateStatistic.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/AbstractUnivariateStatistic.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/AggregateSummaryStatistics.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/UnivariateStatistic.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/FirstMoment.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/VectorialCovariance.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/VectorialMean.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Max.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastCosineTransformer.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastHadamardTransformer.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastSineTransformer.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/transform/RealTransformer.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/stat/FrequencyTest.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsTest.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatisticsTest.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/VectorialCovarianceTest.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/VectorialMeanTest.java

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/Frequency.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/Frequency.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/Frequency.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/Frequency.java Mon Jun
 1 00:47:02 2009
@@ -498,4 +498,36 @@
             return ((Comparable<Object>)o1).compareTo(o2);
         }
     }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result
+                + ((freqTable == null) ? 0 : freqTable.hashCode());
+        return result;
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (!(obj instanceof Frequency))
+            return false;
+        Frequency other = (Frequency) obj;
+        if (freqTable == null) {
+            if (other.freqTable != null)
+                return false;
+        } else if (!freqTable.equals(other.freqTable))
+            return false;
+        return true;
+    }
 }

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/AbstractStorelessUnivariateStatistic.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/AbstractStorelessUnivariateStatistic.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/AbstractStorelessUnivariateStatistic.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/AbstractStorelessUnivariateStatistic.java
Mon Jun  1 00:47:02 2009
@@ -33,10 +33,7 @@
  */
 public abstract class AbstractStorelessUnivariateStatistic
     extends AbstractUnivariateStatistic
-    implements StorelessUnivariateStatistic, Serializable {
-
-    /** Serialization UID */
-    private static final long serialVersionUID = -44915725420072521L;
+    implements StorelessUnivariateStatistic {
     
     /**
      * This default implementation calls {@link #clear}, then invokes 

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/AbstractUnivariateStatistic.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/AbstractUnivariateStatistic.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/AbstractUnivariateStatistic.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/AbstractUnivariateStatistic.java
Mon Jun  1 00:47:02 2009
@@ -16,8 +16,6 @@
  */
 package org.apache.commons.math.stat.descriptive;
 
-import java.io.Serializable;
-
 import org.apache.commons.math.MathRuntimeException;
 
 /**
@@ -34,10 +32,7 @@
  * @version $Revision$ $Date$
  */
 public abstract class AbstractUnivariateStatistic
-    implements UnivariateStatistic, Serializable {
-    
-    /** Serialization UID */
-    private static final long serialVersionUID = -8007759382851708045L;
+    implements UnivariateStatistic {
 
     /**
      * {@inheritDoc}

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/AggregateSummaryStatistics.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/AggregateSummaryStatistics.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/AggregateSummaryStatistics.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/AggregateSummaryStatistics.java
Mon Jun  1 00:47:02 2009
@@ -41,10 +41,9 @@
 public class AggregateSummaryStatistics implements StatisticalSummary,
         Serializable {
 
-    /**
-     * The serialization version of this class
-     */
-    private static final long serialVersionUID = 1L;
+ 
+    /** Serializable version identifier */
+   private static final long serialVersionUID = -8207112444016386906L;
 
     /**
      * A SummaryStatistics serving as a prototype for creating SummaryStatistics

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/UnivariateStatistic.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/UnivariateStatistic.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/UnivariateStatistic.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/UnivariateStatistic.java
Mon Jun  1 00:47:02 2009
@@ -16,14 +16,13 @@
  */
 package org.apache.commons.math.stat.descriptive;
 
-import java.io.Serializable;
 
 /**
  * Base interface implemented by all statistics.
  * 
  * @version $Revision$ $Date$
  */
-public interface UnivariateStatistic extends Serializable {
+public interface UnivariateStatistic {
 
     /**
      * Returns the result of evaluating the statistic over the input array.

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/FirstMoment.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/FirstMoment.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/FirstMoment.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/FirstMoment.java
Mon Jun  1 00:47:02 2009
@@ -48,7 +48,8 @@
     implements Serializable {
 
     /** Serializable version identifier */
-    private static final long serialVersionUID = -803343206421984070L; 
+    private static final long serialVersionUID = 6112755307178490473L;
+
     
     /** Count of values that have been added */
     protected long n;

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java
Mon Jun  1 00:47:02 2009
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.math.stat.descriptive.moment;
 
+import java.io.Serializable;
+
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;
 import org.apache.commons.math.stat.descriptive.StorelessUnivariateStatistic;
@@ -45,7 +47,7 @@
  *
  * @version $Revision$ $Date$
  */
-public class GeometricMean extends AbstractStorelessUnivariateStatistic {
+public class GeometricMean extends AbstractStorelessUnivariateStatistic implements Serializable
{
 
     /** Serializable version identifier */
     private static final long serialVersionUID = -8178734905303459453L;  

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java
Mon Jun  1 00:47:02 2009
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.math.stat.descriptive.moment;
 
+import java.io.Serializable;
+
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;
 
@@ -40,7 +42,7 @@
  * 
  * @version $Revision$ $Date$
  */
-public class Kurtosis extends AbstractStorelessUnivariateStatistic  {
+public class Kurtosis extends AbstractStorelessUnivariateStatistic  implements Serializable
{
 
     /** Serializable version identifier */
     private static final long serialVersionUID = 2784465764798260919L;  

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/VectorialCovariance.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/VectorialCovariance.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/VectorialCovariance.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/VectorialCovariance.java
Mon Jun  1 00:47:02 2009
@@ -118,4 +118,37 @@
         Arrays.fill(productsSums, 0.0);
     }
 
+    /** @inheritDoc{} */
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + (isBiasCorrected ? 1231 : 1237);
+        result = prime * result + (int) (n ^ (n >>> 32));
+        result = prime * result + Arrays.hashCode(productsSums);
+        result = prime * result + Arrays.hashCode(sums);
+        return result;
+    }
+
+    /** @inheritDoc{} */
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (!(obj instanceof VectorialCovariance))
+            return false;
+        VectorialCovariance other = (VectorialCovariance) obj;
+        if (isBiasCorrected != other.isBiasCorrected)
+            return false;
+        if (n != other.n)
+            return false;
+        if (!Arrays.equals(productsSums, other.productsSums))
+            return false;
+        if (!Arrays.equals(sums, other.sums))
+            return false;
+        return true;
+    }
+
 }
\ No newline at end of file

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/VectorialMean.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/VectorialMean.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/VectorialMean.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/VectorialMean.java
Mon Jun  1 00:47:02 2009
@@ -17,6 +17,7 @@
 package org.apache.commons.math.stat.descriptive.moment;
 
 import java.io.Serializable;
+import java.util.Arrays;
 
 import org.apache.commons.math.DimensionMismatchException;
 
@@ -77,4 +78,28 @@
         return (means.length == 0) ? 0 : means[0].getN();
     }
 
+    /* @inheritDocs{} */
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + Arrays.hashCode(means);
+        return result;
+    }
+
+    /* @inheritDocs{} */
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (!(obj instanceof VectorialMean))
+            return false;
+        VectorialMean other = (VectorialMean) obj;
+        if (!Arrays.equals(means, other.means))
+            return false;
+        return true;
+    }
+
 }
\ No newline at end of file

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Max.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Max.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Max.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Max.java
Mon Jun  1 00:47:02 2009
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.math.stat.descriptive.rank;
 
+import java.io.Serializable;
+
 import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic;
 
 /**
@@ -35,7 +37,7 @@
  * 
  * @version $Revision$ $Date$
  */
-public class Max extends AbstractStorelessUnivariateStatistic {
+public class Max extends AbstractStorelessUnivariateStatistic implements Serializable {
 
     /** Serializable version identifier */
     private static final long serialVersionUID = -5593383832225844641L;    

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastCosineTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastCosineTransformer.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastCosineTransformer.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastCosineTransformer.java
Mon Jun  1 00:47:02 2009
@@ -33,15 +33,13 @@
  * Different from FFT and FST, FCT requires the length of data set to be
  * power of 2 plus one. Users should especially pay attention to the
  * function transformation on how this affects the sampling.</p>
+ * <p>As of version 2.0 this no longer implements Serializable</p>
  *
  * @version $Revision:670469 $ $Date:2008-06-23 10:01:38 +0200 (lun., 23 juin 2008) $
  * @since 1.2
  */
 public class FastCosineTransformer implements RealTransformer {
 
-    /** serializable version identifier */
-    private static final long serialVersionUID = -831323620109865380L;
-
     /**
      * Construct a default transformer.
      */

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastHadamardTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastHadamardTransformer.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastHadamardTransformer.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastHadamardTransformer.java
Mon Jun  1 00:47:02 2009
@@ -33,9 +33,6 @@
  */
 public class FastHadamardTransformer implements RealTransformer {
 
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = -720498949613305350L;
-
     /** {@inheritDoc} */
     public double[] transform(double f[])
         throws IllegalArgumentException {

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastSineTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastSineTransformer.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastSineTransformer.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/transform/FastSineTransformer.java
Mon Jun  1 00:47:02 2009
@@ -33,15 +33,13 @@
  * Similar to FFT, we also require the length of data set to be power of 2.
  * In addition, the first element must be 0 and it's enforced in function
  * transformation after sampling.</p>
- *
+ * <p>As of version 2.0 this no longer implements Serializable</p>
+ * 
  * @version $Revision$ $Date$
  * @since 1.2
  */
 public class FastSineTransformer implements RealTransformer {
 
-    /** serializable version identifier */
-    private static final long serialVersionUID = -7557024407476823001L;
-
     /**
      * Construct a default transformer.
      */

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/transform/RealTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/transform/RealTransformer.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/transform/RealTransformer.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/transform/RealTransformer.java
Mon Jun  1 00:47:02 2009
@@ -16,8 +16,6 @@
  */
 package org.apache.commons.math.transform;
 
-import java.io.Serializable;
-
 import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.complex.Complex;
@@ -34,7 +32,7 @@
  * @version $Revision$ $Date$
  * @since 2.0
  */
-public interface RealTransformer extends Serializable {
+public interface RealTransformer  {
 
     /**
      * Transform the given real data set.

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/FrequencyTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/FrequencyTest.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/FrequencyTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/FrequencyTest.java Mon
Jun  1 00:47:02 2009
@@ -267,5 +267,13 @@
             assertTrue(it.next() instanceof Long);
         }     
     }
+    
+    public void testSerial() {
+        f.addValue(oneL);
+        f.addValue(twoL);
+        f.addValue(oneI);
+        f.addValue(twoI);
+        assertEquals(f, TestUtils.serializeAndRecover(f));
+    }
 }
 

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsTest.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsTest.java
(original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsTest.java
Mon Jun  1 00:47:02 2009
@@ -107,7 +107,6 @@
      * A new way to compute the mean 
      */
     static class deepMean implements UnivariateStatistic {
-        private static final long serialVersionUID = 9108665370122541953L;
 
         public double evaluate(double[] values, int begin, int length) {
             return 42;
@@ -125,7 +124,6 @@
      * Test percentile implementation - wraps a Percentile
      */
     static class goodPercentile implements UnivariateStatistic {
-        private static final long serialVersionUID = 801005145532790795L;
         private Percentile percentile = new Percentile();
         public void setQuantile(double quantile) {
             percentile.setQuantile(quantile);
@@ -168,7 +166,6 @@
      * "Bad" test percentile implementation - no setQuantile
      */
     static class badPercentile implements UnivariateStatistic {
-        private static final long serialVersionUID = -707437653388052183L;
         private Percentile percentile = new Percentile();
         public double evaluate(double[] values, int begin, int length) {
             return percentile.evaluate(values, begin, length);

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatisticsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatisticsTest.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatisticsTest.java
(original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatisticsTest.java
Mon Jun  1 00:47:02 2009
@@ -86,7 +86,6 @@
      * Returns the sum instead of the mean.
      */
     static class sumMean implements StorelessUnivariateStatistic {   
-        private static final long serialVersionUID = 6492471391340853423L;
         private double sum = 0;
         private long n = 0;
         public double evaluate(double[] values, int begin, int length) {

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
(original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
Mon Jun  1 00:47:02 2009
@@ -202,4 +202,9 @@
         assertTrue(master.equals(replica));
     }
     
+    public void testSerial() {
+        StorelessUnivariateStatistic s =
+            (StorelessUnivariateStatistic) getUnivariateStatistic();
+        assertEquals(s, TestUtils.serializeAndRecover(s));
+    }
 }

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/VectorialCovarianceTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/VectorialCovarianceTest.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/VectorialCovarianceTest.java
(original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/VectorialCovarianceTest.java
Mon Jun  1 00:47:02 2009
@@ -18,6 +18,7 @@
 package org.apache.commons.math.stat.descriptive.moment;
 
 import org.apache.commons.math.DimensionMismatchException;
+import org.apache.commons.math.TestUtils;
 import org.apache.commons.math.linear.RealMatrix;
 
 import junit.framework.Test;
@@ -78,6 +79,11 @@
 
     }
 
+    public void testSerial(){
+        VectorialCovariance stat = new VectorialCovariance(points[0].length, true);
+        assertEquals(stat, TestUtils.serializeAndRecover(stat));
+    }
+    
     @Override
     public void setUp() {
         points = new double[][] {

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/VectorialMeanTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/VectorialMeanTest.java?rev=780541&r1=780540&r2=780541&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/VectorialMeanTest.java
(original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/moment/VectorialMeanTest.java
Mon Jun  1 00:47:02 2009
@@ -18,6 +18,7 @@
 package org.apache.commons.math.stat.descriptive.moment;
 
 import org.apache.commons.math.DimensionMismatchException;
+import org.apache.commons.math.TestUtils;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -70,6 +71,13 @@
 
     }
 
+    public void testSerial() throws DimensionMismatchException {
+        VectorialMean stat = new VectorialMean(points[0].length);
+        for (int i = 0; i < points.length; ++i) {
+            stat.increment(points[i]);
+        }
+        assertEquals(stat, TestUtils.serializeAndRecover(stat));
+    }
     @Override
     public void setUp() {
         points = new double[][] {



Mime
View raw message