Changeset 14376


Ignore:
Timestamp:
11/07/16 14:06:02 (6 years ago)
Author:
bburlacu
Message:

#2672: Updated cloning mechanism to conform to the HL standard.

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators
Files:
16 edited

Legend:

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

    r14294 r14376  
    2525
    2626namespace HeuristicLab.Problems.DataAnalysis {
    27   public class ClassificationPerformanceMeasuresCalculator : IDeepCloneable {
     27  public class ClassificationPerformanceMeasuresCalculator : DeepCloneable {
    2828
    2929    public ClassificationPerformanceMeasuresCalculator(string positiveClassName, double positiveClassValue) {
     
    3333    }
    3434
    35     protected ClassificationPerformanceMeasuresCalculator(ClassificationPerformanceMeasuresCalculator original, Cloner cloner = null) {
     35    protected ClassificationPerformanceMeasuresCalculator(ClassificationPerformanceMeasuresCalculator original, Cloner cloner) {
    3636      positiveClassName = original.positiveClassName;
    3737      positiveClassValue = original.positiveClassValue;
     
    148148    }
    149149
    150     // IDeepCloneable interface members
    151     public object Clone() {
    152       return new ClassificationPerformanceMeasuresCalculator(this);
    153     }
    154 
    155     public IDeepCloneable Clone(Cloner cloner) {
    156       var clone = cloner.GetClone(this);
    157       if (clone == null) {
    158         clone = new ClassificationPerformanceMeasuresCalculator(this);
    159         cloner.RegisterClonedObject(this, clone);
    160       }
    161       return clone;
     150    public override IDeepCloneable Clone(Cloner cloner) {
     151      return new ClassificationPerformanceMeasuresCalculator(this, cloner);
    162152    }
    163153  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineBoundedMeanSquaredErrorCalculator.cs

    r14294 r14376  
    2525
    2626namespace HeuristicLab.Problems.DataAnalysis {
    27   public class OnlineBoundedMeanSquaredErrorCalculator : IOnlineCalculator, IDeepCloneable {
     27  public class OnlineBoundedMeanSquaredErrorCalculator : DeepCloneable, IOnlineCalculator {
    2828
    2929    private double errorSum;
     
    4545    }
    4646
    47     protected OnlineBoundedMeanSquaredErrorCalculator(OnlineBoundedMeanSquaredErrorCalculator original, Cloner cloner = null) {
     47    protected OnlineBoundedMeanSquaredErrorCalculator(OnlineBoundedMeanSquaredErrorCalculator original, Cloner cloner) {
    4848      LowerBound = original.LowerBound;
    4949      UpperBound = original.UpperBound;
     
    107107
    108108    // IDeepCloneable interface members
    109     public object Clone() {
    110       return new OnlineBoundedMeanSquaredErrorCalculator(this);
    111     }
    112 
    113     public IDeepCloneable Clone(Cloner cloner) {
    114       var clone = cloner.GetClone(this);
    115       if (clone == null) {
    116         clone = new OnlineBoundedMeanSquaredErrorCalculator(this);
    117         cloner.RegisterClonedObject(this, clone);
    118       }
    119       return clone;
     109    public override IDeepCloneable Clone(Cloner cloner) {
     110      return new OnlineBoundedMeanSquaredErrorCalculator(this, cloner);
    120111    }
    121112  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineCovarianceCalculator.cs

    r14294 r14376  
    2525
    2626namespace HeuristicLab.Problems.DataAnalysis {
    27   public class OnlineCovarianceCalculator : IOnlineCalculator, IDeepCloneable {
     27  public class OnlineCovarianceCalculator : DeepCloneable, IOnlineCalculator {
    2828
    2929    private double xMean, yMean, Cn;
     
    3939    }
    4040
    41     protected OnlineCovarianceCalculator(OnlineCovarianceCalculator other, Cloner cloner = null) {
     41    protected OnlineCovarianceCalculator(OnlineCovarianceCalculator other, Cloner cloner) {
    4242      Cn = other.Cn;
    4343      xMean = other.xMean;
     
    104104    }
    105105
    106     // IDeepCloneable interface members
    107     public object Clone() {
    108       return new OnlineCovarianceCalculator(this);
    109     }
    110 
    111     public IDeepCloneable Clone(Cloner cloner) {
    112       var clone = cloner.GetClone(this);
    113       if (clone == null) {
    114         clone = new OnlineCovarianceCalculator(this);
    115         cloner.RegisterClonedObject(this, clone);
    116       }
    117       return clone;
     106    public override IDeepCloneable Clone(Cloner cloner) {
     107      return new OnlineCovarianceCalculator(this, cloner);
    118108    }
    119109  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineDirectionalSymmetryCalculator.cs

    r14294 r14376  
    2626
    2727namespace HeuristicLab.Problems.DataAnalysis {
    28   public class OnlineDirectionalSymmetryCalculator : IOnlineTimeSeriesCalculator, IDeepCloneable {
     28  public class OnlineDirectionalSymmetryCalculator : DeepCloneable, IOnlineTimeSeriesCalculator {
    2929    private int n;
    3030    private int nCorrect;
     
    123123    }
    124124
    125     // IDeepCloneable interface members
    126     public object Clone() {
    127       return new OnlineDirectionalSymmetryCalculator(this);
    128     }
    129 
    130     public IDeepCloneable Clone(Cloner cloner) {
    131       var clone = cloner.GetClone(this);
    132       if (clone == null) {
    133         clone = new OnlineDirectionalSymmetryCalculator(this);
    134         cloner.RegisterClonedObject(this, clone);
    135       }
    136       return clone;
     125    public override IDeepCloneable Clone(Cloner cloner) {
     126      return new OnlineDirectionalSymmetryCalculator(this, cloner);
    137127    }
    138128  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineLinearScalingParameterCalculator.cs

    r14294 r14376  
    2525
    2626namespace HeuristicLab.Problems.DataAnalysis {
    27   public class OnlineLinearScalingParameterCalculator : IDeepCloneable {
     27  public class OnlineLinearScalingParameterCalculator : DeepCloneable {
    2828
    2929    /// <summary>
     
    126126    }
    127127
    128     // IDeepCloneable interface members
    129     public object Clone() {
    130       var cloner = new Cloner();
     128    public override IDeepCloneable Clone(Cloner cloner) {
    131129      return new OnlineLinearScalingParameterCalculator(this, cloner);
    132     }
    133 
    134     public IDeepCloneable Clone(Cloner cloner) {
    135       var clone = cloner.GetClone(this);
    136       if (clone == null) {
    137         clone = new OnlineLinearScalingParameterCalculator(this, cloner);
    138         cloner.RegisterClonedObject(this, clone);
    139       }
    140       return clone;
    141130    }
    142131  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMaxAbsoluteErrorCalculator.cs

    r14294 r14376  
    2525
    2626namespace HeuristicLab.Problems.DataAnalysis {
    27   public class OnlineMaxAbsoluteErrorCalculator : IOnlineCalculator, IDeepCloneable {
     27  public class OnlineMaxAbsoluteErrorCalculator : DeepCloneable, IOnlineCalculator {
    2828
    2929    private double mae;
     
    9696    }
    9797
    98     // IDeepCloneable interface members
    99     public object Clone() {
    100       return new OnlineMaxAbsoluteErrorCalculator(this);
    101     }
    102 
    103     public IDeepCloneable Clone(Cloner cloner) {
    104       var clone = cloner.GetClone(this);
    105       if (clone == null) {
    106         clone = new OnlineMaxAbsoluteErrorCalculator(this);
    107         cloner.RegisterClonedObject(this, clone);
    108       }
    109       return clone;
     98    public override IDeepCloneable Clone(Cloner cloner) {
     99      return new OnlineMaxAbsoluteErrorCalculator(this, cloner);
    110100    }
    111101  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAbsoluteErrorCalculator.cs

    r14294 r14376  
    2525
    2626namespace HeuristicLab.Problems.DataAnalysis {
    27   public class OnlineMeanAbsoluteErrorCalculator : IOnlineCalculator, IDeepCloneable {
     27  public class OnlineMeanAbsoluteErrorCalculator : DeepCloneable, IOnlineCalculator {
    2828
    2929    private double sae;
     
    9595    }
    9696
    97     // IDeepCloneable interface members
    98     public object Clone() {
    99       return new OnlineMeanAbsoluteErrorCalculator(this);
    100     }
    101 
    102     public IDeepCloneable Clone(Cloner cloner) {
    103       var clone = cloner.GetClone(this);
    104       if (clone == null) {
    105         clone = new OnlineMeanAbsoluteErrorCalculator(this);
    106         cloner.RegisterClonedObject(this, clone);
    107       }
    108       return clone;
     97    public override IDeepCloneable Clone(Cloner cloner) {
     98      return new OnlineMeanAbsoluteErrorCalculator(this, cloner);
    10999    }
    110100  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAbsolutePercentageErrorCalculator.cs

    r14294 r14376  
    2525
    2626namespace HeuristicLab.Problems.DataAnalysis {
    27   public class OnlineMeanAbsolutePercentageErrorCalculator : IOnlineCalculator, IDeepCloneable {
     27  public class OnlineMeanAbsolutePercentageErrorCalculator : DeepCloneable, IOnlineCalculator {
    2828
    2929    private double sre;
     
    9696    }
    9797
    98     // IDeepCloneable interface members
    99     public object Clone() {
    100       return new OnlineMeanAbsolutePercentageErrorCalculator(this);
    101     }
    102 
    103     public IDeepCloneable Clone(Cloner cloner) {
    104       var clone = cloner.GetClone(this);
    105       if (clone == null) {
    106         clone = new OnlineMeanAbsolutePercentageErrorCalculator(this);
    107         cloner.RegisterClonedObject(this, clone);
    108       }
    109       return clone;
     98    public override IDeepCloneable Clone(Cloner cloner) {
     99      return new OnlineMeanAbsolutePercentageErrorCalculator(this, cloner);
    110100    }
    111101  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanAndVarianceCalculator.cs

    r14294 r14376  
    2424
    2525namespace HeuristicLab.Problems.DataAnalysis {
    26   public class OnlineMeanAndVarianceCalculator : IDeepCloneable {
     26  public class OnlineMeanAndVarianceCalculator : DeepCloneable {
    2727
    2828    private double m_oldM, m_newM, m_oldS, m_newS;
     
    118118    }
    119119
    120     // IDeepCloneable members
    121     public object Clone() {
    122       return new OnlineMeanAndVarianceCalculator(this);
    123     }
    124 
    125     public IDeepCloneable Clone(Cloner cloner) {
    126       var clone = cloner.GetClone(this);
    127       if (clone == null) {
    128         clone = new OnlineMeanAndVarianceCalculator(this);
    129         cloner.RegisterClonedObject(this, clone);
    130       }
    131       return clone;
     120    public override IDeepCloneable Clone(Cloner cloner) {
     121      return new OnlineMeanAndVarianceCalculator(this, cloner);
    132122    }
    133123  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanErrorCalculator.cs

    r14294 r14376  
    2525
    2626namespace HeuristicLab.Problems.DataAnalysis {
    27   public class OnlineMeanErrorCalculator : IOnlineCalculator, IDeepCloneable {
     27  public class OnlineMeanErrorCalculator : DeepCloneable, IOnlineCalculator {
    2828
    2929    private readonly OnlineMeanAndVarianceCalculator meanAndVarianceCalculator;
     
    8080    }
    8181
    82     // IDeepCloneable members
    83     public object Clone() {
    84       var cloner = new Cloner();
     82    public override IDeepCloneable Clone(Cloner cloner) {
    8583      return new OnlineMeanErrorCalculator(this, cloner);
    86     }
    87 
    88     public IDeepCloneable Clone(Cloner cloner) {
    89       var clone = cloner.GetClone(this);
    90       if (clone == null) {
    91         clone = new OnlineMeanErrorCalculator(this, cloner);
    92         cloner.RegisterClonedObject(this, clone);
    93       }
    94       return clone;
    9584    }
    9685  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMeanSquaredErrorCalculator.cs

    r14294 r14376  
    2525
    2626namespace HeuristicLab.Problems.DataAnalysis {
    27   public class OnlineMeanSquaredErrorCalculator : IOnlineCalculator, IDeepCloneable {
     27  public class OnlineMeanSquaredErrorCalculator : DeepCloneable, IOnlineCalculator {
    2828
    2929    private double sse;
     
    9595    }
    9696
    97     // IDeepCloneable members
    98     public object Clone() {
    99       return new OnlineMeanSquaredErrorCalculator(this);
    100     }
    101 
    102     public IDeepCloneable Clone(Cloner cloner) {
    103       var clone = cloner.GetClone(this);
    104       if (clone == null) {
    105         clone = new OnlineMeanSquaredErrorCalculator(this);
    106         cloner.RegisterClonedObject(this, clone);
    107       }
    108       return clone;
     97    public override IDeepCloneable Clone(Cloner cloner) {
     98      return new OnlineMeanSquaredErrorCalculator(this, cloner);
    10999    }
    110100  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineNormalizedMeanSquaredErrorCalculator.cs

    r14295 r14376  
    2525
    2626namespace HeuristicLab.Problems.DataAnalysis {
    27   public class OnlineNormalizedMeanSquaredErrorCalculator : IOnlineCalculator, IDeepCloneable {
     27  public class OnlineNormalizedMeanSquaredErrorCalculator : DeepCloneable, IOnlineCalculator {
    2828    private OnlineMeanAndVarianceCalculator meanSquaredErrorCalculator;
    2929    private OnlineMeanAndVarianceCalculator originalVarianceCalculator;
     
    9999    }
    100100
    101     // IDeepCloneable members
    102     public object Clone() {
    103       var cloner = new Cloner();
     101    public override IDeepCloneable Clone(Cloner cloner) {
    104102      return new OnlineNormalizedMeanSquaredErrorCalculator(this, cloner);
    105     }
    106 
    107     public IDeepCloneable Clone(Cloner cloner) {
    108       var clone = cloner.GetClone(this);
    109       if (clone == null) {
    110         clone = new OnlineNormalizedMeanSquaredErrorCalculator(this, cloner);
    111         cloner.RegisterClonedObject(this, clone);
    112       }
    113       return clone;
    114103    }
    115104  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlinePearsonsRCalculator.cs

    r14294 r14376  
    2525
    2626namespace HeuristicLab.Problems.DataAnalysis {
    27   public class OnlinePearsonsRCalculator : IOnlineCalculator, IDeepCloneable {
     27  public class OnlinePearsonsRCalculator : DeepCloneable, IOnlineCalculator {
    2828    private OnlineCovarianceCalculator covCalculator = new OnlineCovarianceCalculator();
    2929    private OnlineMeanAndVarianceCalculator sxCalculator = new OnlineMeanAndVarianceCalculator();
     
    9898    }
    9999
    100     // IDeepCloneable members
    101     public object Clone() {
    102       var cloner = new Cloner();
     100    public override IDeepCloneable Clone(Cloner cloner) {
    103101      return new OnlinePearsonsRCalculator(this, cloner);
    104     }
    105 
    106     public IDeepCloneable Clone(Cloner cloner) {
    107       var clone = cloner.GetClone(this);
    108       if (clone == null) {
    109         clone = new OnlinePearsonsRCalculator(this, cloner);
    110         cloner.RegisterClonedObject(this, clone);
    111       }
    112       return clone;
    113102    }
    114103  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlinePearsonsRSquaredCalculator.cs

    r14294 r14376  
    2626namespace HeuristicLab.Problems.DataAnalysis {
    2727  [Obsolete("Use OnlinePearsonsRCalculator directly")]
    28   public class OnlinePearsonsRSquaredCalculator : IOnlineCalculator, IDeepCloneable {
     28  public class OnlinePearsonsRSquaredCalculator : DeepCloneable, IOnlineCalculator {
    2929    private readonly OnlinePearsonsRCalculator rCalculator = new OnlinePearsonsRCalculator();
    3030
     
    6464    }
    6565
    66     // IDeepCloneable members
    67     public object Clone() {
    68       var cloner = new Cloner();
     66    public override IDeepCloneable Clone(Cloner cloner) {
    6967      return new OnlinePearsonsRSquaredCalculator(this, cloner);
    70     }
    71 
    72     public IDeepCloneable Clone(Cloner cloner) {
    73       var clone = cloner.GetClone(this);
    74       if (clone == null) {
    75         clone = new OnlinePearsonsRSquaredCalculator(this, cloner);
    76         cloner.RegisterClonedObject(this, clone);
    77       }
    78       return clone;
    7968    }
    8069  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineTheilsUStatisticCalculator.cs

    r14294 r14376  
    2525
    2626namespace HeuristicLab.Problems.DataAnalysis {
    27   public class OnlineTheilsUStatisticCalculator : IOnlineTimeSeriesCalculator, IDeepCloneable {
     27  public class OnlineTheilsUStatisticCalculator : DeepCloneable, IOnlineTimeSeriesCalculator {
    2828    private OnlineMeanAndVarianceCalculator squaredErrorMeanCalculator;
    2929    private OnlineMeanAndVarianceCalculator unbiasedEstimatorMeanCalculator;
     
    132132    }
    133133
    134     // IDeepCloneable members
    135     public object Clone() {
    136       var cloner = new Cloner();
     134    public override IDeepCloneable Clone(Cloner cloner) {
    137135      return new OnlineTheilsUStatisticCalculator(this, cloner);
    138     }
    139 
    140     public IDeepCloneable Clone(Cloner cloner) {
    141       var clone = cloner.GetClone(this);
    142       if (clone == null) {
    143         clone = new OnlineTheilsUStatisticCalculator(this, cloner);
    144         cloner.RegisterClonedObject(this, clone);
    145       }
    146       return clone;
    147136    }
    148137  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineWeightedDirectionalSymmetryCalculator.cs

    r14294 r14376  
    2626
    2727namespace HeuristicLab.Problems.DataAnalysis {
    28   public class OnlineWeightedDirectionalSymmetryCalculator : IOnlineTimeSeriesCalculator, IDeepCloneable {
     28  public class OnlineWeightedDirectionalSymmetryCalculator : DeepCloneable, IOnlineTimeSeriesCalculator {
    2929    private int n;
    3030    private double correctSum;
     
    4242    }
    4343
    44     protected OnlineWeightedDirectionalSymmetryCalculator(OnlineWeightedDirectionalSymmetryCalculator other, Cloner cloner = null) {
     44    protected OnlineWeightedDirectionalSymmetryCalculator(OnlineWeightedDirectionalSymmetryCalculator other, Cloner cloner) {
    4545      n = other.n;
    4646      correctSum = other.correctSum;
     
    126126    }
    127127
    128     // IDeepCloneable members
    129     public object Clone() {
    130       return new OnlineWeightedDirectionalSymmetryCalculator(this);
    131     }
    132 
    133     public IDeepCloneable Clone(Cloner cloner) {
    134       var clone = cloner.GetClone(this);
    135       if (clone == null) {
    136         clone = new OnlineWeightedDirectionalSymmetryCalculator(this);
    137         cloner.RegisterClonedObject(this, clone);
    138       }
    139       return clone;
     128    public override IDeepCloneable Clone(Cloner cloner) {
     129      return new OnlineWeightedDirectionalSymmetryCalculator(this, cloner);
    140130    }
    141131  }
Note: See TracChangeset for help on using the changeset viewer.