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

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

     [ https://issues.apache.org/jira/browse/MATH-1205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Neidhart resolved MATH-1205.
-----------------------------------
       Resolution: Fixed
    Fix Version/s: 4.0

Committed patch with discussed changes in commit 845e1d54231d3ff3fb04bdbf5dc5f6b631d9b01e.

> 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
>             Fix For: 4.0
>
>         Attachments: AbstractCachingUnivariateStatistic.java, 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)