Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/02/08 21:10:17 (16 years ago)
Author:
gkronber
Message:

Refactored cloning in all plugins except: HL.Communication, HL.Hive, HL.GP, HL.Routing, HL.Scheduling, HL.SimOpt, HL.Visualization

#285 (Cloning could be improved by creating objects at the bottom of the cloning chain with 'new' instead of the top with Activator.CreateInstance())

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactorBranch/HeuristicLab.SequentialEngine/SequentialEngine.cs

    r2 r887  
    3030    private IOperator currentOperator;
    3131
     32    /// <summary>
     33    /// Default constructor
     34    /// </summary>
     35    public SequentialEngine() { }
     36
     37    /// <summary>
     38    /// Copy constructor to create deep clones.
     39    /// </summary>
     40    /// <param name="original">The instance to be cloned.</param>
     41    public SequentialEngine(SequentialEngine original) : this(original, new Dictionary<Guid, object>()) { }
     42    /// <summary>
     43    /// Copy constructor to create deep clones reusing already cloned object references.
     44    /// </summary>
     45    /// <param name="original">The instance to be cloned.</param>
     46    /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param>
     47    protected SequentialEngine(SequentialEngine original, IDictionary<Guid, object> clonedObjects)
     48      : base(original, clonedObjects) { }
    3249    public override IView CreateView() {
    3350      return new SequentialEngineEditor(this);
     
    5673          myExecutionStack.Push(atomicOperation);
    5774          Abort();
    58           ThreadPool.QueueUserWorkItem(delegate(object state) { OnExceptionOccurred(ex);});
     75          ThreadPool.QueueUserWorkItem(delegate(object state) { OnExceptionOccurred(ex); });
    5976        }
    6077        if (next != null)
     
    6885      }
    6986    }
     87
     88    /// <summary>
     89    /// Creates a deep clone with the copy constructor reusing already cloned
     90    /// object references.
     91    /// </summary>
     92    /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param>
     93    /// <returns>The cloned instance.</returns>
     94    public override object Clone(IDictionary<Guid, object> clonedObjects) {
     95      return new SequentialEngine(this, clonedObjects);
     96    }
    7097  }
    7198}
Note: See TracChangeset for help on using the changeset viewer.