Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-1205

AbstractStorelessUnivariateStatistic should not extend AbstractUnivariateStatistic

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.4.1
    • 4.0
    • None
    • None

    Description

      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:

              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());
      

      will output

      1.5
      2.0
      

      Attachments

        1. MATH-1205_v2.patch
          89 kB
          Thomas Neidhart
        2. AbstractCachingUnivariateStatistic.java
          4 kB
          Thomas Neidhart

        Activity

          People

            Unassigned Unassigned
            tn Thomas Neidhart
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: