Return-Path: Delivered-To: apmail-commons-commits-archive@locus.apache.org Received: (qmail 17932 invoked from network); 12 Jan 2008 21:35:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Jan 2008 21:35:37 -0000 Received: (qmail 9531 invoked by uid 500); 12 Jan 2008 21:35:27 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 9083 invoked by uid 500); 12 Jan 2008 21:35:26 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 9074 invoked by uid 99); 12 Jan 2008 21:35:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 12 Jan 2008 13:35:26 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 12 Jan 2008 21:35:21 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E786E1A9832; Sat, 12 Jan 2008 13:35:12 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r611489 - in /commons/proper/math/trunk/src: java/org/apache/commons/math/stat/descriptive/ test/org/apache/commons/math/stat/descriptive/ Date: Sat, 12 Jan 2008 21:35:11 -0000 To: commits@commons.apache.org From: luc@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080112213512.E786E1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: luc Date: Sat Jan 12 13:35:10 2008 New Revision: 611489 URL: http://svn.apache.org/viewvc?rev=611489&view=rev Log: UnivariateStatistic classes should be Serializable since they are used as fields of the Serializable DescriptiveStatistics class Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/UnivariateStatistic.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/MixedListUnivariateImplTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/SummaryStatisticsTest.java 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=611489&r1=611488&r2=611489&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 Sat Jan 12 13:35:10 2008 @@ -16,6 +16,8 @@ */ package org.apache.commons.math.stat.descriptive; +import java.io.Serializable; + /** * Base evaluation interface implemented by all statistics. *

@@ -25,7 +27,7 @@ * * @version $Revision$ $Date$ */ -public interface UnivariateStatistic { +public interface UnivariateStatistic extends Serializable { /** * Returns the result of evaluating the statistic over the input array. 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=611489&r1=611488&r2=611489&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 Sat Jan 12 13:35:10 2008 @@ -81,7 +81,9 @@ /** * A new way to compute the mean */ - class deepMean implements UnivariateStatistic { + static class deepMean implements UnivariateStatistic { + private static final long serialVersionUID = 9108665370122541953L; + public double evaluate(double[] values, int begin, int length) { return 42; } @@ -94,8 +96,9 @@ /** * Test percentile implementation - wraps a Percentile */ - class goodPercentile implements UnivariateStatistic { - Percentile percentile = new 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); } @@ -103,7 +106,7 @@ return percentile.evaluate(values, begin, length); } public double evaluate(double[] values) { - return evaluate(values); + return percentile.evaluate(values); } } @@ -111,7 +114,7 @@ * Test percentile subclass - another "new math" impl * Always returns currently set quantile */ - class subPercentile extends Percentile { + static class subPercentile extends Percentile { public double evaluate(double[] values, int begin, int length) { return getQuantile(); } @@ -124,13 +127,14 @@ /** * "Bad" test percentile implementation - no setQuantile */ - class badPercentile implements UnivariateStatistic { - Percentile percentile = new Percentile(); + 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); } public double evaluate(double[] values) { - return evaluate(values); + return percentile.evaluate(values); } } } Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/MixedListUnivariateImplTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/MixedListUnivariateImplTest.java?rev=611489&r1=611488&r2=611489&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/MixedListUnivariateImplTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/MixedListUnivariateImplTest.java Sat Jan 12 13:35:10 2008 @@ -52,18 +52,9 @@ super(name); transformers = new TransformerMap(); - transformers.putTransformer(Foo.class, new NumberTransformer() { - public double transform(Object o) { - return Double.parseDouble(((Foo) o).heresFoo()); - } - }); - - transformers.putTransformer(Bar.class, new NumberTransformer() { - public double transform(Object o) { - return Double.parseDouble(((Bar) o).heresBar()); - } + transformers.putTransformer(Foo.class, new FooTransformer()); - }); + transformers.putTransformer(Bar.class, new BarTransformer()); } @@ -196,9 +187,24 @@ } } + public static final class FooTransformer implements NumberTransformer { + private static final long serialVersionUID = -4252248129291326127L; + public double transform(Object o) { + return Double.parseDouble(((Foo) o).heresFoo()); + } + } + public static final class Bar { public String heresBar() { return "12.0"; } } + + public static final class BarTransformer implements NumberTransformer { + private static final long serialVersionUID = -1768345377764262043L; + public double transform(Object o) { + return Double.parseDouble(((Bar) o).heresBar()); + } + } + } Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/SummaryStatisticsTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/SummaryStatisticsTest.java?rev=611489&r1=611488&r2=611489&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/SummaryStatisticsTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/SummaryStatisticsTest.java Sat Jan 12 13:35:10 2008 @@ -75,7 +75,8 @@ * Bogus mean implementation to test setter injection. * Returns the sum instead of the mean. */ - class sumMean implements StorelessUnivariateStatistic { + 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) {