- Timestamp:
- 10/29/10 17:38:42 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CloningRefactoring/HeuristicLab.Core/3.3/Constraints/Constraint.cs
r4345 r4668 31 31 [StorableConstructor] 32 32 protected Constraint(bool deserializing) : base(deserializing) { } 33 protected Constraint(Constraint original, Cloner cloner) 34 : base(original, cloner) { 35 constrainedValue = null; //mkommend: intentionally set to null; 33 36 37 IItem constraintDataItem = original.constraintData as IItem; 38 ICloneable constraintDataCloneable = original.constraintData as ICloneable; 39 if (constraintDataItem != null) 40 constraintData = cloner.Clone(constraintDataItem); 41 else if (constraintDataCloneable != null) 42 constraintData = constraintDataCloneable.Clone(); 43 else 44 constraintData = original.constraintData; 45 46 constraintOperation = original.constraintOperation; 47 } 34 48 protected Constraint() { 35 49 this.Active = false; … … 138 152 protected virtual void OnActiveChanged() { 139 153 EventHandler handler = ActiveChanged; 140 if (handler != null) 141 handler(this, EventArgs.Empty); 154 if (handler != null) handler(this, EventArgs.Empty); 142 155 } 143 156 … … 145 158 protected virtual void OnConstrainedValueChanged() { 146 159 EventHandler handler = ConstrainedValueChanged; 147 if (handler != null) 148 handler(this, EventArgs.Empty); 160 if (handler != null) handler(this, EventArgs.Empty); 149 161 } 150 162 … … 152 164 protected virtual void OnConstraintDataChanged() { 153 165 EventHandler handler = ConstraintDataChanged; 154 if (handler != null) 155 handler(this, EventArgs.Empty); 166 if (handler != null) handler(this, EventArgs.Empty); 156 167 } 157 168 … … 159 170 protected virtual void OnConstraintOperationChanged() { 160 171 EventHandler handler = ConstraintOperationChanged; 161 if (handler != null) 162 handler(this, EventArgs.Empty); 172 if (handler != null) handler(this, EventArgs.Empty); 163 173 } 164 174 #endregion … … 182 192 return s; 183 193 } 184 185 public override IDeepCloneable Clone(HeuristicLab.Common.Cloner cloner) {186 Constraint clone = (Constraint)base.Clone(cloner);187 clone.constrainedValue = null; //mkommend: intentionally set to null;188 189 IItem constraintDataItem = this.constraintData as IItem;190 ICloneable constraintDataCloneable = this.constraintData as ICloneable;191 if (constraintDataItem != null)192 clone.constraintData = cloner.Clone(constraintDataItem);193 else if (constraintDataCloneable != null)194 clone.constraintData = constraintDataCloneable.Clone();195 else196 clone.constraintData = constraintData;197 198 clone.constraintOperation = this.constraintOperation;199 200 return clone;201 }202 194 #endregion 203 195 }
Note: See TracChangeset
for help on using the changeset viewer.