Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/22/10 01:26:55 (14 years ago)
Author:
swagner
Message:

Trivial changes due to review of r4883 (#1284)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization/3.3/RunCollection.cs

    r4883 r4888  
    3737
    3838    [StorableConstructor]
    39     protected RunCollection(bool deserializing) : base(deserializing) { }
    40 
     39    protected RunCollection(bool deserializing)
     40      : base(deserializing) {
     41      updateOfRunsInProgress = false;
     42    }
    4143    protected RunCollection(RunCollection original, Cloner cloner)
    4244      : base(original, cloner) {
     45      updateOfRunsInProgress = false;
    4346      resultNames = new List<string>(original.resultNames);
    4447      parameterNames = new List<string>(original.parameterNames);
     
    5558      UpdateFiltering(true);
    5659    }
    57     public override IDeepCloneable Clone(Cloner cloner) {
    58       return new RunCollection(this, cloner);
    59     }
    6060    public RunCollection() : base() { Initialize(); }
    6161    public RunCollection(int capacity) : base(capacity) { Initialize(); }
    6262    public RunCollection(IEnumerable<IRun> collection) : base(collection) { Initialize(); this.OnItemsAdded(collection); }
    6363    private void Initialize() {
     64      updateOfRunsInProgress = false;
    6465      parameterNames = new List<string>();
    6566      resultNames = new List<string>();
     
    8182    public RunCollectionConstraintCollection Constraints {
    8283      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);
    83113    }
    84114
     
    188218        value = run.Results[columnName];
    189219      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);
    198220    }
    199221
     
    285307    #endregion
    286308
    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
    296310    private void UpdateFiltering(bool reset) {
    297       OnUpdateOfRunsInProgress(true);
     311      UpdateOfRunsInProgress = true;
    298312      if (reset)
    299313        list.ForEach(r => r.Visible = true);
    300314      foreach (IRunCollectionConstraint constraint in this.constraints)
    301315        constraint.Check();
    302       OnUpdateOfRunsInProgress(false);
     316      UpdateOfRunsInProgress = false;
    303317    }
    304318
Note: See TracChangeset for help on using the changeset viewer.