You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Phil Steitz (JIRA)" <ji...@apache.org> on 2015/04/12 21:15:12 UTC

[jira] [Comment Edited] (MATH-1205) AbstractStorelessUnivariateStatistic should not extend AbstractUnivariateStatistic

    [ https://issues.apache.org/jira/browse/MATH-1205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14491663#comment-14491663 ] 

Phil Steitz edited comment on MATH-1205 at 4/12/15 7:15 PM:
------------------------------------------------------------

The storedData field was introduced in 2.2 because in Percentile we needed to sort and just working on the actual parameter was, well, dubious.  It may not be depended on by other impls; but the fact that the impl gets a copy instead of a reference to the actual parameter is a *good thing*, so +1 to keeping it and in fact just renaming (if necessary) AbstractUnivariateStatistic instead of extending it. There is no need for this excess hierarchy now that the storeless classes no longer extend AUS.  I would be +0 to just leaving things alone (leave AUS as is, but break the inheritance of ASUS).  

I am +0 on just dropping the equals/hc impls.

Otherwise, +1 for  the proposed changes.

I like the changelog style you have, but I would reference this ticket on each entry.


was (Author: psteitz):
The storedData field was introduced in 2.2 because in Percentile we needed to sort and just working on the actual parameter was, well, dubious.  It may not be depended on by other impls; but the fact that the impl gets a copy instead of a reference to the actual parameter is a *good thing*, so +1 to keeping it and if fact just renaming (if necessary) AbstractUnivariateStatistic instead of extending it. There is no need for this excess hierarchy now that the storeless classes no longer extend AUS.  I would be +0 to just leaving things alone (leave AUS as is, but break the inheritance of ASUS).  

Otherwise, +1 for  the proposed changes.

I like the changelog style you have, but I would reference this ticket on each entry.

> AbstractStorelessUnivariateStatistic should not extend AbstractUnivariateStatistic
> ----------------------------------------------------------------------------------
>
>                 Key: MATH-1205
>                 URL: https://issues.apache.org/jira/browse/MATH-1205
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.4.1
>            Reporter: Thomas Neidhart
>         Attachments: MATH-1205_v2.patch
>
>
> For a storeless statistic it is wrong to extend AbstractUnivariateStatistic as various fields and methods are inherited that do not make sense in case of a storeless statistic.
> This means a user can accidentially use a storeless statistic in a wrong way:
> {code}
>         Mean mean = new Mean();
>         
>         mean.increment(1);
>         mean.increment(2);
>         
>         mean.setData(new double[] { 1, 2, 3});
>         
>         System.out.println(mean.getResult());
>         System.out.println(mean.evaluate());
> {code}
> will output
> {noformat}
> 1.5
> 2.0
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)