You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2008/12/24 12:55:42 UTC

svn commit: r729301 - /commons/proper/math/trunk/src/java/org/apache/commons/math/ode/events/EventState.java

Author: luc
Date: Wed Dec 24 03:55:42 2008
New Revision: 729301

URL: http://svn.apache.org/viewvc?rev=729301&view=rev
Log:
replaced use of deprecated method

Modified:
    commons/proper/math/trunk/src/java/org/apache/commons/math/ode/events/EventState.java

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/ode/events/EventState.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/ode/events/EventState.java?rev=729301&r1=729300&r2=729301&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/ode/events/EventState.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/ode/events/EventState.java Wed Dec 24 03:55:42 2008
@@ -23,7 +23,6 @@
 import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.analysis.BrentSolver;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
-import org.apache.commons.math.analysis.UnivariateRealSolver;
 import org.apache.commons.math.ode.DerivativeException;
 import org.apache.commons.math.ode.sampling.StepInterpolator;
 
@@ -192,7 +191,7 @@
                     // variation direction, with respect to the integration direction
                     increasing = (gb >= ga);
 
-                    final UnivariateRealSolver solver = new BrentSolver(new UnivariateRealFunction() {
+                    final UnivariateRealFunction f = new UnivariateRealFunction() {
                         public double value(final double t) throws FunctionEvaluationException {
                             try {
                                 interpolator.setInterpolatedTime(t);
@@ -203,10 +202,11 @@
                                 throw new FunctionEvaluationException(t, e);
                             }
                         }
-                    });
+                    };
+                    final BrentSolver solver = new BrentSolver();
                     solver.setAbsoluteAccuracy(convergence);
                     solver.setMaximalIterationCount(maxIterationCount);
-                    final double root = (ta <= tb) ? solver.solve(ta, tb) : solver.solve(tb, ta);
+                    final double root = (ta <= tb) ? solver.solve(f, ta, tb) : solver.solve(f, tb, ta);
                     if (Math.abs(root - ta) <= convergence) {
                         // we have found (again ?) a past event, we simply ignore it
                         ta = tb;