- Timestamp:
- 11/06/10 01:56:04 (14 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.Optimization/3.3/RunCollection.cs
r4707 r4722 38 38 [StorableConstructor] 39 39 protected RunCollection(bool deserializing) : base(deserializing) { } 40 41 protected RunCollection(RunCollection original, Cloner cloner) 42 : base(original, cloner) { 43 resultNames = new List<string>(original.resultNames); 44 parameterNames = new List<string>(original.parameterNames); 45 dataTypes = new Dictionary<string, HashSet<Type>>(); 46 foreach (string s in original.dataTypes.Keys) 47 dataTypes[s] = new HashSet<Type>(original.dataTypes[s]); 48 49 constraints = new RunCollectionConstraintCollection(original.constraints.Select(x => cloner.Clone(x))); 50 foreach (IRunCollectionConstraint constraint in constraints) 51 constraint.ConstrainedValue = this; 52 RegisterConstraintsEvents(); 53 RegisterConstraintEvents(constraints); 54 55 UpdateFiltering(true); 56 } 57 public override IDeepCloneable Clone(Cloner cloner) { 58 return new RunCollection(this, cloner); 59 } 40 60 public RunCollection() : base() { Initialize(); } 41 61 public RunCollection(int capacity) : base(capacity) { Initialize(); } … … 171 191 172 192 [StorableHook(HookType.AfterDeserialization)] 173 private void AfterDeserialization Hook() {193 private void AfterDeserialization() { 174 194 if (constraints == null) constraints = new RunCollectionConstraintCollection(); 175 195 RegisterConstraintsEvents(); 176 196 RegisterConstraintEvents(constraints); 177 197 UpdateFiltering(true); 178 }179 180 public override IDeepCloneable Clone(Cloner cloner) {181 RunCollection clone = (RunCollection)base.Clone(cloner);182 clone.resultNames = new List<string>(this.resultNames);183 clone.parameterNames = new List<string>(this.parameterNames);184 clone.dataTypes = new Dictionary<string, HashSet<Type>>();185 foreach (string s in this.dataTypes.Keys)186 clone.dataTypes[s] = new HashSet<Type>(this.dataTypes[s]);187 188 clone.constraints = new RunCollectionConstraintCollection(this.constraints.Select(x => (IRunCollectionConstraint)cloner.Clone(x)));189 foreach (IRunCollectionConstraint constraint in clone.constraints)190 constraint.ConstrainedValue = clone;191 clone.RegisterConstraintsEvents();192 clone.RegisterConstraintEvents(clone.constraints);193 194 clone.UpdateFiltering(true);195 return clone;196 198 } 197 199 … … 253 255 public event EventHandler<EventArgs<int, int>> ItemChanged; 254 256 protected virtual void OnItemChanged(int rowIndex, int columnIndex) { 255 if (ItemChanged != null)256 ItemChanged(this, new EventArgs<int, int>(rowIndex, columnIndex));257 EventHandler<EventArgs<int, int>> handler = ItemChanged; 258 if (handler != null) handler(this, new EventArgs<int, int>(rowIndex, columnIndex)); 257 259 OnToStringChanged(); 258 260 } 259 261 public event EventHandler Reset; 260 262 protected virtual void OnReset() { 261 if (Reset != null)262 Reset(this, EventArgs.Empty);263 EventHandler handler = Reset; 264 if (handler != null) handler(this, EventArgs.Empty); 263 265 OnToStringChanged(); 264 266 } … … 266 268 protected virtual void OnColumnNamesChanged() { 267 269 EventHandler handler = ColumnNamesChanged; 268 if (handler != null) 269 handler(this, EventArgs.Empty); 270 if (handler != null) handler(this, EventArgs.Empty); 270 271 } 271 272 public event EventHandler RowNamesChanged; 272 273 protected virtual void OnRowNamesChanged() { 273 274 EventHandler handler = RowNamesChanged; 274 if (handler != null) 275 handler(this, EventArgs.Empty); 275 if (handler != null) handler(this, EventArgs.Empty); 276 276 } 277 277 public event EventHandler SortableViewChanged; 278 278 protected virtual void OnSortableViewChanged() { 279 279 EventHandler handler = SortableViewChanged; 280 if (handler != null) 281 handler(this, EventArgs.Empty); 280 if (handler != null) handler(this, EventArgs.Empty); 282 281 } 283 282
Note: See TracChangeset
for help on using the changeset viewer.