- Timestamp:
- 12/02/08 14:13:06 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CloningRefactorBranch/HeuristicLab.Core/CompositeOperation.cs
r776 r885 59 59 60 60 /// <summary> 61 /// Copy constructor to create a deep clone of a CompositeOperation instance. 62 /// <remarks>Calls <see cref="CompositeOperation(CompositeOperation original, 63 /// IDictionary<Guid, object> clonedObjects)"/></remarks> with an initially 64 /// empty dictionary of cloned objects to create the clone. 65 /// </summary> 66 /// <param name="original">The original instance to be cloned.</param> 67 public CompositeOperation(CompositeOperation original) : this(original, new Dictionary<Guid, object>()) { } 68 69 /// <summary> 70 /// Copy constructor to create a deep clone of a CompositeOperation instance 71 /// automatically reusing references of already cloned objects. 72 /// </summary> 73 /// <param name="original">The original instance to be cloned</param> 74 /// <param name="clonedObjects">Already cloned object references</param> 75 protected CompositeOperation(CompositeOperation original, IDictionary<Guid, object> clonedObjects) 76 : base(original, clonedObjects) { 77 this.myExecuteInParallel = original.ExecuteInParallel; 78 for (int i = 0; i < original.Operations.Count; i++) 79 this.AddOperation((IOperation)Auxiliary.Clone(original.Operations[i], clonedObjects)); 80 } 81 82 /// <summary> 61 83 /// Adds an operation to the current list of operations. 62 84 /// </summary> … … 77 99 /// </summary> 78 100 /// <remarks>All operations of the current instance are cloned, too (deep clone), with the 79 /// <see cref="HeuristicLab.Core.Auxiliary.Clone"/> method of the class <see cref="Auxiliary"/>.</remarks> 80 /// <param name="clonedObjects">A dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 101 /// copy consturctor <see cref="HeuristicLab.Core.CompositeOperation( 102 /// CompositeOperation original, IDictionary<Guid, object> clonedObjects)"/>.</remarks> 103 /// <param name="clonedObjects">A dictionary of all already cloned objects. (Needed for referential integrity.)</param> 81 104 /// <returns>The cloned operation as <see cref="CompositeOperation"/>.</returns> 82 105 public override object Clone(IDictionary<Guid, object> clonedObjects) { 83 CompositeOperation clone = new CompositeOperation(); 84 clonedObjects.Add(Guid, clone); 85 clone.myExecuteInParallel = ExecuteInParallel; 86 for (int i = 0; i < Operations.Count; i++) 87 clone.AddOperation((IOperation)Auxiliary.Clone(Operations[i], clonedObjects)); 88 return clone; 106 return new CompositeOperation(this, clonedObjects); 89 107 } 90 108
Note: See TracChangeset
for help on using the changeset viewer.