commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1455716 - in /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution: AbstractIntegerDistribution.java DiscreteDistribution.java DiscreteIntegerDistribution.java DiscreteRealDistribution.java
Date Tue, 12 Mar 2013 21:12:21 GMT
Author: tn
Date: Tue Mar 12 21:12:21 2013
New Revision: 1455716

URL: http://svn.apache.org/r1455716
Log:
Fix findbugs warnings: non-serializable field, minor formatting.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/AbstractIntegerDistribution.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/DiscreteDistribution.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/DiscreteIntegerDistribution.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/DiscreteRealDistribution.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/AbstractIntegerDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/AbstractIntegerDistribution.java?rev=1455716&r1=1455715&r2=1455716&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/AbstractIntegerDistribution.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/AbstractIntegerDistribution.java
Tue Mar 12 21:12:21 2013
@@ -34,16 +34,16 @@ import org.apache.commons.math3.util.Fas
  *
  * @version $Id$
  */
-public abstract class AbstractIntegerDistribution
-implements IntegerDistribution, Serializable {
+public abstract class AbstractIntegerDistribution implements IntegerDistribution, Serializable
{
+
     /** Serializable version identifier */
     private static final long serialVersionUID = -1146319659338487221L;
 
-     /**
-      * RandomData instance used to generate samples from the distribution.
-      * @deprecated As of 3.1, to be removed in 4.0. Please use the
-      * {@link #random} instance variable instead.
-      */
+    /**
+     * RandomData instance used to generate samples from the distribution.
+     * @deprecated As of 3.1, to be removed in 4.0. Please use the
+     * {@link #random} instance variable instead.
+     */
     @Deprecated
     protected final RandomDataImpl randomData = new RandomDataImpl();
 
@@ -63,6 +63,7 @@ implements IntegerDistribution, Serializ
         // New users are forbidden to use this constructor.
         random = null;
     }
+
     /**
      * @param rng Random number generator.
      * @since 3.1

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/DiscreteDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/DiscreteDistribution.java?rev=1455716&r1=1455715&r2=1455716&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/DiscreteDistribution.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/DiscreteDistribution.java
Tue Mar 12 21:12:21 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.commons.math3.distribution;
 
+import java.io.Serializable;
 import java.lang.reflect.Array;
 import java.util.ArrayList;
 import java.util.List;
@@ -40,16 +41,21 @@ import org.apache.commons.math3.util.Pai
  * @version $Id$
  * @since 3.2
  */
-public class DiscreteDistribution<T> {
+public class DiscreteDistribution<T> implements Serializable {
+
+    /** Serializable UID. */
+    private static final long serialVersionUID = -6817222602957985244L;
 
     /**
      * RNG instance used to generate samples from the distribution.
      */
     protected final RandomGenerator random;
+
     /**
      * List of random variable values.
      */
     private final List<T> singletons;
+
     /**
      * Normalized array of probabilities of respective random variable values.
      */

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/DiscreteIntegerDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/DiscreteIntegerDistribution.java?rev=1455716&r1=1455715&r2=1455716&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/DiscreteIntegerDistribution.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/DiscreteIntegerDistribution.java
Tue Mar 12 21:12:21 2013
@@ -28,11 +28,11 @@ import org.apache.commons.math3.util.Pai
 
 /**
  * Implementation of the integer-valued discrete distribution.
+ * <p>
+ * Note: values with zero-probability are allowed but they do not extend the support.
  *
- * Note: values with zero-probability are allowed but they do not extend the
- * support.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Probability_distribution#Discrete_probability_distribution">Discrete
probability distribution (Wikipedia)</a>
+ * @see <a href="http://en.wikipedia.org/wiki/Probability_distribution#Discrete_probability_distribution">
+ * Discrete probability distribution (Wikipedia)</a>
  * @see <a href="http://mathworld.wolfram.com/DiscreteDistribution.html">Discrete Distribution
(MathWorld)</a>
  * @version $Id$
  * @since 3.2
@@ -54,13 +54,10 @@ public class DiscreteIntegerDistribution
      *
      * @param singletons array of random variable values.
      * @param probabilities array of probabilities.
-     * @throws DimensionMismatchException if
-     * {@code singletons.length != probabilities.length}
-     * @throws NotPositiveException if probability of at least one value is
-     * negative.
+     * @throws DimensionMismatchException if {@code singletons.length != probabilities.length}
+     * @throws NotPositiveException if probability of at least one value is negative.
      * @throws MathArithmeticException if the probabilities sum to zero.
-     * @throws MathIllegalArgumentException if probability of at least one value
-     * is infinite.
+     * @throws MathIllegalArgumentException if probability of at least one value is infinite.
      */
     public DiscreteIntegerDistribution(final int[] singletons, final double[] probabilities)
         throws DimensionMismatchException, NotPositiveException, MathArithmeticException,
MathIllegalArgumentException {
@@ -74,13 +71,10 @@ public class DiscreteIntegerDistribution
      * @param rng random number generator.
      * @param singletons array of random variable values.
      * @param probabilities array of probabilities.
-     * @throws DimensionMismatchException if
-     * {@code singletons.length != probabilities.length}
-     * @throws NotPositiveException if probability of at least one value is
-     * negative.
+     * @throws DimensionMismatchException if {@code singletons.length != probabilities.length}
+     * @throws NotPositiveException if probability of at least one value is negative.
      * @throws MathArithmeticException if the probabilities sum to zero.
-     * @throws MathIllegalArgumentException if probability of at least one value
-     * is infinite.
+     * @throws MathIllegalArgumentException if probability of at least one value is infinite.
      */
     public DiscreteIntegerDistribution(final RandomGenerator rng,
                                        final int[] singletons, final double[] probabilities)
@@ -200,9 +194,6 @@ public class DiscreteIntegerDistribution
         return true;
     }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
     public int sample() {
         return innerDistribution.sample();

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/DiscreteRealDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/DiscreteRealDistribution.java?rev=1455716&r1=1455715&r2=1455716&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/DiscreteRealDistribution.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/DiscreteRealDistribution.java
Tue Mar 12 21:12:21 2013
@@ -28,11 +28,11 @@ import org.apache.commons.math3.util.Pai
 
 /**
  * Implementation of the discrete distribution on the reals.
+ * <p>
+ * Note: values with zero-probability are allowed but they do not extend the support.
  *
- * Note: values with zero-probability are allowed but they do not extend the
- * support.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Probability_distribution#Discrete_probability_distribution">Discrete
probability distribution (Wikipedia)</a>
+ * @see <a href="http://en.wikipedia.org/wiki/Probability_distribution#Discrete_probability_distribution">
+ * Discrete probability distribution (Wikipedia)</a>
  * @see <a href="http://mathworld.wolfram.com/DiscreteDistribution.html">Discrete Distribution
(MathWorld)</a>
  * @version $Id$
  * @since 3.2
@@ -54,16 +54,14 @@ public class DiscreteRealDistribution ex
      *
      * @param singletons array of random variable values.
      * @param probabilities array of probabilities.
-     * @throws DimensionMismatchException if
-     * {@code singletons.length != probabilities.length}
-     * @throws NotPositiveException if probability of at least one value is
-     * negative.
+     * @throws DimensionMismatchException if {@code singletons.length != probabilities.length}
+     * @throws NotPositiveException if probability of at least one value is negative.
      * @throws MathArithmeticException if the probabilities sum to zero.
-     * @throws MathIllegalArgumentException if probability of at least one value
-     * is infinite.
+     * @throws MathIllegalArgumentException if probability of at least one value is infinite.
      */
     public DiscreteRealDistribution(final double[] singletons, final double[] probabilities)
-        throws DimensionMismatchException, NotPositiveException, MathArithmeticException,
MathIllegalArgumentException {
+            throws DimensionMismatchException, NotPositiveException, MathArithmeticException,
+            MathIllegalArgumentException {
         this(new Well19937c(), singletons, probabilities);
     }
 
@@ -74,13 +72,10 @@ public class DiscreteRealDistribution ex
      * @param rng random number generator.
      * @param singletons array of random variable values.
      * @param probabilities array of probabilities.
-     * @throws DimensionMismatchException if
-     * {@code singletons.length != probabilities.length}
-     * @throws NotPositiveException if probability of at least one value is
-     * negative.
+     * @throws DimensionMismatchException if {@code singletons.length != probabilities.length}
+     * @throws NotPositiveException if probability of at least one value is negative.
      * @throws MathArithmeticException if the probabilities sum to zero.
-     * @throws MathIllegalArgumentException if probability of at least one value
-     * is infinite.
+     * @throws MathIllegalArgumentException if probability of at least one value is infinite.
      */
     public DiscreteRealDistribution(final RandomGenerator rng,
                                     final double[] singletons, final double[] probabilities)
@@ -99,9 +94,6 @@ public class DiscreteRealDistribution ex
         innerDistribution = new DiscreteDistribution<Double>(rng, samples);
     }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
     public double probability(final double x) {
         return innerDistribution.probability(x);
@@ -236,9 +228,6 @@ public class DiscreteRealDistribution ex
         return true;
     }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
     public double sample() {
         return innerDistribution.sample();



Mime
View raw message