Author: erans
Date: Sun Sep 26 21:53:56 2010
New Revision: 1001533

URL: http://svn.apache.org/viewvc?rev=1001533&view=rev
Log:
MATH-349
Removed deprecated code.

Modified:
    
commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ChiSquaredDistribution.java
    
commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java
    
commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java
    commons/proper/math/trunk/src/site/xdoc/changes.xml
    
commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ChiSquareDistributionTest.java

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ChiSquaredDistribution.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ChiSquaredDistribution.java?rev=1001533&r1=1001532&r2=1001533&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ChiSquaredDistribution.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ChiSquaredDistribution.java
 Sun Sep 26 21:53:56 2010
@@ -29,15 +29,7 @@ package org.apache.commons.math.distribu
  *
  * @version $Revision$ $Date$
  */
-public interface ChiSquaredDistribution extends ContinuousDistribution, 
HasDensity<Double> {
-    /**
-     * Modify the degrees of freedom.
-     * @param degreesOfFreedom the new degrees of freedom.
-     * @deprecated as of v2.1
-     */
-    @Deprecated
-    void setDegreesOfFreedom(double degreesOfFreedom);
-
+public interface ChiSquaredDistribution extends ContinuousDistribution {
     /**
      * Access the degrees of freedom.
      * @return the degrees of freedom.
@@ -49,5 +41,5 @@ public interface ChiSquaredDistribution 
      * @param x  The point at which the density should be computed.
      * @return  The pdf at point x.
      */
-    double density(Double x);
+    double density(double x);
 }

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java?rev=1001533&r1=1001532&r2=1001533&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java
 Sun Sep 26 21:53:56 2010
@@ -28,73 +28,46 @@ import org.apache.commons.math.MathExcep
 public class ChiSquaredDistributionImpl
     extends AbstractContinuousDistribution
     implements ChiSquaredDistribution, Serializable  {
-
     /**
      * Default inverse cumulative probability accuracy
      * @since 2.1
      */
     public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
-
     /** Serializable version identifier */
     private static final long serialVersionUID = -8352658048349159782L;
-
     /** Internal Gamma distribution. */
     private GammaDistribution gamma;
-
     /** Inverse cumulative probability accuracy */
     private final double solverAbsoluteAccuracy;
 
     /**
      * Create a Chi-Squared distribution with the given degrees of freedom.
-     * @param df degrees of freedom.
+     *
+     * @param degreesOfFreedom Degrees of freedom.
      */
-    public ChiSquaredDistributionImpl(double df) {
-        this(df, new GammaDistributionImpl(df / 2.0, 2.0));
-    }
-
-    /**
-     * Create a Chi-Squared distribution with the given degrees of freedom.
-     * @param df degrees of freedom.
-     * @param g the underlying gamma distribution used to compute 
probabilities.
-     * @since 1.2
-     * @deprecated as of 2.1 (to avoid possibly inconsistent state, the
-     * "GammaDistribution" will be instantiated internally)
-     */
-    @Deprecated
-    public ChiSquaredDistributionImpl(double df, GammaDistribution g) {
-        super();
-        setGammaInternal(g);
-        setDegreesOfFreedomInternal(df);
-        solverAbsoluteAccuracy = DEFAULT_INVERSE_ABSOLUTE_ACCURACY;
+    public ChiSquaredDistributionImpl(double degreesOfFreedom) {
+        this(degreesOfFreedom, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
     }
 
     /**
      * Create a Chi-Squared distribution with the given degrees of freedom and
      * inverse cumulative probability accuracy.
-     * @param df degrees of freedom.
-     * @param inverseCumAccuracy the maximum absolute error in inverse 
cumulative probability estimates
-     * (defaults to {...@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY})
+     *
+     * @param degreesOfFreedom Degrees of freedom.
+     * @param inverseCumAccuracy the maximum absolute error in inverse
+     * cumulative probability estimates (defaults to
+     * {...@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
      * @since 2.1
      */
-    public ChiSquaredDistributionImpl(double df, double inverseCumAccuracy) {
-        super();
-        gamma = new GammaDistributionImpl(df / 2.0, 2.0);
-        setDegreesOfFreedomInternal(df);
+    public ChiSquaredDistributionImpl(double degreesOfFreedom,
+                                      double inverseCumAccuracy) {
+        gamma = new GammaDistributionImpl(degreesOfFreedom / 2, 2);
         solverAbsoluteAccuracy = inverseCumAccuracy;
     }
 
     /**
      * Modify the degrees of freedom.
      * @param degreesOfFreedom the new degrees of freedom.
-     * @deprecated as of 2.1 (class will become immutable in 3.0)
-     */
-    @Deprecated
-    public void setDegreesOfFreedom(double degreesOfFreedom) {
-        setDegreesOfFreedomInternal(degreesOfFreedom);
-    }
-    /**
-     * Modify the degrees of freedom.
-     * @param degreesOfFreedom the new degrees of freedom.
      */
     private void setDegreesOfFreedomInternal(double degreesOfFreedom) {
         gamma.setAlpha(degreesOfFreedom / 2.0);
@@ -113,17 +86,6 @@ public class ChiSquaredDistributionImpl
      *
      * @param x The point at which the density should be computed.
      * @return The pdf at point x.
-     * @deprecated
-     */
-    public double density(Double x) {
-        return density(x.doubleValue());
-    }
-
-    /**
-     * Return the probability density for a particular point.
-     *
-     * @param x The point at which the density should be computed.
-     * @return The pdf at point x.
      * @since 2.1
      */
     @Override
@@ -235,29 +197,6 @@ public class ChiSquaredDistributionImpl
     }
 
     /**
-     * Modify the underlying gamma distribution.  The caller is responsible for
-     * insuring the gamma distribution has the proper parameter settings.
-     * @param g the new distribution.
-     * @since 1.2 made public
-     * @deprecated as of 2.1 (class will become immutable in 3.0)
-     */
-    @Deprecated
-    public void setGamma(GammaDistribution g) {
-        setGammaInternal(g);
-    }
-    /**
-     * Modify the underlying gamma distribution.  The caller is responsible for
-     * insuring the gamma distribution has the proper parameter settings.
-     * @param g the new distribution.
-     * @since 1.2 made public
-     */
-    private void setGammaInternal(GammaDistribution g) {
-        this.gamma = g;
-
-    }
-
-
-    /**
      * Return the absolute accuracy setting of the solver used to estimate
      * inverse cumulative probabilities.
      *

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java?rev=1001533&r1=1001532&r2=1001533&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/ChiSquareTestImpl.java
 Sun Sep 26 21:53:56 2010
@@ -114,7 +114,7 @@ public class ChiSquareTestImpl implement
      */
     public double chiSquareTest(double[] expected, long[] observed)
         throws IllegalArgumentException, MathException {
-        distribution.setDegreesOfFreedom(expected.length - 1.0);
+        distribution = new ChiSquaredDistributionImpl(expected.length - 1.0);
         return 1.0 - distribution.cumulativeProbability(
             chiSquare(expected, observed));
     }
@@ -189,7 +189,7 @@ public class ChiSquareTestImpl implement
     throws IllegalArgumentException, MathException {
         checkArray(counts);
         double df = ((double) counts.length -1) * ((double) counts[0].length - 
1);
-        distribution.setDegreesOfFreedom(df);
+        distribution = new ChiSquaredDistributionImpl(df);
         return 1 - distribution.cumulativeProbability(chiSquare(counts));
     }
 
@@ -292,7 +292,7 @@ public class ChiSquareTestImpl implement
      */
     public double chiSquareTestDataSetsComparison(long[] observed1, long[] 
observed2)
         throws IllegalArgumentException, MathException {
-        distribution.setDegreesOfFreedom((double) observed1.length - 1);
+        distribution = new ChiSquaredDistributionImpl((double) 
observed1.length - 1);
         return 1 - distribution.cumulativeProbability(
                 chiSquareDataSetsComparison(observed1, observed2));
     }

Modified: commons/proper/math/trunk/src/site/xdoc/changes.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/changes.xml?rev=1001533&r1=1001532&r2=1001533&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/changes.xml Sun Sep 26 21:53:56 2010
@@ -52,6 +52,9 @@ The <action> type attribute can be add,u
     If the output is not quite correct, check for invisible trailing spaces!
      -->
     <release version="3.0" date="TBD" description="TBD">
+      <action dev="erans" type="fix" issue="MATH-349">
+        "ChiSquaredDistributionImpl" and "PoissonDistributionImpl" are 
immutable.
+      </action>
       <action dev="erans" type="update" issue="MATH-195">
         Created "MatrixDimensionMismatch" to replace "InvalidMatrixException"
         (when the latter is used to signal a row or column dimension mismatch).

Modified: 
commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ChiSquareDistributionTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ChiSquareDistributionTest.java?rev=1001533&r1=1001532&r2=1001533&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ChiSquareDistributionTest.java
 (original)
+++ 
commons/proper/math/trunk/src/test/java/org/apache/commons/math/distribution/ChiSquareDistributionTest.java
 Sun Sep 26 21:53:56 2010
@@ -103,14 +103,6 @@ public class ChiSquareDistributionTest e
     public void testDfAccessors() {
         ChiSquaredDistribution distribution = (ChiSquaredDistribution) 
getDistribution();
         assertEquals(5d, distribution.getDegreesOfFreedom(), Double.MIN_VALUE);
-        distribution.setDegreesOfFreedom(4d);
-        assertEquals(4d, distribution.getDegreesOfFreedom(), Double.MIN_VALUE);
-        try {
-            distribution.setDegreesOfFreedom(0d);
-            fail("Expecting IllegalArgumentException for df = 0");
-        } catch (IllegalArgumentException ex) {
-            // expected
-        }
     }
 
     public void testDensity() {


Reply via email to