You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ps...@apache.org on 2004/07/19 01:57:11 UTC
cvs commit: jakarta-commons/math/src/java/org/apache/commons/math/random EmpiricalDistribution.java EmpiricalDistributionImpl.java
psteitz 2004/07/18 16:57:11
Modified: math/src/java/org/apache/commons/math/random
EmpiricalDistribution.java
EmpiricalDistributionImpl.java
Log:
Changed some methods to return interface types. Improved javadoc.
Revision Changes Path
1.21 +26 -15 jakarta-commons/math/src/java/org/apache/commons/math/random/EmpiricalDistribution.java
Index: EmpiricalDistribution.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/random/EmpiricalDistribution.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- EmpiricalDistribution.java 14 Jun 2004 23:45:33 -0000 1.20
+++ EmpiricalDistribution.java 18 Jul 2004 23:57:11 -0000 1.21
@@ -19,9 +19,9 @@
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 <a href="http://random.mat.sbg.ac.at/~ste/dipl/node11.html">
@@ -32,7 +32,6 @@
* <i>distribution digests</i>, that describe empirical distributions and
* support the following operations: <ul>
* <li>loading the distribution from a file of observed data values</li>
- * <li>saving and re-loading distribution digests to/from "digest files" </li>
* <li>dividing the input data into "bin ranges" and reporting bin frequency
* counts (data for histogram)</li>
* <li>reporting univariate statistics describing the full set of data values
@@ -43,6 +42,7 @@
* build grouped frequnecy histograms representing the input data or to
* generate random values "like" those in the input file -- i.e., the values
* generated will follow the distribution of the values in the file.
+ *
* @version $Revision$ $Date$
*/
public interface EmpiricalDistribution {
@@ -50,12 +50,14 @@
/**
* Computes the empirical distribution from the provided
* array of numbers.
+ *
* @param dataArray the data array
*/
void load(double[] dataArray);
/**
* Computes the empirical distribution from the input file.
+ *
* @param file the input file
* @throws IOException if an IO error occurs
*/
@@ -63,6 +65,7 @@
/**
* Computes the empirical distribution using data read from a URL.
+ *
* @param url url of the input file
* @throws IOException if an IO error occurs
*/
@@ -73,43 +76,51 @@
* <strong>Preconditions:</strong><ul>
* <li>the distribution must be loaded before invoking this method</li></ul>
* @return the random value.
+ *
* @throws IllegalStateException if the distribution has not been loaded
*/
double getNextValue() throws IllegalStateException;
/**
- * Returns a DescriptiveStatistics describing this distribution.
+ * Returns a {@link StatisticalSummary} describing this distribution.
* <strong>Preconditions:</strong><ul>
- * <li>the distribution must be loaded before invoking this method</li></ul>
+ * <li>the distribution must be loaded before invoking this method</li>
+ * </ul>
+ *
* @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: <br/>
* [min,upperBounds[0]],(upperBounds[0],upperBounds[1]],...,
- * (upperBounds[binCount-1],max]
+ * (upperBounds[binCount-1],max].
+ *
* @return array of bin upper bounds
*/
double[] getUpperBounds();
1.28 +11 -8 jakarta-commons/math/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java
Index: EmpiricalDistributionImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons/math/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- EmpiricalDistributionImpl.java 23 Jun 2004 16:26:17 -0000 1.27
+++ EmpiricalDistributionImpl.java 18 Jul 2004 23:57:11 -0000 1.28
@@ -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.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 <code>EmpiricalDistribution</code> interface. This implementation
@@ -407,14 +409,14 @@
}
/**
- * Returns a DescriptiveStatistics describing this distribution.
+ * Returns a {@link StatisticalSummary} describing this distribution.
* <strong>Preconditions:</strong><ul>
* <li>the distribution must be loaded before invoking this method</li></ul>
*
* @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 @@
}
/**
- * 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;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org