2012/6/9 Luc Maisonobe <luc.maison...@free.fr>:
> Le 09/06/2012 02:48, Gilles Sadowski a écrit :
>> 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?
>
> OK.
>
> Luc
>
Sounds good to me!
Sébastien


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

Reply via email to