commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <>
Subject Re: [Math] HarmonicFitter and GaussianFitter
Date Sat, 09 Jun 2012 00:48:45 GMT
On Sat, Jun 09, 2012 at 02:00:42AM +0200, Gilles Sadowski wrote:
> Hi.
> I'm a bit annoyed that "HarmonicFitter" and "GaussianFitter" suffer from the
> same design flaw as "PolynomialFitter", namely that it is possible to call
> the non-overridden "fit" with an argument that is not of the right type
> (i.e. "HarmonicOscillator.Parametric" and "Gaussian.Parametric",
> respectively).
> However we cannot simply remove them as in MATH-800, since those classes
> perform non-trivial computations.
> One possibility is to override the "fit" methods that should not be used,
> and have them throw an exception.
> What do you think?
> Which exception would be most appropriate?

This doesn't work (I should have tested it before sending the message...).

However, I think that using generics might solve the problem:
public class CurveFitter<T extends ParametricUnivariateFunction>

And thus
public class GaussianFitter extends CurveFitter<Gaussian.Parametric>

Then, we could keep "PolynomialFitter".

OK for this change?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message