Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/23/09 16:43:34 (14 years ago)
Author:
swagner
Message:

Refactored cloning (#806)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/3.3/EngineBase.cs

    r2474 r2526  
    127127    /// Clones the current instance (deep clone).
    128128    /// </summary>
    129     /// <remarks>Deep clone through <see cref="Auxiliary.Clone"/> method of helper class
     129    /// <remarks>Deep clone through <see cref="cloner.Clone"/> method of helper class
    130130    /// <see cref="Auxiliary"/>.</remarks>
    131131    /// <param name="clonedObjects">Dictionary of all already clone objects. (Needed to avoid cycles.)</param>
    132132    /// <returns>The cloned object as <see cref="EngineBase"/>.</returns>
    133     public override object Clone(IDictionary<Guid, object> clonedObjects) {
    134       EngineBase clone = (EngineBase)base.Clone(clonedObjects);
    135       clone.myOperatorGraph = (IOperatorGraph)Auxiliary.Clone(OperatorGraph, clonedObjects);
    136       clone.myGlobalScope = (IScope)Auxiliary.Clone(GlobalScope, clonedObjects);
     133    public override IItem Clone(ICloner cloner) {
     134      EngineBase clone = (EngineBase)base.Clone(cloner);
     135      clone.myOperatorGraph = (IOperatorGraph)cloner.Clone(OperatorGraph);
     136      clone.myGlobalScope = (IScope)cloner.Clone(GlobalScope);
    137137      clone.myExecutionTime = ExecutionTime;
    138138      IOperation[] operations = new IOperation[ExecutionStack.Count];
    139139      ExecutionStack.CopyTo(operations, 0);
    140140      for (int i = operations.Length - 1; i >= 0; i--)
    141         clone.myExecutionStack.Push((IOperation)Auxiliary.Clone(operations[i], clonedObjects));
     141        clone.myExecutionStack.Push((IOperation)cloner.Clone(operations[i]));
    142142      clone.myRunning = Running;
    143143      clone.myCanceled = Canceled;
Note: See TracChangeset for help on using the changeset viewer.