From 9a5b335e4237cc9a79f0cd481a557aeee51c5f53 Mon Sep 17 00:00:00 2001 From: Phil Steitz Date: Sun, 18 Jul 2004 23:57:11 +0000 Subject: [PATCH] Changed some methods to return interface types. Improved javadoc. git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@141398 13f79535-47bb-0310-9956-ffa450edef68 --- .../math/random/EmpiricalDistribution.java | 41 ++++++++++++------- .../random/EmpiricalDistributionImpl.java | 19 +++++---- 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/src/java/org/apache/commons/math/random/EmpiricalDistribution.java b/src/java/org/apache/commons/math/random/EmpiricalDistribution.java index 828310b70..70b53ae78 100644 --- a/src/java/org/apache/commons/math/random/EmpiricalDistribution.java +++ b/src/java/org/apache/commons/math/random/EmpiricalDistribution.java @@ -19,9 +19,9 @@ package org.apache.commons.math.random; import java.io.IOException; import java.io.File; import java.net.URL; -import java.util.ArrayList; +import java.util.List; -import org.apache.commons.math.stat.univariate.SummaryStatistics; +import org.apache.commons.math.stat.univariate.StatisticalSummary; /** * Represents an @@ -32,7 +32,6 @@ import org.apache.commons.math.stat.univariate.SummaryStatistics; * distribution digests, that describe empirical distributions and * support the following operations: + * * @return the sample statistics * @throws IllegalStateException if the distribution has not been loaded */ - SummaryStatistics getSampleStats() throws IllegalStateException; + StatisticalSummary getSampleStats() throws IllegalStateException; /** - * property indicating whether or not the distribution has been loaded + * Property indicating whether or not the distribution has been loaded. + * * @return true if the distribution has been loaded */ boolean isLoaded(); /** - * Returns the number of bins - * @return the number of bins. + * Returns the number of bins. + * + * @return the number of bins */ int getBinCount(); /** - * Returns a list of Univariates containing statistics describing the - * values in each of the bins. The ArrayList is indexed on the bin number. - * @return ArrayList of bin statistics. + * Returns a list of {@link SummaryStatistics} containing statistics + * describing the values in each of the bins. The List is indexed on + * the bin number. + * + * @return List of bin statistics */ - ArrayList getBinStats(); + List getBinStats(); /** * Returns the array of upper bounds for the bins. Bins are:
* [min,upperBounds[0]],(upperBounds[0],upperBounds[1]],..., - * (upperBounds[binCount-1],max] + * (upperBounds[binCount-1],max]. + * * @return array of bin upper bounds */ double[] getUpperBounds(); diff --git a/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java b/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java index 157d8f824..f75025bc9 100644 --- a/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java +++ b/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java @@ -16,7 +16,6 @@ package org.apache.commons.math.random; -import java.util.ArrayList; import java.io.Serializable; import java.io.BufferedReader; import java.io.FileReader; @@ -24,8 +23,11 @@ import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; +import java.util.ArrayList; +import java.util.List; import org.apache.commons.math.stat.univariate.SummaryStatistics; +import org.apache.commons.math.stat.univariate.StatisticalSummary; /** * Implements EmpiricalDistribution interface. This implementation @@ -52,7 +54,7 @@ import org.apache.commons.math.stat.univariate.SummaryStatistics; * entry per line. *

* - * @version $Revision: 1.27 $ $Date: 2004/06/23 16:26:17 $ + * @version $Revision: 1.28 $ $Date: 2004/07/18 23:57:11 $ */ public class EmpiricalDistributionImpl implements Serializable, EmpiricalDistribution { @@ -407,14 +409,14 @@ public class EmpiricalDistributionImpl implements Serializable, EmpiricalDistrib } /** - * Returns a DescriptiveStatistics describing this distribution. + * Returns a {@link StatisticalSummary} describing this distribution. * Preconditions: * * @return the sample statistics * @throws IllegalStateException if the distribution has not been loaded */ - public SummaryStatistics getSampleStats() { + public StatisticalSummary getSampleStats() { return sampleStats; } @@ -428,12 +430,13 @@ public class EmpiricalDistributionImpl implements Serializable, EmpiricalDistrib } /** - * Returns a list of Univariates containing statistics describing the - * values in each of the bins. The ArrayList is indexed on the bin number. + * Returns an ArrayList of {@link SummaryStatistics} instances containing + * statistics describing the values in each of the bins. The ArrayList is + * indexed on the bin number. * - * @return ArrayList of bin statistics. + * @return List of bin statistics. */ - public ArrayList getBinStats() { + public List getBinStats() { return binStats; }