Changeset 4888 for trunk/sources/HeuristicLab.Optimization
- Timestamp:
- 11/22/10 01:26:55 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization/3.3/RunCollection.cs
r4883 r4888 37 37 38 38 [StorableConstructor] 39 protected RunCollection(bool deserializing) : base(deserializing) { } 40 39 protected RunCollection(bool deserializing) 40 : base(deserializing) { 41 updateOfRunsInProgress = false; 42 } 41 43 protected RunCollection(RunCollection original, Cloner cloner) 42 44 : base(original, cloner) { 45 updateOfRunsInProgress = false; 43 46 resultNames = new List<string>(original.resultNames); 44 47 parameterNames = new List<string>(original.parameterNames); … … 55 58 UpdateFiltering(true); 56 59 } 57 public override IDeepCloneable Clone(Cloner cloner) {58 return new RunCollection(this, cloner);59 }60 60 public RunCollection() : base() { Initialize(); } 61 61 public RunCollection(int capacity) : base(capacity) { Initialize(); } 62 62 public RunCollection(IEnumerable<IRun> collection) : base(collection) { Initialize(); this.OnItemsAdded(collection); } 63 63 private void Initialize() { 64 updateOfRunsInProgress = false; 64 65 parameterNames = new List<string>(); 65 66 resultNames = new List<string>(); … … 81 82 public RunCollectionConstraintCollection Constraints { 82 83 get { return constraints; } 84 } 85 86 private bool updateOfRunsInProgress; 87 public bool UpdateOfRunsInProgress { 88 get { return updateOfRunsInProgress; } 89 set { 90 if (updateOfRunsInProgress != value) { 91 updateOfRunsInProgress = value; 92 OnUpdateOfRunsInProgressChanged(); 93 } 94 } 95 } 96 97 [StorableHook(HookType.AfterDeserialization)] 98 private void AfterDeserialization() { 99 if (constraints == null) constraints = new RunCollectionConstraintCollection(); 100 RegisterConstraintsEvents(); 101 RegisterConstraintEvents(constraints); 102 UpdateFiltering(true); 103 } 104 105 public override IDeepCloneable Clone(Cloner cloner) { 106 return new RunCollection(this, cloner); 107 } 108 109 public event EventHandler UpdateOfRunsInProgressChanged; 110 protected virtual void OnUpdateOfRunsInProgressChanged() { 111 var handler = UpdateOfRunsInProgressChanged; 112 if (handler != null) handler(this, EventArgs.Empty); 83 113 } 84 114 … … 188 218 value = run.Results[columnName]; 189 219 return value; 190 }191 192 [StorableHook(HookType.AfterDeserialization)]193 private void AfterDeserialization() {194 if (constraints == null) constraints = new RunCollectionConstraintCollection();195 RegisterConstraintsEvents();196 RegisterConstraintEvents(constraints);197 UpdateFiltering(true);198 220 } 199 221 … … 285 307 #endregion 286 308 287 #region 288 public event EventHandler<EventArgs<bool>> UpdateOfRunsInProgress; 289 public void OnUpdateOfRunsInProgress(bool inProgress) { 290 var handler = UpdateOfRunsInProgress; 291 if (handler != null) handler(this, new EventArgs<bool>(inProgress)); 292 } 293 #endregion 294 295 #region filtering 309 #region Filtering 296 310 private void UpdateFiltering(bool reset) { 297 OnUpdateOfRunsInProgress(true);311 UpdateOfRunsInProgress = true; 298 312 if (reset) 299 313 list.ForEach(r => r.Visible = true); 300 314 foreach (IRunCollectionConstraint constraint in this.constraints) 301 315 constraint.Check(); 302 OnUpdateOfRunsInProgress(false);316 UpdateOfRunsInProgress = false; 303 317 } 304 318
Note: See TracChangeset
for help on using the changeset viewer.