Changeset 4722 for trunk/sources/HeuristicLab.Core/3.3/Variable.cs
- Timestamp:
- 11/06/10 01:56:04 (13 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources
- Property svn:mergeinfo changed
/branches/CloningRefactoring (added) merged: 4656-4693,4696-4697,4711-4714,4718-4719
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Core/3.3/Variable.cs
r4477 r4722 55 55 } 56 56 57 [StorableConstructor] 58 private Variable(bool deserializing) : base(deserializing) { } 59 private Variable(Variable original, Cloner cloner) 60 : base(original, cloner) { 61 value = cloner.Clone(original.value); 62 RegisterValueEvents(); 63 } 57 64 /// <summary> 58 65 /// Initializes a new instance of <see cref="Variable"/> with name <c>Anonymous</c> … … 80 87 : base(name) { 81 88 this.value = value; 82 Initialize();89 RegisterValueEvents(); 83 90 } 84 91 public Variable(string name, string description, IItem value) 85 92 : base(name, description) { 86 93 this.value = value; 87 Initialize();94 RegisterValueEvents(); 88 95 } 89 [StorableConstructor]90 private Variable(bool deserializing) : base(deserializing) { }91 96 92 97 [StorableHook(HookType.AfterDeserialization)] 93 private void Initialize() {98 private void AfterDeserialization() { 94 99 RegisterValueEvents(); 95 100 } … … 101 106 /// <returns>The cloned object as <see cref="Variable"/>.</returns> 102 107 public override IDeepCloneable Clone(Cloner cloner) { 103 Variable clone = new Variable(Name, Description); 104 cloner.RegisterClonedObject(this, clone); 105 clone.value = (IItem)cloner.Clone(value); 106 clone.Initialize(); 107 return clone; 108 return new Variable(this, cloner); 108 109 } 109 110 … … 125 126 /// </summary> 126 127 private void OnValueChanged() { 127 if (ValueChanged != null)128 ValueChanged(this, EventArgs.Empty);128 var handler = ValueChanged; 129 if (handler != null) handler(this, EventArgs.Empty); 129 130 OnItemImageChanged(); 130 131 OnToStringChanged();
Note: See TracChangeset
for help on using the changeset viewer.