commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <gil...@harfang.homelinux.org>
Subject Re: svn commit: r1042596 - in /commons/proper/math/trunk/src/main/java/org/apache/commons/math: analysis/solvers/ distribution/
Date Mon, 06 Dec 2010 22:27:08 GMT
Hi.

> > Log:
> > MATH-452
> > Made all static variables (accuracies) "private".
> 
> 
> We have already started a discussion on a similar point some months ago.
> Last message is here: <http://markmail.org/message/m4l7v4pdfp5yn3as>,
> but we did not really conclude.
> 
> To summarize my point from a few months ago, one use case for these
> public values is that a use program can do something like this to first
> initialize a Graphical User Interface, then let the user change the
> values he wants, and later retrieve the actual values (which may be
> unchanged) to build the solver.
> 
> // initialize GUI
> solverGui.setRelAccuracy(BaseAbstractUnivariateRealSolver.DEFAULT_RELATIVE_ACCURACY);
> solverGui.setAbsAccuracy(BaseAbstractUnivariateRealSolver.DEFAULT_ABSOLUTE_ACCURACY);
> 
> // fire the GUI
> ...
> 
> // in the action callback from the GUI OK button, create the solver
> double rel = solverGui.getRelAccuracy();
> double abs = solverGui.getAbsAccuracy();
> BrentSolver mySolver = new BrentSolver(rel, abs);
> 
> 
> Another simpler use case is simply to have the default value available
> in the Javadoc without being forced to get commons-math sources.
> 
> So I still consider this kind of public constats are usefule. Despite
> the fact within commons-math they are used only in some constructors,
> the fact they are public allow them to be also used in user code.

I think that we can satisfy this use-case without exposing the variables:

---CUT---
> BrentSolver mySolver = new BrentSolver();
> 
> // initialize GUI
> solverGui.setRelAccuracy(mySolver.getRelativeAccuracy());
> solverGui.setAbsAccuracy(mySolver.getAbsoluteAccuracy());
> 
> // fire the GUI
> ...
> 
> // in the action callback from the GUI OK button, create the solver
> double rel = solverGui.getRelAccuracy();
> double abs = solverGui.getAbsAccuracy();
> 
> mySolver = new BrentSolver(rel, abs);
---CUT---


Regards,
Gilles

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message