Author: brentworden
Date: Thu Jun  7 06:44:09 2007
New Revision: 545179

URL: http://svn.apache.org/viewvc?view=rev&rev=545179
Log:
Removed dependency on DistributionFactory.  Added settable gamma distribution 
field.

Modified:
    
jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java

Modified: 
jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java?view=diff&rev=545179&r1=545178&r2=545179
==============================================================================
--- 
jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java
 (original)
+++ 
jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java
 Thu Jun  7 06:44:09 2007
@@ -37,12 +37,22 @@
     
     /**
      * Create a Chi-Squared distribution with the given degrees of freedom.
-     * @param degreesOfFreedom degrees of freedom.
+     * @param df degrees of freedom.
      */
-    public ChiSquaredDistributionImpl(double degreesOfFreedom) {
+    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
+     */
+    public ChiSquaredDistributionImpl(double df, GammaDistribution g) {
         super();
-        setGamma(DistributionFactory.newInstance().createGammaDistribution(
-            degreesOfFreedom / 2.0, 2.0));
+        setGamma(g);
+        setDegreesOfFreedom(df);
     }
     
     /**
@@ -161,11 +171,14 @@
     }
     
     /**
-     * Modify the Gamma distribution.
-     * @param gamma the new distribution.
+     * 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 setGamma(GammaDistribution gamma) {
-        this.gamma = gamma;
+    public void setGamma(GammaDistribution g) {
+        this.gamma = g;
+        
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to