Changeset 885 for branches/CloningRefactorBranch/HeuristicLab.Core
- Timestamp:
- 12/02/08 14:13:06 (16 years ago)
- Location:
- branches/CloningRefactorBranch/HeuristicLab.Core
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CloningRefactorBranch/HeuristicLab.Core/AtomicOperation.cs
r836 r885 62 62 63 63 /// <summary> 64 /// Copy constructor to create a deep clone of an AtomicOperation instance. 65 /// <remarks>Calls <see cref="AtomicOperation(AtomicOperation original, 66 /// IDictionary<Guid, object> clonedObjects)"/></remarks> with an initially 67 /// empty dictionary of cloned objects to create the clone. 68 /// </summary> 69 /// <param name="original">The original instance to be cloned.</param> 70 public AtomicOperation(AtomicOperation original) : this(original, new Dictionary<Guid, object>()) { } 71 72 /// <summary> 73 /// Copy constructor to create a deep clone of an AtomicOperation instance 74 /// automatically reusing references of already cloned objects. 75 /// </summary> 76 /// <param name="original">The original instance to be cloned</param> 77 /// <param name="clonedObjects">Already cloned object references</param> 78 protected AtomicOperation(AtomicOperation original, IDictionary<Guid, object> clonedObjects) 79 : base(original, clonedObjects) { 80 this.myOperator = (IOperator)Auxiliary.Clone(original.Operator, clonedObjects); 81 this.myScope = (IScope)Auxiliary.Clone(original.Scope, clonedObjects); 82 } 83 84 /// <summary> 64 85 /// Clones the current instance. 65 86 /// </summary> 66 /// <remarks>The operator and the scope objects are cloned with the 67 /// <see cref="HeuristicLab.Core.Auxiliary.Clone"/> method of the <see cref="Auxiliary"/> class.</remarks> 68 /// <param name="clonedObjects">All already cloned objects. (Needed to avoid cycles.)</param> 87 /// <remarks>The operator and the scope objects are cloned with the copy constructor 88 /// <see cref="HeuristicLab.Core.AtomicOperation(AtomicOperation original, IDictionary<Guid, object> clonedObjects"/> 89 /// copy constructor.</remarks> 90 /// <param name="clonedObjects">All already cloned objects. (Needed for referential integrity)</param> 69 91 /// <returns>The cloned object as <see cref="AtomicOperation"/>.</returns> 70 92 public override object Clone(IDictionary<Guid, object> clonedObjects) { 71 AtomicOperation clone = new AtomicOperation(); 72 clonedObjects.Add(Guid, clone); 73 clone.myOperator = (IOperator)Auxiliary.Clone(Operator, clonedObjects); 74 clone.myScope = (IScope)Auxiliary.Clone(Scope, clonedObjects); 75 return clone; 93 return new AtomicOperation(this, clonedObjects); 76 94 } 77 95 -
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 -
branches/CloningRefactorBranch/HeuristicLab.Core/EngineBase.cs
r836 r885 118 118 119 119 /// <summary> 120 /// Copy constructor. 121 /// </summary> 122 /// <param name="original"></param> 123 /// <param name="clonedObjects"></param> 120 /// Copy constructor to create a deep clone of an EngineBase instance. 121 /// </summary> 122 /// <remarks>Calls the copy constructor of the base class <see cref="ItemBase"/> 123 /// and <see cref="Auxiliary.Clone"/> to clone contained objects</remarks> 124 /// <param name="original">The instance to be cloned.</param> 125 /// <param name="clonedObjects">Already cloned object references</param> 124 126 protected EngineBase(EngineBase original, IDictionary<Guid, object> clonedObjects) 125 127 : base(original, clonedObjects) { … … 133 135 this.myRunning = original.Running; 134 136 this.myCanceled = original.Canceled; 135 }136 137 /// <summary>138 /// Clones the current instance (deep clone).139 /// </summary>140 /// <remarks>Deep clone through <see cref="Auxiliary.Clone"/> method of helper class141 /// <see cref="Auxiliary"/>.</remarks>142 /// <param name="clonedObjects">Dictionary of all already clone objects. (Needed to avoid cycles.)</param>143 /// <returns>The cloned object as <see cref="EngineBase"/>.</returns>144 public override object Clone(IDictionary<Guid, object> clonedObjects) {145 return new EngineBase(this, clonedObjects);146 137 } 147 138 -
branches/CloningRefactorBranch/HeuristicLab.Core/OperatorBase.cs
r836 r885 105 105 106 106 /// <summary> 107 /// Copy constructor 108 /// </summary> 109 /// <param name="original"> </param>110 /// <param name="clonedObjects"> </param>107 /// Copy constructor. 108 /// </summary> 109 /// <param name="original">The original instance to be cloned</param> 110 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 111 111 protected OperatorBase(OperatorBase original, IDictionary<Guid, object> clonedObjects) 112 112 : base(original, clonedObjects) { -
branches/CloningRefactorBranch/HeuristicLab.Core/OperatorGraph.cs
r776 r885 60 60 61 61 /// <summary> 62 /// Copy constructor to create a deep clone of an OperatorGraph instance. 63 /// </summary> 64 /// <param name="original">The original instance to be cloned.</param> 65 public OperatorGraph(OperatorGraph original) : this(original, new Dictionary<Guid, object>()) { } 66 67 /// <summary> 68 /// Copy constructor to create a deep clone of an OperatorGraph instance 69 /// reusing already cloned objects. 70 /// </summary> 71 /// <param name="original">The original instance to be cloned</param> 72 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 73 protected OperatorGraph(OperatorGraph original, IDictionary<Guid, object> clonedObjects) 74 : base(original, clonedObjects) { 75 foreach (IOperator op in original.Operators) 76 this.AddOperator((IOperator)Auxiliary.Clone(op, clonedObjects)); 77 if (original.InitialOperator != null) 78 this.myInitialOperator = (IOperator)Auxiliary.Clone(original.InitialOperator, clonedObjects); 79 } 80 81 /// <summary> 62 82 /// Creates a new instance of <see cref="OperatorGraphView"/> to represent the current instance 63 83 /// visually. … … 71 91 /// Clones the current instance (deep clone). 72 92 /// </summary> 73 /// <remarks>Deep clone through <see cref="Auxiliary.Clone"/> method of helper class 74 /// <see cref="Auxiliary"/>.</remarks> 93 /// <remarks>Deep clone using the copy constructor.</remarks> 75 94 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 76 95 /// <returns>The cloned object as <see cref="OperatorGraph"/>.</returns> 77 96 public override object Clone(IDictionary<Guid, object> clonedObjects) { 78 OperatorGraph clone = new OperatorGraph(); 79 clonedObjects.Add(Guid, clone); 80 foreach (IOperator op in Operators) 81 clone.AddOperator((IOperator)Auxiliary.Clone(op, clonedObjects)); 82 if (InitialOperator != null) 83 clone.myInitialOperator = (IOperator)Auxiliary.Clone(InitialOperator, clonedObjects); 84 return clone; 97 return new OperatorGraph(this, clonedObjects); 85 98 } 86 99 … … 179 192 /// (Needed to avoid cycles.)</param> 180 193 /// <returns>The saved <see cref="XmlNode"/>.</returns> 181 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {194 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 182 195 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 183 196 XmlNode ops = document.CreateNode(XmlNodeType.Element, "Operators", null); … … 197 210 /// <param name="restoredObjects">The dictionary of all already restored objects. 198 211 /// (Needed to avoid cycles.)</param> 199 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {212 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 200 213 base.Populate(node, restoredObjects); 201 214 -
branches/CloningRefactorBranch/HeuristicLab.Core/OperatorGroup.cs
r836 r885 71 71 72 72 /// <summary> 73 /// Copy constructor for deep cloning 74 /// </summary> 75 /// <param name="original"></param> 76 /// <param name="clonedObjects"></param> 73 /// Copy constructor to create a deep clone of an OperatorGroup instance. 74 /// </summary> 75 /// <param name="original">The instance to be cloned.</param> 76 public OperatorGroup(OperatorGroup original) : this(original, new Dictionary<Guid, object>()) {} 77 78 /// <summary> 79 /// Copy constructor to create a deep clone of an OperatorGroup instance reusing 80 /// already cloned object references. 81 /// </summary> 82 /// <param name="original">The original instance to be cloned</param> 83 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 77 84 protected OperatorGroup(OperatorGroup original, IDictionary<Guid, object> clonedObjects) : base(original, clonedObjects) { 78 85 this.myName = original.myName; … … 88 95 /// Clones the current instance (deep clone). 89 96 /// </summary> 90 /// <remarks>Deep clone with <see cref="Auxiliary.Clone"/> method of helper class 91 /// <see cref="Auxiliary"/>.</remarks> 92 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 97 /// <remarks>Uses copy constructor to create the deep clone.</remarks> 98 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed for referential integrity.)</param> 93 99 /// <returns>The cloned object as <see cref="OperatorGroup"/>.</returns> 94 100 public override object Clone(IDictionary<Guid, object> clonedObjects) { 95 OperatorGroup clone = new OperatorGroup(this, clonedObjects); 96 return clone; 101 return new OperatorGroup(this, clonedObjects); 97 102 } 98 103 -
branches/CloningRefactorBranch/HeuristicLab.Core/OperatorLibrary.cs
r776 r885 46 46 47 47 /// <summary> 48 /// Copy constructor to create a deep clone of an OperatorLibrary instance. 49 /// </summary> 50 /// <param name="original">The instance to be cloned.</param> 51 public OperatorLibrary(OperatorLibrary original) : this(original, new Dictionary<Guid, object>()) { } 52 53 /// <summary> 54 /// Copy constructor to create a deep clone of an OperatorLibrary instance reusing 55 /// already cloned object references. 56 /// </summary> 57 /// <param name="original">The original instance to be cloned</param> 58 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 59 protected OperatorLibrary(OperatorLibrary original, IDictionary<Guid, object> clonedObjects) 60 : base(original, clonedObjects) { 61 this.myGroup = (IOperatorGroup)Auxiliary.Clone(original.Group, clonedObjects); 62 } 63 64 /// <summary> 48 65 /// Creates a new instance of <see cref="OperatorLibraryEditor"/> to display the current instance. 49 66 /// </summary> … … 63 80 /// Clones the current instance (deep clone). 64 81 /// </summary> 65 /// <remarks>Deep clone through <see cref="Auxiliary.Clone"/> method of helper class 66 /// <see cref="Auxiliary"/>.</remarks> 67 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 82 /// <remarks>Deep clone through the copy constructor.</remarks> 83 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed for referential integrity.)</param> 68 84 /// <returns>The cloned object as <see cref="OperatorLibrary"/>.</returns> 69 85 public override object Clone(IDictionary<Guid, object> clonedObjects) { 70 OperatorLibrary clone = new OperatorLibrary(); 71 clonedObjects.Add(Guid, clone); 72 clone.myGroup = (IOperatorGroup)Auxiliary.Clone(Group, clonedObjects); 73 return clone; 86 return new OperatorLibrary(this, clonedObjects); 74 87 } 75 88 -
branches/CloningRefactorBranch/HeuristicLab.Core/Scope.cs
r836 r885 78 78 79 79 /// <summary> 80 /// Copy constructor to c reate deep clones.80 /// Copy constructor to clone (deep) a Scope instance. 81 81 /// </summary> 82 82 /// <param name="original"></param> 83 /// <param name="clonedObjects"></param> 83 public Scope(Scope original) : this(original, new Dictionary<Guid, object>()) { } 84 85 /// <summary> 86 /// Copy constructor to clone (deep) a Scope instance reusing 87 /// already cloned object references. 88 /// </summary> 89 /// <param name="original">The original instance to be cloned.</param> 90 /// <param name="clonedObjects">Already cloned object references (for referential integrity).</param> 84 91 protected Scope(Scope original, IDictionary<Guid, object> clonedObjects) 85 92 : base(original, clonedObjects) { -
branches/CloningRefactorBranch/HeuristicLab.Core/Variable.cs
r801 r885 79 79 } 80 80 81 /// <summary> 82 /// Copy constructor to deep clone Variable instances. 83 /// </summary> 84 /// <param name="original">The instance to be cloned.</param> 85 public Variable(Variable original) : this(original, new Dictionary<Guid, object>()) { } 86 87 /// <summary> 88 /// Copy constructor to deep clone Variable instances reusing 89 /// already cloned object references. 90 /// </summary> 91 /// <param name="original">The instance to be cloned.</param> 92 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 93 protected Variable(Variable original, IDictionary<Guid, object> clonedObjects) 94 : base(original, clonedObjects) { 95 this.myName = original.Name; 96 if (original.Value != null) 97 this.myValue = (IItem)Auxiliary.Clone(original.Value, clonedObjects); 98 } 99 81 100 /// <inheritdoc cref="IVariable.GetValue<T>"/> 82 101 public T GetValue<T>() where T : class, IItem { … … 95 114 /// Clones the current instance (deep clone). 96 115 /// </summary> 97 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param>116 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed for referential integrity.)</param> 98 117 /// <returns>The cloned object as <see cref="Variable"/>.</returns> 99 118 public override object Clone(IDictionary<Guid, object> clonedObjects) { 100 Variable clone = new Variable(); 101 clonedObjects.Add(Guid, clone); 102 clone.myName = Name; 103 if (Value != null) 104 clone.myValue = (IItem)Auxiliary.Clone(Value, clonedObjects); 105 return clone; 119 return new Variable(this, clonedObjects); 106 120 } 107 121 -
branches/CloningRefactorBranch/HeuristicLab.Core/VariableInfo.cs
r776 r885 119 119 120 120 /// <summary> 121 /// Copy constructor to deep clone VariableInfo instances. 122 /// </summary> 123 /// <param name="original">The instance to be cloned.</param> 124 public VariableInfo(VariableInfo original) : this(original, new Dictionary<Guid, object>()) { } 125 126 /// <summary> 127 /// Copy constructor to deep clone VariableInfo instances 128 /// reusing already cloned object references. 129 /// </summary> 130 /// <param name="original">The instance to be cloned.</param> 131 /// <param name="clonedObjects">Already cloned instances (for referential integrity).</param> 132 protected VariableInfo(VariableInfo original, IDictionary<Guid, object> clonedObjects) 133 : base(original, clonedObjects) { 134 this.myActualName = original.ActualName; 135 this.myFormalName = original.FormalName; 136 this.myDescription = original.Description; 137 this.myDataType = original.DataType; 138 this.myKind = original.Kind; 139 this.myLocal = original.Local; 140 } 141 142 /// <summary> 121 143 /// Creates a new instance of <see cref="VariableInfoView"/> to represent the current instance 122 144 /// visually. … … 130 152 /// Clones the current instance (deep clone). 131 153 /// </summary> 132 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 154 /// <remarks>Uses the copy constructor to create the deep clone.</remarks> 155 /// <param name="clonedObjects">Dictionary of all already cloned objects (for referential integrity.)</param> 133 156 /// <returns>The cloned object as <see cref="VariableInfo"/>.</returns> 134 157 public override object Clone(IDictionary<Guid, object> clonedObjects) { 135 VariableInfo clone = new VariableInfo(); 136 clonedObjects.Add(Guid, clone); 137 clone.myActualName = ActualName; 138 clone.myFormalName = FormalName; 139 clone.myDescription = Description; 140 clone.myDataType = DataType; 141 clone.myKind = Kind; 142 clone.myLocal = Local; 143 return clone; 158 return new VariableInfo(this, clonedObjects); 144 159 } 145 160
Note: See TracChangeset
for help on using the changeset viewer.