You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by md...@apache.org on 2003/09/27 06:13:34 UTC

cvs commit: jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat/distribution AbstractContinuousDistribution.java

mdiggory    2003/09/26 21:13:34

  Modified:    math/src/test/org/apache/commons/math/stat
                        BeanListUnivariateImplTest.java FrequencyTest.java
               math/src/java/org/apache/commons/math/analysis
                        ConvergenceException.java
               math/src/java/org/apache/commons/math/stat
                        UnivariateImpl.java Frequency.java
                        AbstractUnivariate.java StoreUnivariateImpl.java
                        BeanListUnivariateImpl.java ListUnivariateImpl.java
               math/src/test/org/apache/commons/math/stat/distribution
                        GammaDistributionTest.java
               math     build.xml project.xml
               math/src/java/org/apache/commons/math/util
                        DefaultTransformer.java BeanTransformer.java
               math/src/test/org/apache/commons/math/analysis
                        BisectionSolverTest.java RealSolverTest.java
               math/src/java/org/apache/commons/math
                        MathConfigurationException.java MathException.java
               math/src/java/org/apache/commons/math/stat/distribution
                        AbstractContinuousDistribution.java
  Added:       math/src/java/org/apache/commons/math/analysis
                        UnivariateRealSolverUtils.java
               math/src/test/org/apache/commons/math/util TestBean.java
                        BeanTransformerTest.java
                        DefaultTransformerTest.java TransformerMapTest.java
               math/src/test/org/apache/commons/math
                        MathConfigurationExceptionTest.java
                        MathExceptionTest.java
               math/src/test/org/apache/commons/math/analysis
                        ConvergenceExceptionTest.java
                        UnivariateRealSolverUtilsTest.java
  Removed:     math/src/java/org/apache/commons/math/analysis
                        RootFinding.java UnivariateRealSolverUtil.java
  Log:
  PR: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23187
  Obtained from:
  Submitted by:	Brent Worden 
  Reviewed by:	Mark Diggory
  
  Revision  Changes    Path
  1.5       +8 -1      jakarta-commons-sandbox/math/src/test/org/apache/commons/math/stat/BeanListUnivariateImplTest.java
  
  Index: BeanListUnivariateImplTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/src/test/org/apache/commons/math/stat/BeanListUnivariateImplTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BeanListUnivariateImplTest.java	17 Sep 2003 19:29:32 -0000	1.4
  +++ BeanListUnivariateImplTest.java	27 Sep 2003 04:13:33 -0000	1.5
  @@ -137,5 +137,12 @@
                         ageU.getMax(), 0.001 );
   
       }
  +    
  +    public void testSetPropertyName(){
  +        BeanListUnivariateImpl u = new BeanListUnivariateImpl(null);
  +        String expected = "property";
  +        u.setPropertyName(expected);
  +        assertEquals(expected, u.getPropertyName());
  +    }
   }
   
  
  
  
  1.3       +47 -3     jakarta-commons-sandbox/math/src/test/org/apache/commons/math/stat/FrequencyTest.java
  
  Index: FrequencyTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/src/test/org/apache/commons/math/stat/FrequencyTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FrequencyTest.java	7 Jul 2003 23:19:19 -0000	1.2
  +++ FrequencyTest.java	27 Sep 2003 04:13:33 -0000	1.3
  @@ -53,6 +53,10 @@
    */
   package org.apache.commons.math.stat;
   
  +import java.io.BufferedReader;
  +import java.io.IOException;
  +import java.io.StringReader;
  +
   import junit.framework.Test;
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
  @@ -103,7 +107,7 @@
       
       /** test pcts */
       public void testPcts() {
  -        Frequency f = new Frequency("test counts"); 
  +        Frequency f = new Frequency("test pcts"); 
           f.addValue(oneL);
           f.addValue(twoL);
           f.addValue(oneI);
  @@ -116,6 +120,46 @@
           assertEquals("two pct",0.25,f.getPct("2"),tolerance);
           assertEquals("foo pct",0.5,f.getPct("foo"),tolerance);
           assertEquals("bar pct",0,f.getPct("bar"),tolerance);
  -    }      
  +    }
  +    
  +    /**
  +     * 
  +     */
  +    public void testToString(){
  +        Frequency f = new Frequency("test toString"); 
  +        f.addValue(oneL);
  +        f.addValue(twoL);
  +        f.addValue(oneI);
  +        f.addValue(twoI);
  +        
  +        String s = f.toString();
  +        assertNotNull(s);
  +        BufferedReader reader = new BufferedReader(new StringReader(s));
  +        try {
  +            String line = reader.readLine(); // header line
  +            assertNotNull(line);
  +            
  +            line = reader.readLine(); // one's or two's line
  +            assertNotNull(line);
  +                        
  +            line = reader.readLine(); // one's or two's line
  +            assertNotNull(line);
  +
  +            line = reader.readLine(); // no more elements
  +            assertNull(line);
  +        } catch(IOException ex){
  +            fail(ex.getMessage());
  +        }        
  +    }
  +    
  +    /**
  +     * 
  +     */
  +    public void testSetName(){
  +        String name = "name";
  +        Frequency f = new Frequency();
  +        f.setName(name);
  +        assertEquals(name, f.getName());
  +    }              
   }
   
  
  
  
  1.3       +20 -3     jakarta-commons-sandbox/math/src/java/org/apache/commons/math/analysis/ConvergenceException.java
  
  Index: ConvergenceException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/src/java/org/apache/commons/math/analysis/ConvergenceException.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConvergenceException.java	9 Jul 2003 20:02:43 -0000	1.2
  +++ ConvergenceException.java	27 Sep 2003 04:13:33 -0000	1.3
  @@ -53,19 +53,28 @@
    */
   package org.apache.commons.math.analysis;
   
  +import org.apache.commons.lang.exception.NestableRuntimeException;
  +
   /**
    * Error thrown when a numerical computation can not be performed because the
    * numerical result failed to converge to a finite value.
    * 
    * @version $Revision$ $Date$
    */
  -public class ConvergenceException extends RuntimeException {
  +public class ConvergenceException extends NestableRuntimeException {
  +    /**
  +     * Default constructor.
  +     */
  +    public ConvergenceException() {
  +        this(null, null);
  +    }
  +    
       /**
        * Construct an exception with the given message.
        * @param message descriptive error message. 
        */
       public ConvergenceException(String message) {
  -        super(message);
  +        this(message, null);
       }
   
       /**
  @@ -75,6 +84,14 @@
        */
       public ConvergenceException(String message, Throwable cause) {
           super(message, cause);
  +    }
  +
  +    /**
  +     * Create an exception with a given root cause.
  +     * @param throwable caught exception causing this problem
  +     */
  +    public ConvergenceException(Throwable throwable) {
  +        this(null, throwable);
       }
   
   }
  
  
  
  1.1                  jakarta-commons-sandbox/math/src/java/org/apache/commons/math/analysis/UnivariateRealSolverUtils.java
  
  Index: UnivariateRealSolverUtils.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.commons.math.analysis;
  
  import org.apache.commons.math.MathException;
  
  /**
   * Utility routines for {@link UnivariateRealSolver} objects.
   * @version $Revision: 1.1 $ $Date: 2003/09/27 04:13:33 $
   */
  public class UnivariateRealSolverUtils {
      /**
       * Default constructor.
       */
      private UnivariateRealSolverUtils() {
          super();
      }
  
      /**
       * Method to solve for zeros of real univariate functions.  A
       * default solver is created and used for solving. 
       * @param f the function.
       * @param x0 the lower bound for the interval.
       * @param x1 the upper bound for the interval.
       * @return a value where the function is zero.
       * @throws MathException if the iteration count was exceeded or the
       *         solver detects convergence problems otherwise.
       */
      public static double solve(UnivariateRealFunction f, double x0, double x1)
          throws MathException
      {
          if(f == null){
              throw new IllegalArgumentException("f can not be null.");    
          }
          
          return UnivariateRealSolverFactory.newInstance().newDefaultSolver(f)
              .solve(x0, x1);
      }
  
      /**
       * Convience method to solve for zeros of real univariate functions.  A
       * default solver is created and used for solving. 
       * @param f the function.
       * @param x0 the lower bound for the interval.
       * @param x1 the upper bound for the interval.
       * @param absoluteAccuracy the accuracy to be used by the solver.
       * @return a value where the function is zero.
       * @throws MathException if the iteration count was exceeded or the
       *         solver detects convergence problems otherwise.
       */
      public static double solve(
          UnivariateRealFunction f,
          double x0,
          double x1,
          double absoluteAccuracy)
          throws MathException
      {
          if(f == null){
              throw new IllegalArgumentException("f can not be null.");    
          }
              
          UnivariateRealSolver solver = UnivariateRealSolverFactory.newInstance()
              .newDefaultSolver(f);
          solver.setAbsoluteAccuracy(absoluteAccuracy);
          return solver.solve(x0, x1);
      }
  
      /**
       * For a function, f, this method returns two values, a and b that bracket
       * a root of f.  That is to say, there exists a value c between a and b
       * such that f(c) = 0.
       *
       * @param function the function
       * @param initial midpoint of the returned range.
       * @param lowerBound for numerical safety, a never is less than this value.
       * @param upperBound for numerical safety, b never is greater than this
       *                   value.
       * @return a two element array holding {a, b}.
       * @throws MathException if a root can not be bracketted.
       */
      public static double[] bracket(UnivariateRealFunction function,
                                     double initial,
                                     double lowerBound,
                                     double upperBound) throws MathException {
          return bracket( function, initial, lowerBound, upperBound,
              Integer.MAX_VALUE ) ;
      }
  
      /**
       * For a function, f, this method returns two values, a and b that bracket
       * a root of f.  That is to say, there exists a value c between a and b
       * such that f(c) = 0.
       *
       * @param function the function
       * @param initial midpoint of the returned range.
       * @param lowerBound for numerical safety, a never is less than this value.
       * @param upperBound for numerical safety, b never is greater than this
       *                   value.
       * @param maximumIterations to guard against infinite looping, maximum
       *                          number of iterations to perform
       * @return a two element array holding {a, b}.
       * @throws MathException if a root can not be bracketted.
       */
      public static double[] bracket(UnivariateRealFunction function,
                                     double initial,
                                     double lowerBound,
                                     double upperBound,
                                     int maximumIterations) throws MathException {
          double a = initial;
          double b = initial;
          double fa;
          double fb;
          int numIterations = 0 ;
      
          do {
              a = Math.max(a - 1.0, lowerBound);
              b = Math.min(b + 1.0, upperBound);
              fa = function.value(a);
              fb = function.value(b);
              numIterations += 1 ;
          } while ( (fa * fb > 0.0) && ( numIterations < maximumIterations ) );
      
          return new double[]{a, b};
      }
  }
  
  
  
  1.21      +5 -3      jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat/UnivariateImpl.java
  
  Index: UnivariateImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat/UnivariateImpl.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- UnivariateImpl.java	26 Sep 2003 19:30:32 -0000	1.20
  +++ UnivariateImpl.java	27 Sep 2003 04:13:33 -0000	1.21
  @@ -161,8 +161,10 @@
           }
       }
   
  -    /* (non-Javadoc)
  -     * @see org.apache.commons.math.stat.AbstractUnivariate#apply(org.apache.commons.math.stat.univariate.UnivariateStatistic)
  +    /**
  +     * Apply the given statistic to this univariate collection.
  +     * @param stat the statistic to apply
  +     * @return the computed value of the statistic.
        */
       public double apply(UnivariateStatistic stat) {
           
  
  
  
  1.5       +2 -2      jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat/Frequency.java
  
  Index: Frequency.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat/Frequency.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Frequency.java	9 Jul 2003 21:45:23 -0000	1.4
  +++ Frequency.java	27 Sep 2003 04:13:33 -0000	1.5
  @@ -85,7 +85,7 @@
        */
       public Frequency(String name) {
           super();
  -        this.name = name;
  +        setName(name);
       }
   
       /**
  
  
  
  1.4       +6 -1      jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat/AbstractUnivariate.java
  
  Index: AbstractUnivariate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat/AbstractUnivariate.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractUnivariate.java	26 Sep 2003 19:30:32 -0000	1.3
  +++ AbstractUnivariate.java	27 Sep 2003 04:13:33 -0000	1.4
  @@ -140,6 +140,11 @@
           setWindowSize(window);
       }
   
  +    /**
  +     * Apply the given statistic to this univariate collection.
  +     * @param stat the statistic to apply
  +     * @return the computed value of the statistic.
  +     */
       public abstract double apply(UnivariateStatistic stat);
       
   
  
  
  
  1.8       +5 -3      jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat/StoreUnivariateImpl.java
  
  Index: StoreUnivariateImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat/StoreUnivariateImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StoreUnivariateImpl.java	26 Sep 2003 19:30:32 -0000	1.7
  +++ StoreUnivariateImpl.java	27 Sep 2003 04:13:33 -0000	1.8
  @@ -144,8 +144,10 @@
           }
       }
   
  -    /* (non-Javadoc)
  -     * @see org.apache.commons.math.stat.AbstractUnivariate#apply(org.apache.commons.math.stat.univariate.UnivariateStatistic)
  +    /**
  +     * Apply the given statistic to this univariate collection.
  +     * @param stat the statistic to apply
  +     * @return the computed value of the statistic.
        */
       public double apply(UnivariateStatistic stat) {
           if (eDA != null) {
  
  
  
  1.7       +3 -5      jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat/BeanListUnivariateImpl.java
  
  Index: BeanListUnivariateImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat/BeanListUnivariateImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- BeanListUnivariateImpl.java	26 Sep 2003 19:30:32 -0000	1.6
  +++ BeanListUnivariateImpl.java	27 Sep 2003 04:13:33 -0000	1.7
  @@ -77,7 +77,7 @@
        * @param list Backing List
        */
       public BeanListUnivariateImpl(List list) {
  -        super(list);
  +        this(list, null);
       }
   
       /**
  @@ -89,7 +89,6 @@
       public BeanListUnivariateImpl(List list, String propertyName) {
           super(list);
           setPropertyName(propertyName);
  -        this.transformer = new BeanTransformer(propertyName);
       }
   
       /**
  @@ -103,9 +102,8 @@
        * @param propertyName Name of Property
        */
       public void setPropertyName(String propertyName) {
  -        System.out.println("Set prop name; " + propertyName);
           this.propertyName = propertyName;
  -        this.transformer = new BeanTransformer(propertyName);
  +        setTransformer(new BeanTransformer(propertyName));
       }
   
       /**
  
  
  
  1.7       +6 -6      jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat/ListUnivariateImpl.java
  
  Index: ListUnivariateImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat/ListUnivariateImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ListUnivariateImpl.java	26 Sep 2003 19:30:32 -0000	1.6
  +++ ListUnivariateImpl.java	27 Sep 2003 04:13:33 -0000	1.7
  @@ -80,9 +80,7 @@
        * @param list The list that will back this Univariate
        */
       public ListUnivariateImpl(List list) {
  -        super();
  -        this.list = list;
  -        transformer = new DefaultTransformer();
  +        this(list, new DefaultTransformer());
       }
       
       /**
  @@ -188,8 +186,10 @@
           list.clear();
       }
       
  -    /* (non-Javadoc)
  -     * @see org.apache.commons.math.stat.AbstractUnivariate#apply(org.apache.commons.math.stat.univariate.UnivariateStatistic)
  +    /**
  +     * Apply the given statistic to this univariate collection.
  +     * @param stat the statistic to apply
  +     * @return the computed value of the statistic.
        */
       public double apply(UnivariateStatistic stat) {
           double[] v = this.getValues();
  
  
  
  1.5       +17 -12    jakarta-commons-sandbox/math/src/test/org/apache/commons/math/stat/distribution/GammaDistributionTest.java
  
  Index: GammaDistributionTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/src/test/org/apache/commons/math/stat/distribution/GammaDistributionTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- GammaDistributionTest.java	17 Sep 2003 19:29:30 -0000	1.4
  +++ GammaDistributionTest.java	27 Sep 2003 04:13:33 -0000	1.5
  @@ -60,23 +60,28 @@
    * @version $Revision$ $Date$
    */
   public class GammaDistributionTest extends TestCase {
  -	/**
  -	 * Constructor for ChiSquareDistributionTest.
  -	 * @param name
  -	 */
  -	public GammaDistributionTest(String name) {
  -		super(name);
  -	}
  -
       public void testProbabilities(){
  -        testProbability(15.5, 4.0, 2.0, .9499);
  -        testProbability( 0.5, 4.0, 1.0, .0018);
  -        testProbability(10.0, 1.0, 2.0, .9933);
  -        testProbability( 5.0, 2.0, 2.0, .7127);
  +        testProbability(-1.000, 4.0, 2.0, .0000);
  +        testProbability(15.501, 4.0, 2.0, .9499);
  +        testProbability( 0.504, 4.0, 1.0, .0018);
  +        testProbability(10.011, 1.0, 2.0, .9933);
  +        testProbability( 5.000, 2.0, 2.0, .7127);
       }
       
  +    public void testValues(){
  +        testValue(15.501, 4.0, 2.0, .9499);
  +        testValue( 0.504, 4.0, 1.0, .0018);
  +        testValue(10.011, 1.0, 2.0, .9933);
  +        testValue( 5.000, 2.0, 2.0, .7127);
  +    }
  +            
       private void testProbability(double x, double a, double b, double expected){
           double actual = DistributionFactory.newInstance().createGammaDistribution(a, b).cummulativeProbability(x);
           assertEquals("probability for " + x, expected, actual, 10e-4);
  +    }
  +
  +    private void testValue(double expected, double a, double b, double p){
  +        double actual = DistributionFactory.newInstance().createGammaDistribution(a, b).inverseCummulativeProbability(p);
  +        assertEquals("critical value for " + p, expected, actual, 10e-4);
       }
   }
  
  
  
  1.7       +5 -3      jakarta-commons-sandbox/math/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/build.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- build.xml	17 Sep 2003 19:29:28 -0000	1.6
  +++ build.xml	27 Sep 2003 04:13:34 -0000	1.7
  @@ -2,7 +2,7 @@
   
   <!--
     build.xml generated by maven from project.xml version 0.1-dev
  -  on date September 17 2003, time 1526
  +  on date September 27 2003, time 0007
   -->
   
   <project default="jar" name="commons-math" basedir=".">
  @@ -149,13 +149,15 @@
       </javadoc>
     </target>
     <target name="get-deps" unless="noget" depends="init">
  -    <get dest="${libdir}/commons-beanutils-SNAPSHOT.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/commons-beanutils/jars/commons-beanutils-SNAPSHOT.jar">
  +    <get dest="${libdir}/commons-beanutils-1.5.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/commons-beanutils/jars/commons-beanutils-1.5.jar">
       </get>
       <get dest="${libdir}/commons-collections-SNAPSHOT.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/commons-collections/jars/commons-collections-SNAPSHOT.jar">
       </get>
  -    <get dest="${libdir}/commons-discovery-SNAPSHOT.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/commons-discovery/jars/commons-discovery-SNAPSHOT.jar">
  +    <get dest="${libdir}/commons-lang-SNAPSHOT.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/commons-lang/jars/commons-lang-SNAPSHOT.jar">
       </get>
       <get dest="${libdir}/commons-logging-1.0.3.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/commons-logging/jars/commons-logging-1.0.3.jar">
  +    </get>
  +    <get dest="${libdir}/commons-discovery-SNAPSHOT.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/commons-discovery/jars/commons-discovery-SNAPSHOT.jar">
       </get>
       <get dest="${libdir}/junit-3.8.1.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/junit/jars/junit-3.8.1.jar">
       </get>
  
  
  
  1.26      +130 -131  jakarta-commons-sandbox/math/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/project.xml,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- project.xml	26 Sep 2003 19:30:32 -0000	1.25
  +++ project.xml	27 Sep 2003 04:13:34 -0000	1.26
  @@ -1,134 +1,133 @@
   <?xml version="1.0" encoding="UTF-8"?>
   <!-- $Revision$ $Date$ -->
   <project>
  -	<extend>../../jakarta-commons/project.xml</extend>
  -	<name>Math</name>
  -	<id>commons-math</id>
  -	<currentVersion>0.1-dev</currentVersion>
  -	<inceptionYear>2003</inceptionYear>
  -	<logo/>
  -	<shortDescription>A library of lightweight, self-contained mathematics and
  -		statistics components.</shortDescription>
  -	<description>The Math project is a library of lightweight, self-contained
  -		mathematics and statistics components addressing the most common practical
  -		problems not immediately available in the Java programming language or
  -		commons-lang.</description>
  -	<siteDirectory>/www/jakarta.apache.org/commons/sandbox/math/</siteDirectory>
  -	<versions>
  -		<version>
  -			<id>0.1-dev</id>
  -			<name>0.1-dev</name>
  -		</version>
  -	</versions>
  -	<developers>
  -		<developer>
  -			<name>Robert Burrell Donkin</name>
  -			<id>rdonkin</id>
  -			<email>rdonkin@apache.org</email>
  -		</developer>
  -		<developer>
  -			<name>Tim OBrien</name>
  -			<id>tobrien</id>
  -			<email>tobrien@apache.org</email>
  -		</developer>
  -		<developer>
  -			<name>Mark R. Diggory</name>
  -			<id>mdiggory</id>
  -			<email>mdiggory@apache.org</email>
  -		</developer>
  -		<developer>
  -			<name>J.Pietschmann</name>
  -			<id>pietsch</id>
  -			<email>pietsch@apache.org</email>
  -			<email>j3322ptm@yahoo.de</email>
  -		</developer>
  -	</developers>
  -	<contributors>
  -		<contributor>
  -			<name>Phil Steitz</name>
  -			<email>phil@steitz.com</email>
  -			<roles>
  -				<role>proposal author</role>
  -				<role>initial contributor</role>
  -			</roles>
  -		</contributor>
  -		<contributor>
  -			<name>Brent Worden</name>
  -			<email>brent@worden.org</email>
  -		</contributor>
  -		<contributor>
  -			<name>Albert Davidson Chou</name>
  -			<email>hotfusionman@yahoo.com</email>
  -		</contributor>
  -	</contributors>
  -	<dependencies>
  -		<dependency>
  -			<id>commons-beanutils</id>
  -			<version>SNAPSHOT</version>
  -		</dependency>
  -		<dependency>
  -			<id>commons-collections</id>
  -			<version>SNAPSHOT</version>
  -		</dependency>
  -		<dependency>
  -			<id>commons-discovery</id>
  -			<version>SNAPSHOT</version>
  -		</dependency>
  -		<dependency>
  -			<id>commons-logging</id>
  -			<version>1.0.3</version>
  -		</dependency>
  -	</dependencies>
  -	<issueTrackingUrl>http://nagoya.apache.org/bugzilla/buglist.cgi?bug_status=NEW&amp;
  -		bug_status=ASSIGNED&amp;bug_status=REOPENED&amp;email1=&amp;
  -		emailtype1=substring&amp;emailassigned_to1=1&amp;email2=&amp;
  -		emailtype2=substring&amp;emailreporter2=1&amp;bugidtype=include&amp;bug_id=&amp;
  -		changedin=&amp;votes=&amp;chfieldfrom=&amp;chfieldto=Now&amp;chfieldvalue=&amp;
  -		product=Commons&amp;component=Sandbox&amp;short_desc=&amp;
  -		short_desc_type=allwordssubstr&amp;long_desc=&amp;
  -		long_desc_type=allwordssubstr&amp;bug_file_loc=&amp;
  -		bug_file_loc_type=allwordssubstr&amp;keywords=&amp;keywords_type=anywords&amp;
  -		field0-0-0=noop&amp;type0-0-0=noop&amp;value0-0-0=&amp;cmdtype=doit&amp;
  -		order=%27Importance%27</issueTrackingUrl>
  -	<repository>
  -		<connection>
  -			scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:jakarta-commons-sandbox/${pom.artifactId.substring(8)}</connection>
  -		<url>
  -			http://cvs.apache.org/viewcvs/jakarta-commons-sandbox/${pom.artifactId.substring(8)}/</url>
  -	</repository>
  -	<build>
  -		<unitTest>
  -			<includes>
  -				<include>**/*Test.java</include>
  -			</includes>
  -			<excludes>
  -				<exclude>**/*AbstractTest.java</exclude>
  -			</excludes>
  -			<resources>
  -				<resource>
  -					<directory>${pom.build.unitTestSourceDirectory}</directory>
  -					<includes>
  -						<include>**/*.xml</include>
  -						<include>**/*.txt</include>
  -					</includes>
  -				</resource>
  -			</resources>
  -		</unitTest>
  -	</build>
  -	<reports>
  -		<report>maven-changelog-plugin</report>
  -		<report>maven-changes-plugin</report>
  -		<report>maven-checkstyle-plugin</report>
  -		<!--   <report>maven-clover-plugin</report> -->
  -		<report>maven-developer-activity-plugin</report>
  -		<report>maven-file-activity-plugin</report>
  -		<report>maven-javadoc-plugin</report>
  -		<report>maven-jdepend-plugin</report>
  -		<report>maven-junit-report-plugin</report>
  -		<report>maven-jxr-plugin</report>
  -		<report>maven-license-plugin</report>
  -		<!--   <report>maven-linkcheck-plugin</report> -->
  -		<report>maven-statcvs-plugin</report>
  -		<report>maven-tasklist-plugin</report>
  -	</reports>
  +  <extend>../../jakarta-commons/project.xml</extend>
  +  <name>Math</name>
  +  <id>commons-math</id>
  +  <currentVersion>0.1-dev</currentVersion>
  +  <inceptionYear>2003</inceptionYear>
  +  <logo/>
  +  <shortDescription>
  +A library of lightweight, self-contained mathematics and statistics components.
  +  </shortDescription>
  +  <description>
  +The Math project is a library of lightweight, self-contained mathematics and statistics components addressing the most common practical problems not immediately available in the Java programming language or commons-lang.
  +  </description>
  +  <siteDirectory>/www/jakarta.apache.org/commons/sandbox/math/</siteDirectory>
  +  <versions>
  +    <version>
  +      <id>0.1-dev</id>
  +      <name>0.1-dev</name>
  +    </version>
  +  </versions>
  +
  +  <developers>
  +    <developer>
  +      <name>Robert Burrell Donkin</name>
  +      <id>rdonkin</id>
  +      <email>rdonkin@apache.org</email>
  +    </developer>
  +    <developer>
  +      <name>Tim OBrien</name>
  +      <id>tobrien</id>
  +      <email>tobrien@apache.org</email>
  +    </developer>
  +    <developer>
  +      <name>Mark R. Diggory</name>
  +      <id>mdiggory</id>
  +      <email>mdiggory@apache.org</email>
  +    </developer>    
  +  </developers>
  +
  +  <contributors>
  +   <contributor>
  +     <name>Phil Steitz</name>
  +     <email>phil@steitz.com</email>
  +     <roles>
  +        <role>proposal author</role> 
  +        <role>initial contributor</role>
  +     </roles>   
  +   </contributor>
  +   <contributor>
  +     <name>Brent Worden</name>
  +     <email>brent@worden.org</email>
  +   </contributor>
  +   <contributor>
  +     <name>Albert Davidson Chou</name>
  +     <email>hotfusionman@yahoo.com</email>
  +   </contributor>
  +   <contributor>
  +     <name>J.Pietschmann</name>
  +     <email>j3322ptm@yahoo.de</email>
  +   </contributor>
  +  </contributors>  
  +
  +  <dependencies>
  +    <dependency>
  +      <id>commons-beanutils</id>
  +      <version>1.5</version>
  +    </dependency>
  +    <dependency>
  +      <id>commons-collections</id>
  +      <version>SNAPSHOT</version>
  +    </dependency>
  +    <dependency>
  +      <id>commons-lang</id>
  +      <version>SNAPSHOT</version>
  +    </dependency>
  +    <dependency>
  +      <id>commons-logging</id>
  +      <version>1.0.3</version>
  +    </dependency>
  +    <dependency>
  +      <id>commons-discovery</id>
  +      <version>SNAPSHOT</version>
  +	</dependency>
  +  </dependencies>
  +
  +  <issueTrackingUrl>http://nagoya.apache.org/bugzilla/buglist.cgi?bug_status=NEW&amp;bug_status=ASSIGNED&amp;bug_status=REOPENED&amp;email1=&amp;emailtype1=substring&amp;emailassigned_to1=1&amp;email2=&amp;emailtype2=substring&amp;emailreporter2=1&amp;bugidtype=include&amp;bug_id=&amp;changedin=&amp;votes=&amp;chfieldfrom=&amp;chfieldto=Now&amp;chfieldvalue=&amp;product=Commons&amp;component=Sandbox&amp;short_desc=&amp;short_desc_type=allwordssubstr&amp;long_desc=&amp;long_desc_type=allwordssubstr&amp;bug_file_loc=&amp;bug_file_loc_type=allwordssubstr&amp;keywords=&amp;keywords_type=anywords&amp;field0-0-0=noop&amp;type0-0-0=noop&amp;value0-0-0=&amp;cmdtype=doit&amp;order=%27Importance%27</issueTrackingUrl>
  +
  +  <repository>
  +    <connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:jakarta-commons-sandbox/${pom.artifactId.substring(8)}</connection>
  +    <url>http://cvs.apache.org/viewcvs/jakarta-commons-sandbox/${pom.artifactId.substring(8)}/</url>
  +  </repository>
  +  
  +  <build>
  +    <unitTest>
  +      <includes>
  +        <include>**/*Test.java</include>
  +      </includes>
  +      <excludes>
  +        <exclude>**/*AbstractTest.java</exclude>
  +      </excludes>
  +      <resources>
  +         <resource>
  +            <directory>${pom.build.unitTestSourceDirectory}</directory>
  +            <includes>
  +              <include>**/*.xml</include>
  +              <include>**/*.txt</include>
  +            </includes>
  +         </resource>
  +      </resources>
  +    </unitTest>
  +  </build>
  +
  +  <reports>
  +   <report>maven-changelog-plugin</report> 
  +   <report>maven-changes-plugin</report>
  +   <report>maven-checkstyle-plugin</report>
  +   <report>maven-developer-activity-plugin</report>
  +   <report>maven-file-activity-plugin</report> 
  +   <report>maven-javadoc-plugin</report>
  +   <report>maven-jdepend-plugin</report> 
  +   <report>maven-junit-report-plugin</report>
  +   <report>maven-jxr-plugin</report>
  +   <report>maven-license-plugin</report>
  +   <report>maven-statcvs-plugin</report>
  +   <report>maven-tasklist-plugin</report>
  +<!--
  +   <report>maven-clover-plugin</report>
  +	 <report>maven-linkcheck-plugin</report>
  +-->
  +  </reports>
   </project>
  
  
  
  1.4       +14 -12    jakarta-commons-sandbox/math/src/java/org/apache/commons/math/util/DefaultTransformer.java
  
  Index: DefaultTransformer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/src/java/org/apache/commons/math/util/DefaultTransformer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultTransformer.java	9 Jul 2003 20:04:12 -0000	1.3
  +++ DefaultTransformer.java	27 Sep 2003 04:13:34 -0000	1.4
  @@ -51,28 +51,30 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  +
   package org.apache.commons.math.util;
   
  +import org.apache.commons.beanutils.ConversionException;
  +import org.apache.commons.beanutils.converters.DoubleConverter;
  +
   /**
    * A Default NumberTransformer for java.lang.Numbers and Numeric Strings. 
    * @version $Revision$ $Date$
    */
   public class DefaultTransformer implements NumberTransformer {
  -
  +    /** Converter used to transform objects. */
  +    private static final DoubleConverter converter =
  +        new DoubleConverter(new Double(Double.NaN));
  +    
       /**
        * @see org.apache.commons.collections.Transformer#transform(java.lang.Object)
        */
       public double transform(Object o) {
  -        double d = Double.NaN;
  -
  -        if (o instanceof Number) {
  -            return ((Number) o).doubleValue();
  -        } else {
  -            try {
  -                d = Double.parseDouble(o.toString());
  -            } catch (Exception e) {
  -                e.printStackTrace();
  -            }
  +        double d;
  +        try {
  +            d = ((Double)converter.convert(Double.class, o)).doubleValue();
  +        } catch(ConversionException ex){
  +            d = Double.NaN;
           }
           return d;
       }
  
  
  
  1.6       +27 -23    jakarta-commons-sandbox/math/src/java/org/apache/commons/math/util/BeanTransformer.java
  
  Index: BeanTransformer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/src/java/org/apache/commons/math/util/BeanTransformer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BeanTransformer.java	17 Sep 2003 19:19:09 -0000	1.5
  +++ BeanTransformer.java	27 Sep 2003 04:13:34 -0000	1.6
  @@ -55,7 +55,7 @@
   
   import java.lang.reflect.InvocationTargetException;
   import org.apache.commons.beanutils.PropertyUtils;
  -import org.apache.commons.math.MathException;
  +import org.apache.commons.logging.LogFactory;
   
   /**
    * Uses PropertyUtils to map a Bean getter to a double value.
  @@ -72,7 +72,7 @@
        * Create a BeanTransformer
        */
       public BeanTransformer() {
  -        super();
  +        this(null);
       }
   
       /**
  @@ -80,26 +80,8 @@
        * @param property The property.
        */
       public BeanTransformer(final String property) {
  -        this.propertyName = property;
  -    }
  -
  -    /**
  -     * @see org.apache.commons.math.util.NumberTransformer#transform(java.lang.Object)
  -     */
  -    public double transform(final Object o) throws MathException {
  -        double d = Double.NaN;
  -        try {
  -            d =
  -                ((Number) PropertyUtils.getProperty(o, propertyName))
  -                    .doubleValue();
  -        } catch (IllegalAccessException e) {
  -            throw new MathException(e.getMessage(),e);
  -        } catch (InvocationTargetException e) {
  -            throw new MathException(e.getMessage(),e);
  -        } catch (NoSuchMethodException e) {
  -            throw new MathException(e.getMessage(),e);
  -        }
  -        return d;
  +        super();
  +        setPropertyName(property);
       }
   
       /**
  @@ -118,4 +100,26 @@
           propertyName = string;
       }
   
  +    /**
  +     * @see org.apache.commons.math.util.NumberTransformer#transform(java.lang.Object)
  +     */
  +    public double transform(final Object o) {
  +        double d = Double.NaN;
  +        try {
  +            d =
  +                ((Number) PropertyUtils.getProperty(o, getPropertyName()))
  +                    .doubleValue();
  +        } catch (IllegalAccessException e) {
  +            LogFactory.getLog(getClass()).error(
  +                "Property can not be accessed.  Using NaN.", e);
  +        } catch (InvocationTargetException e) {
  +            LogFactory.getLog(getClass()).error(
  +                "Property accessor method threw an exception.  Using NaN.", e);
  +            e.printStackTrace();
  +        } catch (NoSuchMethodException e) {
  +            LogFactory.getLog(getClass()).error(
  +                "Property accessor method does not exist.  Using NaN.", e);
  +        }
  +        return d;
  +    }
   }
  
  
  
  1.1                  jakarta-commons-sandbox/math/src/test/org/apache/commons/math/util/TestBean.java
  
  Index: TestBean.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.commons.math.util;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/09/27 04:13:34 $
   */
  public class TestBean {
      private Double x = new Double(1.0);
      
      private String y = "1.0";
      
      private Double z = new Double(2.0);
      
      /**
       * 
       */
      public Double getX() {
          return x;
      }
  
      /**
       * 
       */
      public String getY() {
          return y;
      }
  
      /**
       * 
       */
      public void setX(Double double1) {
          x = double1;
      }
  
      /**
       * 
       */
      public void setY(String string) {
          y = string;
      }
      
      /**
       * 
       */
      public Double getZ() {
          throw new RuntimeException();
      }
  
      /**
       * 
       */
      public void setZ(Double double1) {
          z = double1;
      }
  
  }
  
  
  
  1.1                  jakarta-commons-sandbox/math/src/test/org/apache/commons/math/util/BeanTransformerTest.java
  
  Index: BeanTransformerTest.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.commons.math.util;
  
  import org.apache.commons.math.TestUtils;
  
  import junit.framework.TestCase;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/09/27 04:13:34 $
   */
  public class BeanTransformerTest extends TestCase {
      
      /**
       *
       */
      public void testConstructor(){
          BeanTransformer b = new BeanTransformer();
          assertNull(b.getPropertyName());
      }
      
      /**
       *
       */
      public void testConstructorString(){
          String name = "property";
          BeanTransformer b = new BeanTransformer(name);
          assertEquals(name, b.getPropertyName());
      }
      
      /**
       *
       */
      public void testSetPropertyName(){
          String name = "property";
          BeanTransformer b = new BeanTransformer();
          b.setPropertyName(name);
          assertEquals(name, b.getPropertyName());
      }
      
      /**
       * 
       */
      public void testTransformNoSuchMethod(){
          BeanTransformer b = new BeanTransformer("z");
          TestBean target = new TestBean();
          double value = b.transform(target);
          TestUtils.assertEquals(Double.NaN, value, 1.0e-2);
      }
      
      /**
       * 
       */
      public void testTransform(){
          BeanTransformer b = new BeanTransformer("x");
          TestBean target = new TestBean();
          double value = b.transform(target);
          TestUtils.assertEquals(1.0, value, 1.0e-2);
      }
      
      /**
       * 
       */
      public void testTransformInvocationError(){
          BeanTransformer b = new BeanTransformer("z");
          TestBean target = new TestBean();
          double value = b.transform(target);
          TestUtils.assertEquals(Double.NaN, value, 1.0e-2);
      }
      
      /**
       * 
       */
      public void testTransformInvalidType(){
          BeanTransformer b = new BeanTransformer("y");
          TestBean target = new TestBean();
          try {
              b.transform(target);
              fail();
          } catch(ClassCastException ex){
              // success
          }
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/math/src/test/org/apache/commons/math/util/DefaultTransformerTest.java
  
  Index: DefaultTransformerTest.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.commons.math.util;
  
  import java.math.BigDecimal;
  
  import org.apache.commons.math.TestUtils;
  
  import junit.framework.TestCase;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/09/27 04:13:34 $
   */
  public class DefaultTransformerTest extends TestCase {
      /**
       * 
       */
      public void testTransformDouble(){
          double expected = 1.0;
          Double input = new Double(expected);
          DefaultTransformer t = new DefaultTransformer();
          assertEquals(expected, t.transform(input), 1.0e-4);
      }
      
      /**
       * 
       */
      public void testTransformNull(){
          double expected = Double.NaN;
          DefaultTransformer t = new DefaultTransformer();
          TestUtils.assertEquals(expected, t.transform(null), 1.0e-4);
      }
      
      /**
       * 
       */
      public void testTransformInteger(){
          double expected = 1.0;
          Integer input = new Integer(1);
          DefaultTransformer t = new DefaultTransformer();
          assertEquals(expected, t.transform(input), 1.0e-4);
      }        
      
      /**
       * 
       */
      public void testTransformBigDecimal(){
          double expected = 1.0;
          BigDecimal input = new BigDecimal("1.0");
          DefaultTransformer t = new DefaultTransformer();
          assertEquals(expected, t.transform(input), 1.0e-4);
      }        
      
      /**
       * 
       */
      public void testTransformString(){
          double expected = 1.0;
          String input = "1.0";
          DefaultTransformer t = new DefaultTransformer();
          assertEquals(expected, t.transform(input), 1.0e-4);
      }
      
      /**
       * 
       */
      public void testTransformObject(){
          double expected = Double.NaN;
          Boolean input = Boolean.TRUE;
          DefaultTransformer t = new DefaultTransformer();
          TestUtils.assertEquals(expected, t.transform(input), 1.0e-4);
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/math/src/test/org/apache/commons/math/util/TransformerMapTest.java
  
  Index: TransformerMapTest.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.commons.math.util;
  
  import junit.framework.TestCase;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/09/27 04:13:34 $
   */
  public class TransformerMapTest extends TestCase {
      /**
       * 
       */
      public void testPutTransformer(){
          NumberTransformer expected = new DefaultTransformer();
          
          TransformerMap map = new TransformerMap();
          map.putTransformer(TransformerMapTest.class, expected);
          assertEquals(expected, map.getTransformer(TransformerMapTest.class));
      }
      
      /**
       * 
       */
      public void testContainsClass(){
          NumberTransformer expected = new DefaultTransformer();
          TransformerMap map = new TransformerMap();
          map.putTransformer(TransformerMapTest.class, expected);
          assertTrue(map.containsClass(TransformerMapTest.class));
      }
      
      /**
       * 
       */
      public void testContainsTransformer(){
          NumberTransformer expected = new DefaultTransformer();
          TransformerMap map = new TransformerMap();
          map.putTransformer(TransformerMapTest.class, expected);
          assertTrue(map.containsTransformer(expected));
      }
  
      /**
       * 
       */
      public void testRemoveTransformer(){
          NumberTransformer expected = new DefaultTransformer();
          
          TransformerMap map = new TransformerMap();
          map.putTransformer(TransformerMapTest.class, expected);
          assertTrue(map.containsClass(TransformerMapTest.class));
          assertTrue(map.containsTransformer(expected));
          map.removeTransformer(TransformerMapTest.class);
          assertFalse(map.containsClass(TransformerMapTest.class));
          assertFalse(map.containsTransformer(expected));
      }
  
      /**
       * 
       */
      public void testClear(){
          NumberTransformer expected = new DefaultTransformer();
          
          TransformerMap map = new TransformerMap();
          map.putTransformer(TransformerMapTest.class, expected);
          assertTrue(map.containsClass(TransformerMapTest.class));
          map.clear();
          assertFalse(map.containsClass(TransformerMapTest.class));
      }
      
      /**
       * 
       */
      public void testClasses(){
          NumberTransformer expected = new DefaultTransformer();
          TransformerMap map = new TransformerMap();
          map.putTransformer(TransformerMapTest.class, expected);
          assertTrue(map.classes().contains(TransformerMapTest.class));
      }
      
      /**
       * 
       */
      public void testTransformers(){
          NumberTransformer expected = new DefaultTransformer();
          TransformerMap map = new TransformerMap();
          map.putTransformer(TransformerMapTest.class, expected);
          assertTrue(map.transformers().contains(expected));
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/math/src/test/org/apache/commons/math/MathConfigurationExceptionTest.java
  
  Index: MathConfigurationExceptionTest.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.commons.math;
  
  import junit.framework.TestCase;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/09/27 04:13:34 $
   */
  public class MathConfigurationExceptionTest extends TestCase {
      /**
       * 
       */
      public void testConstructor(){
          MathConfigurationException ex = new MathConfigurationException();
          assertNull(ex.getCause());
          assertNull(ex.getMessage());
      }
      
      /**
       * 
       */
      public void testConstructorMessage(){
          String msg = "message";
          MathConfigurationException ex = new MathConfigurationException(msg);
          assertNull(ex.getCause());
          assertEquals(msg, ex.getMessage());
      }
      
      /**
       * 
       */
      public void testConstructorMessageCause(){
          String outMsg = "outer message";
          String inMsg = "inner message";
          Exception cause = new Exception(inMsg);
          MathConfigurationException ex = new MathConfigurationException(outMsg, cause);
          assertEquals(outMsg, ex.getMessage());
          assertEquals(cause, ex.getCause());
      }
      
      /**
       * 
       */
      public void testConstructorCause(){
          String inMsg = "inner message";
          Exception cause = new Exception(inMsg);
          MathConfigurationException ex = new MathConfigurationException(cause);
          assertEquals(cause, ex.getCause());
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/math/src/test/org/apache/commons/math/MathExceptionTest.java
  
  Index: MathExceptionTest.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.commons.math;
  
  import junit.framework.TestCase;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/09/27 04:13:34 $
   */
  public class MathExceptionTest extends TestCase {
      /**
       * 
       */
      public void testConstructor(){
          MathException ex = new MathException();
          assertNull(ex.getCause());
          assertNull(ex.getMessage());
      }
      
      /**
       * 
       */
      public void testConstructorMessage(){
          String msg = "message";
          MathException ex = new MathException(msg);
          assertNull(ex.getCause());
          assertEquals(msg, ex.getMessage());
      }
      
      /**
       * 
       */
      public void testConstructorMessageCause(){
          String outMsg = "outer message";
          String inMsg = "inner message";
          Exception cause = new Exception(inMsg);
          MathException ex = new MathException(outMsg, cause);
          assertEquals(outMsg, ex.getMessage());
          assertEquals(cause, ex.getCause());
      }
      
      /**
       * 
       */
      public void testConstructorCause(){
          String inMsg = "inner message";
          Exception cause = new Exception(inMsg);
          MathException ex = new MathException(cause);
          assertEquals(cause, ex.getCause());
      }
  }
  
  
  
  1.3       +128 -7    jakarta-commons-sandbox/math/src/test/org/apache/commons/math/analysis/BisectionSolverTest.java
  
  Index: BisectionSolverTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/src/test/org/apache/commons/math/analysis/BisectionSolverTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BisectionSolverTest.java	17 Sep 2003 19:29:27 -0000	1.2
  +++ BisectionSolverTest.java	27 Sep 2003 04:13:34 -0000	1.3
  @@ -64,13 +64,6 @@
       /**
        *
        */
  -    public BisectionSolverTest(String name) {
  -        super(name);
  -    }
  -
  -    /**
  -     *
  -     */
       public void testSinZero() throws MathException {
           UnivariateRealFunction f = new SinFunction();
           double result;
  @@ -124,4 +117,132 @@
           result = solver.solve(0.85, 5);
           assertEquals(result, 1.0, solver.getAbsoluteAccuracy());
       }
  +    
  +    /**
  +     * 
  +     */
  +    public void testSetFunctionValueAccuracy(){
  +        double expected = 1.0e-2;
  +        
  +        UnivariateRealFunction f = new QuinticFunction();
  +        UnivariateRealSolver solver = new BisectionSolver(f);
  +        try {
  +            solver.setFunctionValueAccuracy(expected);
  +            assertEquals(expected, solver.getFunctionValueAccuracy(), 1.0e-2);
  +        } catch (MathException ex) {
  +            fail(ex.getMessage());
  +        }
  +    }        
  +    
  +    /**
  +     * 
  +     */
  +    public void testResetFunctionValueAccuracy(){
  +        double newValue = 1.0e-2;
  +        
  +        UnivariateRealFunction f = new QuinticFunction();
  +        UnivariateRealSolver solver = new BisectionSolver(f);
  +        try {
  +            double oldValue = solver.getFunctionValueAccuracy();
  +            solver.setFunctionValueAccuracy(newValue);
  +            solver.resetFunctionValueAccuracy();
  +            assertEquals(oldValue, solver.getFunctionValueAccuracy(), 1.0e-2);
  +        } catch(MathException ex){
  +            fail(ex.getMessage());
  +        }
  +    }        
  +    
  +    /**
  +     * 
  +     */
  +    public void testSetAbsoluteAccuracy(){
  +        double expected = 1.0e-2;
  +        
  +        UnivariateRealFunction f = new QuinticFunction();
  +        UnivariateRealSolver solver = new BisectionSolver(f);
  +        try {
  +            solver.setAbsoluteAccuracy(expected);
  +            assertEquals(expected, solver.getAbsoluteAccuracy(), 1.0e-2);
  +        } catch(MathException ex){
  +            fail(ex.getMessage());
  +        }
  +    }        
  +    
  +    /**
  +     * 
  +     */
  +    public void testResetAbsoluteAccuracy(){
  +        double newValue = 1.0e-2;
  +        
  +        UnivariateRealFunction f = new QuinticFunction();
  +        UnivariateRealSolver solver = new BisectionSolver(f);
  +        try {
  +            double oldValue = solver.getAbsoluteAccuracy();
  +            solver.setAbsoluteAccuracy(newValue);
  +            solver.resetAbsoluteAccuracy();
  +            assertEquals(oldValue, solver.getAbsoluteAccuracy(), 1.0e-2);
  +        } catch(MathException ex){
  +            fail(ex.getMessage());
  +        }
  +    }        
  +    
  +    /**
  +     * 
  +     */
  +    public void testSetMaximalIterationCount(){
  +        int expected = 100;
  +        
  +        UnivariateRealFunction f = new QuinticFunction();
  +        UnivariateRealSolver solver = new BisectionSolver(f);
  +        solver.setMaximalIterationCount(expected);
  +        assertEquals(expected, solver.getMaximalIterationCount());
  +    }        
  +    
  +    /**
  +     * 
  +     */
  +    public void testResetMaximalIterationCount(){
  +        int newValue = 10000;
  +        
  +        UnivariateRealFunction f = new QuinticFunction();
  +        UnivariateRealSolver solver = new BisectionSolver(f);
  +        int oldValue = solver.getMaximalIterationCount();
  +        solver.setMaximalIterationCount(newValue);
  +        solver.resetMaximalIterationCount();
  +        assertEquals(oldValue, solver.getMaximalIterationCount());
  +    }        
  +    
  +    /**
  +     * 
  +     */
  +    public void testSetRelativeAccuracy(){
  +        double expected = 1.0e-2;
  +        
  +        UnivariateRealFunction f = new QuinticFunction();
  +        UnivariateRealSolver solver = new BisectionSolver(f);
  +        try {
  +            solver.setRelativeAccuracy(expected);
  +            assertEquals(expected, solver.getRelativeAccuracy(), 1.0e-2);
  +        } catch(MathException ex){
  +            fail(ex.getMessage());
  +        }
  +    }        
  +    
  +    /**
  +     * 
  +     */
  +    public void testResetRelativeAccuracy(){
  +        double newValue = 1.0e-2;
  +        
  +        UnivariateRealFunction f = new QuinticFunction();
  +        UnivariateRealSolver solver = new BisectionSolver(f);
  +        try {
  +            double oldValue = solver.getRelativeAccuracy();
  +            solver.setRelativeAccuracy(newValue);
  +            solver.resetRelativeAccuracy();
  +            assertEquals(oldValue, solver.getRelativeAccuracy(), 1.0e-2);
  +        } catch(MathException ex){
  +            fail(ex.getMessage());
  +        }
  +    }        
   }
  
  
  
  1.4       +12 -12    jakarta-commons-sandbox/math/src/test/org/apache/commons/math/analysis/RealSolverTest.java
  
  Index: RealSolverTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/src/test/org/apache/commons/math/analysis/RealSolverTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RealSolverTest.java	17 Sep 2003 19:29:27 -0000	1.3
  +++ RealSolverTest.java	27 Sep 2003 04:13:34 -0000	1.4
  @@ -281,27 +281,27 @@
           // 14 iterations on i586 JDK 1.4.1.
           assertTrue(solver.getIterationCount() <= 15);
           // Static solve method
  -        result = UnivariateRealSolverUtil.solve(f, -0.2, 0.2);
  +        result = UnivariateRealSolverUtils.solve(f, -0.2, 0.2);
           assertEquals(result, 0, solver.getAbsoluteAccuracy());
  -        result = UnivariateRealSolverUtil.solve(f, -0.1, 0.3);
  +        result = UnivariateRealSolverUtils.solve(f, -0.1, 0.3);
           Assert.assertEquals(result, 0, 1E-8);
  -        result = UnivariateRealSolverUtil.solve(f, -0.3, 0.45);
  +        result = UnivariateRealSolverUtils.solve(f, -0.3, 0.45);
           Assert.assertEquals(result, 0, 1E-6);
  -        result = UnivariateRealSolverUtil.solve(f, 0.3, 0.7);
  +        result = UnivariateRealSolverUtils.solve(f, 0.3, 0.7);
           Assert.assertEquals(result, 0.5, 1E-6);
  -        result = UnivariateRealSolverUtil.solve(f, 0.2, 0.6);
  +        result = UnivariateRealSolverUtils.solve(f, 0.2, 0.6);
           Assert.assertEquals(result, 0.5, 1E-6);
  -        result = UnivariateRealSolverUtil.solve(f, 0.05, 0.95);
  +        result = UnivariateRealSolverUtils.solve(f, 0.05, 0.95);
           Assert.assertEquals(result, 0.5, 1E-6);
  -        result = UnivariateRealSolverUtil.solve(f, 0.85, 1.25);
  +        result = UnivariateRealSolverUtils.solve(f, 0.85, 1.25);
           Assert.assertEquals(result, 1.0, 1E-6);
  -        result = UnivariateRealSolverUtil.solve(f, 0.8, 1.2);
  +        result = UnivariateRealSolverUtils.solve(f, 0.8, 1.2);
           Assert.assertEquals(result, 1.0, 1E-6);
  -        result = UnivariateRealSolverUtil.solve(f, 0.85, 1.75);
  +        result = UnivariateRealSolverUtils.solve(f, 0.85, 1.75);
           Assert.assertEquals(result, 1.0, 1E-6);
  -        result = UnivariateRealSolverUtil.solve(f, 0.55, 1.45);
  +        result = UnivariateRealSolverUtils.solve(f, 0.55, 1.45);
           Assert.assertEquals(result, 1.0, 1E-6);
  -        result = UnivariateRealSolverUtil.solve(f, 0.85, 5);
  +        result = UnivariateRealSolverUtils.solve(f, 0.85, 5);
           Assert.assertEquals(result, 1.0, 1E-6);
       }
   }
  
  
  
  1.1                  jakarta-commons-sandbox/math/src/test/org/apache/commons/math/analysis/ConvergenceExceptionTest.java
  
  Index: ConvergenceExceptionTest.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.commons.math.analysis;
  
  import junit.framework.TestCase;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/09/27 04:13:34 $
   */
  public class ConvergenceExceptionTest extends TestCase {
      /**
       * 
       */
      public void testConstructor(){
          ConvergenceException ex = new ConvergenceException();
          assertNull(ex.getCause());
          assertNull(ex.getMessage());
      }
      
      /**
       * 
       */
      public void testConstructorMessage(){
          String msg = "message";
          ConvergenceException ex = new ConvergenceException(msg);
          assertNull(ex.getCause());
          assertEquals(msg, ex.getMessage());
      }
      
      /**
       * 
       */
      public void testConstructorMessageCause(){
          String outMsg = "outer message";
          String inMsg = "inner message";
          Exception cause = new Exception(inMsg);
          ConvergenceException ex = new ConvergenceException(outMsg, cause);
          assertEquals(outMsg, ex.getMessage());
          assertEquals(cause, ex.getCause());
      }
      
      /**
       * 
       */
      public void testConstructorCause(){
          String inMsg = "inner message";
          Exception cause = new Exception(inMsg);
          ConvergenceException ex = new ConvergenceException(cause);
          assertEquals(cause, ex.getCause());
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/math/src/test/org/apache/commons/math/analysis/UnivariateRealSolverUtilsTest.java
  
  Index: UnivariateRealSolverUtilsTest.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.commons.math.analysis;
  
  import org.apache.commons.math.MathException;
  
  import junit.framework.TestCase;
  
  /**
   * @version $Revision: 1.1 $ $Date: 2003/09/27 04:13:34 $
   */
  public class UnivariateRealSolverUtilsTest extends TestCase {
      /**
       * 
       */
      public void testSolveNull(){
          try {
              UnivariateRealSolverUtils.solve(null, 0.0, 4.0);
              fail();
          } catch(MathException ex){
              fail("math exception should no be thrown.");
          } catch(IllegalArgumentException ex){
              // success
          }
      }
      
      /**
       * 
       */
      public void testSolveSin(){
          try {
              double x = UnivariateRealSolverUtils.solve(new SinFunction(), 1.0,
                  4.0);
              assertEquals(Math.PI, x, 1.0e-4);
          } catch(MathException ex){
              fail("math exception should no be thrown.");
          }
      }
  
      /**
       * 
       */
      public void testSolveAccuracyNull(){
          try {
              double accuracy = 1.0e-6;
              UnivariateRealSolverUtils.solve(null, 0.0, 4.0, accuracy);
              fail();
          } catch(MathException ex){
              fail("math exception should no be thrown.");
          } catch(IllegalArgumentException ex){
              // success
          }
      }
      
      /**
       * 
       */
      public void testSolveAccuracySin(){
          try {
              double accuracy = 1.0e-6;
              double x = UnivariateRealSolverUtils.solve(new SinFunction(), 1.0,
                  4.0, accuracy);
              assertEquals(Math.PI, x, accuracy);
          } catch(MathException ex){
              fail("math exception should no be thrown.");
          }
      }
  }
  
  
  
  1.7       +4 -4      jakarta-commons-sandbox/math/src/java/org/apache/commons/math/MathConfigurationException.java
  
  Index: MathConfigurationException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/src/java/org/apache/commons/math/MathConfigurationException.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MathConfigurationException.java	9 Aug 2003 04:03:41 -0000	1.6
  +++ MathConfigurationException.java	27 Sep 2003 04:13:34 -0000	1.7
  @@ -63,7 +63,7 @@
        * Default constructor.
        */
       public MathConfigurationException() {
  -        super();
  +        this(null, null);
       }
   
       /**
  @@ -71,7 +71,7 @@
        * @param message message describing the problem
        */
       public MathConfigurationException(final String message) {
  -        super(message);
  +        this(message, null);
       }
   
       /**
  @@ -90,6 +90,6 @@
        * @param throwable caught exception causing this problem
        */
       public MathConfigurationException(final Throwable throwable) {
  -        super(throwable);
  +        this(null, throwable);
       }
   }
  
  
  
  1.6       +10 -6     jakarta-commons-sandbox/math/src/java/org/apache/commons/math/MathException.java
  
  Index: MathException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/src/java/org/apache/commons/math/MathException.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MathException.java	9 Aug 2003 04:03:41 -0000	1.5
  +++ MathException.java	27 Sep 2003 04:13:34 -0000	1.6
  @@ -53,27 +53,31 @@
    */
   package org.apache.commons.math;
   
  +import org.apache.commons.lang.exception.NestableException;
  +
   /**
    * A generic exception indicating problems in the math package.
    * @version $Revision$ $Date$
    */
  -public class MathException extends Exception {
  +public class MathException extends NestableException {
   
       /**
        * Constructs a MathException
        */
       public MathException() {
  -        super();
  +        this(null, null);
       }
   
       /**
  +     * Create an exception with a given error message.
        * @param message message describing the problem
        */
       public MathException(final String message) {
  -        super(message);
  +        this(message, null);
       }
   
       /**
  +     * Create an exception with a given error message and root cause.
        * @param message message describing the problem
        * @param throwable caught exception causing this problem
        */
  @@ -82,10 +86,10 @@
       }
   
       /**
  +     * Create an exception with a given root cause.
        * @param throwable caught exception causing this problem
        */
       public MathException(final Throwable throwable) {
  -        super(throwable);
  +        this(null, throwable);
       }
  -
   }
  
  
  
  1.9       +4 -5      jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat/distribution/AbstractContinuousDistribution.java
  
  Index: AbstractContinuousDistribution.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat/distribution/AbstractContinuousDistribution.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractContinuousDistribution.java	30 Jul 2003 21:58:11 -0000	1.8
  +++ AbstractContinuousDistribution.java	27 Sep 2003 04:13:34 -0000	1.9
  @@ -54,9 +54,8 @@
   package org.apache.commons.math.stat.distribution;
   
   import org.apache.commons.math.MathException;
  -import org.apache.commons.math.analysis.RootFinding;
   import org.apache.commons.math.analysis.UnivariateRealFunction;
  -import org.apache.commons.math.analysis.UnivariateRealSolverUtil;
  +import org.apache.commons.math.analysis.UnivariateRealSolverUtils;
   
   /**
    * Base class for various continuous distributions.  It provides default
  @@ -121,12 +120,12 @@
           
           try {
               // bracket root
  -            double[] bracket = RootFinding.bracket(rootFindingFunction,
  +            double[] bracket = UnivariateRealSolverUtils.bracket(rootFindingFunction,
                   getInitialDomain(p), getDomainLowerBound(p),
                   getDomainUpperBound(p));
               
               // find root
  -            double root = UnivariateRealSolverUtil.solve(
  +            double root = UnivariateRealSolverUtils.solve(
                   rootFindingFunction, bracket[0], bracket[1]);
           
               return root;