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:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Core/3.3/OperatorGraph.cs

    r4477 r4722  
    7676    }
    7777
     78    [StorableConstructor]
     79    protected OperatorGraph(bool deserializing) : base(deserializing) { }
     80    protected OperatorGraph(OperatorGraph original, Cloner cloner)
     81      : base(original, cloner) {
     82      operators = cloner.Clone(original.operators);
     83      initialOperator = cloner.Clone(original.initialOperator);
     84      visualizationInfo = cloner.Clone(original.visualizationInfo);
     85      Initialize();
     86    }
    7887    /// <summary>
    7988    /// Initializes a new instance of <see cref="OperatorGraph"/>.
     
    8594      Initialize();
    8695    }
    87     [StorableConstructor]
    88     protected OperatorGraph(bool deserializing) : base(deserializing) { }
    8996
    9097    //mkommend: IMPORTANT DO NOT REMOVE THIS PRIVATE EVENT
     
    93100    private void OnOperatorGraphDeserializationFinished() {
    94101      EventHandler handler = DeserializationFinished;
    95       if (handler != null)
    96         handler(this, EventArgs.Empty);
    97     }
     102      if (handler != null) handler(this, EventArgs.Empty);
     103    }
     104
    98105    [StorableHook(HookType.AfterDeserialization)]
     106    private void AfterDeserialization() {
     107      Initialize();
     108    }
    99109    private void Initialize() {
    100110      RegisterOperatorsEvents();
     
    110120    /// <returns>The cloned object as <see cref="OperatorGraph"/>.</returns>
    111121    public override IDeepCloneable Clone(Cloner cloner) {
    112       OperatorGraph clone = (OperatorGraph)base.Clone(cloner);
    113       clone.operators = (OperatorSet)cloner.Clone(operators);
    114       clone.initialOperator = (IOperator)cloner.Clone(initialOperator);
    115       clone.visualizationInfo = cloner.Clone(visualizationInfo);
    116       clone.Initialize();
    117       return clone;
     122      return new OperatorGraph(this, cloner);
    118123    }
    119124
     
    124129    /// </summary>
    125130    protected virtual void OnInitialOperatorChanged() {
    126       if (InitialOperatorChanged != null)
    127         InitialOperatorChanged(this, EventArgs.Empty);
     131      var handler = InitialOperatorChanged;
     132      if (handler != null) handler(this, EventArgs.Empty);
    128133    }
    129134
Note: See TracChangeset for help on using the changeset viewer.