Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/29/10 18:55:22 (14 years ago)
Author:
gkronber
Message:

Refactored cloning in SymbolicExpressionTreeEncoding. #922

Location:
branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Analyzers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Analyzers/MinAverageMaxSymbolicExpressionTreeSizeAnalyzer.cs

    r4068 r4674  
    6565
    6666    #endregion
     67    [StorableConstructor]
     68    private MinAverageMaxSymbolicExpressionTreeSizeAnalyzer(bool deserializing) : base() { }
     69    protected MinAverageMaxSymbolicExpressionTreeSizeAnalyzer(MinAverageMaxSymbolicExpressionTreeSizeAnalyzer original, Cloner cloner)
     70      : base(original, cloner) {
     71      AfterDeserialization();
     72    }
    6773    public MinAverageMaxSymbolicExpressionTreeSizeAnalyzer()
    6874      : base() {
     
    95101      valueAnalyzer.Successor = null;
    96102
    97       Initialize();
     103      AfterDeserialization();
    98104    }
    99105
    100     [StorableConstructor]
    101     private MinAverageMaxSymbolicExpressionTreeSizeAnalyzer(bool deserializing) : base() { }
    102106
    103107    [StorableHook(HookType.AfterDeserialization)]
    104     private void Initialize() {
     108    private void AfterDeserialization() {
    105109      SymbolicExpressionTreeParameter.DepthChanged += new EventHandler(SymbolicExpressionTreeParameter_DepthChanged);
    106110      SymbolicExpressionTreeSizeParameter.DepthChanged += new EventHandler(SymbolicExpressionTreeSizeParameter_DepthChanged);
     
    108112
    109113    public override IDeepCloneable Clone(Cloner cloner) {
    110       MinAverageMaxSymbolicExpressionTreeSizeAnalyzer clone = (MinAverageMaxSymbolicExpressionTreeSizeAnalyzer)base.Clone(cloner);
    111       clone.Initialize();
    112       return clone;
     114      return new MinAverageMaxSymbolicExpressionTreeSizeAnalyzer(this, cloner);
    113115    }
    114116
  • branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Analyzers/SymbolicExpressionTreeSizeCalculator.cs

    r4068 r4674  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    5556    #endregion
    5657
     58    [StorableConstructor]
     59    private SymbolicExpressionTreeSizeCalculator(bool deserializing) : base(deserializing) { }
     60    private SymbolicExpressionTreeSizeCalculator(SymbolicExpressionTreeSizeCalculator original, Cloner cloner) : base(original, cloner) { }
    5761    public SymbolicExpressionTreeSizeCalculator()
    5862      : base() {
     
    6670      return base.Apply();
    6771    }
     72
     73    public override IDeepCloneable Clone(Cloner cloner) {
     74      return new SymbolicExpressionTreeSizeCalculator(this, cloner);
     75    }
    6876  }
    6977}
Note: See TracChangeset for help on using the changeset viewer.