Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/06/10 01:56:04 (14 years ago)
Author:
swagner
Message:

Merged cloning refactoring branch back into trunk (#922)

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealing.cs

    r4437 r4722  
    143143    [StorableConstructor]
    144144    private SimulatedAnnealing(bool deserializing) : base(deserializing) { }
     145    [StorableHook(HookType.AfterDeserialization)]
     146    private void AfterDeserialization() {
     147      Initialize();
     148    }
     149    private SimulatedAnnealing(SimulatedAnnealing original, Cloner cloner)
     150      : base(original, cloner) {
     151      qualityAnalyzer = cloner.Clone(original.qualityAnalyzer);
     152      Initialize();
     153    }
     154    public override IDeepCloneable Clone(Cloner cloner) {
     155      return new SimulatedAnnealing(this, cloner);
     156    }
    145157    public SimulatedAnnealing()
    146158      : base() {
     
    194206    }
    195207
    196     public override IDeepCloneable Clone(Cloner cloner) {
    197       SimulatedAnnealing clone = (SimulatedAnnealing)base.Clone(cloner);
    198       clone.qualityAnalyzer = (QualityAnalyzer)cloner.Clone(qualityAnalyzer);
    199       clone.Initialize();
    200       return clone;
    201     }
    202 
    203208    public override void Prepare() {
    204209      if (Problem != null && MoveGenerator != null && MoveMaker != null && MoveEvaluator != null)
     
    282287
    283288    #region Helpers
    284     [StorableHook(HookType.AfterDeserialization)]
    285289    private void Initialize() {
    286290      if (Problem != null) {
  • trunk/sources/HeuristicLab.Algorithms.SimulatedAnnealing/3.3/SimulatedAnnealingMainLoop.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    8384
    8485    [StorableConstructor]
    85     private SimulatedAnnealingMainLoop(bool deserializing) : base() { }
     86    private SimulatedAnnealingMainLoop(bool deserializing) : base(deserializing) { }
     87    private SimulatedAnnealingMainLoop(SimulatedAnnealingMainLoop original, Cloner cloner)
     88      : base(original, cloner) {
     89    }
     90    public override IDeepCloneable Clone(Cloner cloner) {
     91      return new SimulatedAnnealingMainLoop(this, cloner);
     92    }
    8693    public SimulatedAnnealingMainLoop()
    8794      : base() {
Note: See TracChangeset for help on using the changeset viewer.