Changeset 16928


Ignore:
Timestamp:
05/08/19 15:56:02 (3 months ago)
Author:
chaider
Message:

#2971 Fixed cloning in ProblemDataConstraint

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/ProblemDataConstraint.cs

    r16896 r16928  
    2323using System;
    2424using System.Collections.Generic;
     25using System.Linq;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    3637                                                  "d'y'/d'x' in [0 .. 10]" + Environment.NewLine +
    3738                                                  "\u2202²'y'/\u2202'x'² in ]-1 .. inf.[";
    38      
     39
     40    private string input;
    3941    [Storable]
    40     public string Input { get; set; }
     42    public string Input {
     43      get => input;
     44      set {
     45        if (input == value) return;
     46        input = value;
     47        OnChanged();
     48      }
     49    }
    4150
    4251    private IEnumerable<IntervalConstraint> constraints;
     
    4453    public IEnumerable<IntervalConstraint> Constraints {
    4554      get => constraints;
    46       set {
     55      set {
     56        if (constraints == value) return;
    4757        constraints = value;
    48         OnChanged(EventArgs.Empty);
     58        OnChanged();
    4959      }
    5060    }
     
    5868      : base(original, cloner) {
    5969      this.Input = original.Input;
    60       this.constraints = original.Constraints;
    61       this.ProblemData = original.ProblemData;
     70      this.constraints = original.Constraints.Select(cloner.Clone);
     71      this.ProblemData = cloner.Clone(original.ProblemData);
    6272    }
    6373
     
    7989
    8090    public event EventHandler Changed;
    81     protected virtual void OnChanged(EventArgs e) {
     91    protected virtual void OnChanged() {
    8292      EventHandler handlers = Changed;
    8393      if (handlers != null)
    84         handlers(this, e);
     94        handlers(this, EventArgs.Empty);
    8595    }
    8696  }
Note: See TracChangeset for help on using the changeset viewer.