Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/04/16 18:04:16 (8 years ago)
Author:
mkommend
Message:

#2672: Adapted OnlineAccuracyCalculator to use correct deep cloning pattern.

File:
1 edited

Legend:

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

    r14294 r14372  
    2525
    2626namespace HeuristicLab.Problems.DataAnalysis {
    27   public class OnlineAccuracyCalculator : IOnlineCalculator, IDeepCloneable {
     27  public class OnlineAccuracyCalculator : DeepCloneable, IOnlineCalculator {
    2828
    2929    private int correctlyClassified;
     
    3939    }
    4040
    41     // private constructor used internally by the Clone() method
    42     protected OnlineAccuracyCalculator(OnlineAccuracyCalculator other, Cloner cloner = null) {
    43       correctlyClassified = other.correctlyClassified;
    44       n = other.n;
    45       errorState = other.errorState;
     41    protected OnlineAccuracyCalculator(OnlineAccuracyCalculator original, Cloner cloner)
     42      : base(original, cloner) {
     43      correctlyClassified = original.correctlyClassified;
     44      n = original.n;
     45      errorState = original.errorState;
    4646    }
     47
     48    public override IDeepCloneable Clone(Cloner cloner) {
     49      return new OnlineAccuracyCalculator(this, cloner);
     50    }
     51
    4752
    4853    #region IOnlineCalculator Members
     
    98103    }
    99104
    100     // IDeepCloneable interface members
    101     public object Clone() {
    102       return new OnlineAccuracyCalculator(this);
    103     }
    104 
    105     public IDeepCloneable Clone(Cloner cloner) {
    106       var clone = cloner.GetClone(this);
    107       if (clone == null) {
    108         clone = new OnlineAccuracyCalculator(this);
    109         cloner.RegisterClonedObject(this, clone);
    110       }
    111       return clone;
    112     }
    113105  }
    114106}
Note: See TracChangeset for help on using the changeset viewer.