Changeset 887 for branches/CloningRefactorBranch/HeuristicLab.Operators.Programmable/ProgrammableOperator.cs
- Timestamp:
- 12/02/08 21:10:17 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CloningRefactorBranch/HeuristicLab.Operators.Programmable/ProgrammableOperator.cs
r694 r887 55 55 } 56 56 57 /// <summary> 58 /// Default constructor. 59 /// </summary> 57 60 public ProgrammableOperator() { 58 61 myCode = "Result.Data = true;"; … … 60 63 AddVariableInfo(new VariableInfo("Result", "A computed variable", typeof(BoolData), VariableKind.New | VariableKind.Out)); 61 64 executeMethod = null; 65 } 66 67 68 /// <summary> 69 /// Copy constructor to create deep clones. 70 /// </summary> 71 /// <param name="original">The instance to be cloned.</param> 72 public ProgrammableOperator(ProgrammableOperator original) : this(original, new Dictionary<Guid, object>()) { } 73 /// <summary> 74 /// Copy constructor to create a deep clone of an ProgrammableOperator instance. 75 /// </summary> 76 /// <param name="original">The original instance to be cloned.</param> 77 /// <param name="clonedObjects">Already cloned object references.</param> 78 protected ProgrammableOperator(ProgrammableOperator original, IDictionary<Guid, object> clonedObjects) 79 : base(original, clonedObjects) { 80 this.myDescription = original.Description; 81 this.myCode = original.Code; 82 this.executeMethod = original.executeMethod; 62 83 } 63 84 … … 143 164 } 144 165 145 public override object Clone(IDictionary<Guid, object> clonedObjects) {146 ProgrammableOperator clone = (ProgrammableOperator)base.Clone(clonedObjects);147 clone.myDescription = Description;148 clone.myCode = Code;149 clone.executeMethod = executeMethod;150 return clone;151 }152 153 166 public override IOperation Apply(IScope scope) { 154 167 if (executeMethod == null) { … … 196 209 } 197 210 211 212 /// <summary> 213 /// Creates a deep clone with the copy constructor reusing already cloned 214 /// object references. 215 /// </summary> 216 /// <param name="clonedObjects">Already cloned objects (for referential integrity).</param> 217 /// <returns>The cloned instance.</returns> 218 public override object Clone(IDictionary<Guid, object> clonedObjects) { 219 return new ProgrammableOperator(this, clonedObjects); 220 } 198 221 #region Persistence Methods 199 222 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
Note: See TracChangeset
for help on using the changeset viewer.