Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5542


Ignore:
Timestamp:
02/22/11 17:19:17 (14 years ago)
Author:
gkronber
Message:

#1418 improved event propagation in DataAnalysisProblemData and RegressionProblemData

Location:
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/DataAnalysisProblemData.cs

    r5540 r5542  
    174174    #region changed event propagation
    175175    private void RegisterEventHandlers() {
     176      DatasetParameter.ValueChanged += new EventHandler(DatasetParameter_ValueChanged);
     177      TrainingSamplesStartParameter.ValueChanged += new EventHandler(TrainingSamplesStartParameter_ValueChanged);
     178      TrainingSamplesEndParameter.ValueChanged += new EventHandler(TrainingSamplesEndParameter_ValueChanged);
     179      TestSamplesStartParameter.ValueChanged += new EventHandler(TestSamplesStartParameter_ValueChanged);
     180      TestSamplesEndParameter.ValueChanged += new EventHandler(TestSamplesEndParameter_ValueChanged);
     181
    176182      DatasetParameter.Value.Reset += new EventHandler(DatasetChanged);
    177183      DatasetParameter.Value.ColumnsChanged += new EventHandler(DatasetChanged);
     
    184190      InputVariablesParameter.Value.ItemsReplaced += new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<StringValue>>(InputVariables_ItemsReplaced);
    185191
    186       TrainingSamplesStartParameter.ValueChanged += new EventHandler(TrainingSamplesStartParameter_ValueChanged);
    187       TrainingSamplesEndParameter.ValueChanged += new EventHandler(TrainingSamplesEndParameter_ValueChanged);
    188       TestSamplesStartParameter.ValueChanged += new EventHandler(TestSamplesStartParameter_ValueChanged);
    189       TestSamplesEndParameter.ValueChanged += new EventHandler(TestSamplesEndParameter_ValueChanged);
    190 
    191192      TrainingSamplesStartParameter.Value.ValueChanged += new EventHandler(Partitions_ValueChanged);
    192193      TrainingSamplesEndParameter.Value.ValueChanged += new EventHandler(Partitions_ValueChanged);
     
    195196    }
    196197
     198    private void DatasetParameter_ValueChanged(object sender, EventArgs e) {
     199      DatasetParameter.Value.Reset += new EventHandler(DatasetChanged);
     200      DatasetParameter.Value.ColumnsChanged += new EventHandler(DatasetChanged);
     201      DatasetParameter.Value.RowsChanged += new EventHandler(DatasetChanged);
     202      OnProblemChanged();
     203    }
     204
    197205    private void TestSamplesEndParameter_ValueChanged(object sender, EventArgs e) {
    198206      TestSamplesEndParameter.Value.ValueChanged += new EventHandler(Partitions_ValueChanged);
     207      OnProblemChanged();
    199208    }
    200209
    201210    private void TestSamplesStartParameter_ValueChanged(object sender, EventArgs e) {
    202211      TestSamplesStartParameter.Value.ValueChanged += new EventHandler(Partitions_ValueChanged);
     212      OnProblemChanged();
    203213    }
    204214
    205215    private void TrainingSamplesEndParameter_ValueChanged(object sender, EventArgs e) {
    206216      TrainingSamplesEndParameter.Value.ValueChanged += new EventHandler(Partitions_ValueChanged);
     217      OnProblemChanged();
    207218    }
    208219
    209220    private void TrainingSamplesStartParameter_ValueChanged(object sender, EventArgs e) {
    210221      TrainingSamplesStartParameter.Value.ValueChanged += new EventHandler(Partitions_ValueChanged);
     222      OnProblemChanged();
    211223    }
    212224
     
    243255    }
    244256
    245     protected void OnProblemChanged() {
     257    protected virtual void OnProblemChanged() {
    246258      var listeners = Changed;
    247259      if (listeners != null) listeners(this, EventArgs.Empty);
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/RegressionProblemData.cs

    r5540 r5542  
    4949    private RegressionProblemData(RegressionProblemData original, Cloner cloner)
    5050      : base(original, cloner) {
     51      RegisterEventHandlers();
    5152    }
    5253    [StorableConstructor]
     
    6061
    6162      Parameters.Add(targetVariableParameter);
     63
     64      RegisterEventHandlers();
    6265    }
    6366
     
    6568      return new RegressionProblemData(this, cloner);
    6669    }
     70
     71    [StorableHook(HookType.AfterDeserialization)]
     72    private void AfterDeserialization() {
     73      RegisterEventHandlers();
     74    }
     75
     76    #region event propagation
     77    private void RegisterEventHandlers() {
     78      TargetVariableParameter.Value.ValueChanged += new EventHandler(TargetVariable_ValueChanged);
     79      TargetVariableParameter.ValueChanged += new EventHandler(TargetVariableParameter_ValueChanged);
     80    }
     81
     82    private void TargetVariableParameter_ValueChanged(object sender, EventArgs e) {
     83      TargetVariableParameter.Value.ValueChanged += new EventHandler(TargetVariable_ValueChanged);
     84      OnProblemChanged();
     85    }
     86
     87    private void TargetVariable_ValueChanged(object sender, EventArgs e) {
     88      OnProblemChanged();
     89    }
     90    #endregion
    6791  }
    6892}
Note: See TracChangeset for help on using the changeset viewer.