Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/19/16 15:27:34 (8 years ago)
Author:
bburlacu
Message:

#2669: Added setter for the TargetVariable property in the classification and regression model interfaces and adjusted implementing classes accordingly. Similarly, added a TargetVariableChanged event to the models.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionModel.cs

    r14289 r14290  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using HeuristicLab.Common;
     
    3435  public class SymbolicRegressionModel : SymbolicDataAnalysisModel, ISymbolicRegressionModel {
    3536    [Storable]
    36     private readonly string targetVariable;
     37    private string targetVariable;
    3738    public string TargetVariable {
    3839      get { return targetVariable; }
     40      set {
     41        if (string.IsNullOrEmpty(value) || targetVariable == value) return;
     42        targetVariable = value;
     43        OnTargetVariableChanged(this, EventArgs.Empty);
     44      }
    3945    }
    4046
     
    7682      Scale(problemData, problemData.TargetVariable);
    7783    }
     84
     85    #region events
     86    public event EventHandler TargetVariableChanged;
     87    private void OnTargetVariableChanged(object sender, EventArgs args) {
     88      var changed = TargetVariableChanged;
     89      if (changed != null)
     90        changed(sender, args);
     91    }
     92    #endregion
    7893  }
    7994}
Note: See TracChangeset for help on using the changeset viewer.