Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/07/16 17:44:04 (8 years ago)
Author:
mkommend
Message:

#2672: Corrected cloning of online calculators (added missing base ctor calls, moved clone method, renamed other to original, and used the cloner for cloning).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAndVarianceCalculator.cs

    r14376 r14465  
    6767    }
    6868
    69     protected OnlineMeanAndVarianceCalculator(OnlineMeanAndVarianceCalculator other, Cloner cloner = null) {
    70       m_oldS = other.m_oldS;
    71       m_oldM = other.m_oldM;
    72       m_newS = other.m_newS;
    73       m_newM = other.m_newM;
    74       n = other.n;
    75       errorState = other.errorState;
    76       varianceErrorState = other.varianceErrorState;
     69    protected OnlineMeanAndVarianceCalculator(OnlineMeanAndVarianceCalculator original, Cloner cloner = null)
     70      : base(original, cloner) {
     71      m_oldS = original.m_oldS;
     72      m_oldM = original.m_oldM;
     73      m_newS = original.m_newS;
     74      m_newM = original.m_newM;
     75      n = original.n;
     76      errorState = original.errorState;
     77      varianceErrorState = original.varianceErrorState;
     78    }
     79    public override IDeepCloneable Clone(Cloner cloner) {
     80      return new OnlineMeanAndVarianceCalculator(this, cloner);
    7781    }
    7882
     
    117121      varianceErrorState = meanAndVarianceCalculator.VarianceErrorState;
    118122    }
    119 
    120     public override IDeepCloneable Clone(Cloner cloner) {
    121       return new OnlineMeanAndVarianceCalculator(this, cloner);
    122     }
    123123  }
    124124}
Note: See TracChangeset for help on using the changeset viewer.