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.LocalSearch/3.3/LocalSearch.cs

    r4437 r4722  
    125125    [StorableConstructor]
    126126    private LocalSearch(bool deserializing) : base(deserializing) { }
     127    [StorableHook(HookType.AfterDeserialization)]
     128    private void AfterDeserialization() {
     129      Initialize();
     130    }
     131    private LocalSearch(LocalSearch original, Cloner cloner)
     132      : base(original, cloner) {
     133      moveQualityAnalyzer = cloner.Clone(original.moveQualityAnalyzer);
     134      Initialize();
     135    }
     136    public override IDeepCloneable Clone(Cloner cloner) {
     137      return new LocalSearch(this, cloner);
     138    }
    127139    public LocalSearch()
    128140      : base() {
     
    166178    }
    167179
    168     public override IDeepCloneable Clone(Cloner cloner) {
    169       LocalSearch clone = (LocalSearch)base.Clone(cloner);
    170       clone.moveQualityAnalyzer = (BestAverageWorstQualityAnalyzer)cloner.Clone(moveQualityAnalyzer);
    171       clone.Initialize();
    172       return clone;
    173     }
    174 
    175180    public override void Prepare() {
    176181      if (Problem != null && MoveGenerator != null && MoveMaker != null && MoveEvaluator != null)
     
    256261
    257262    #region Helpers
    258     [StorableHook(HookType.AfterDeserialization)]
    259263    private void Initialize() {
    260264      if (Problem != null) {
  • trunk/sources/HeuristicLab.Algorithms.LocalSearch/3.3/LocalSearchMainLoop.cs

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