Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/ParsedConstraint.cs @ 16776

Last change on this file since 16776 was 16776, checked in by chaider, 5 years ago

#2971

  • Added Expression change event
  • Added errorProvider Validation
File size: 2.1 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Dynamic;
4using System.Linq;
5using System.Text;
6using System.Threading.Tasks;
7using System.Windows.Markup;
8using HeuristicLab.Common;
9using HeuristicLab.Core;
10using HeuristicLab.Data;
11using HeuristicLab.Parameters;
12
13namespace HeuristicLab.Problems.DataAnalysis {
14  [Item("ParsedConstraint", "Represents parsed constraints.")]
15  public class ParsedConstraint : Item {
16
17    protected string input;
18    public string Input {
19      get => input;
20      set => input = value;
21    }
22
23    protected IEnumerable<IntervalConstraint> constraints;
24
25    public IEnumerable<IntervalConstraint> Constraints {
26      get => constraints;
27      set {
28        constraints = value;
29        OnChanged(EventArgs.Empty);
30      }
31  }
32
33    protected IRegressionProblemData problemData;
34
35    public IRegressionProblemData ProblemData {
36      get => problemData;
37      set => problemData = value;
38    }
39
40    protected ParsedConstraint(ParsedConstraint original, Cloner cloner)
41      : base(original, cloner) {
42      this.input = original.Input ?? string.Empty;
43      this.constraints = original.Constraints ?? new CheckedItemList<IntervalConstraint>();
44     
45    }
46
47    public override IDeepCloneable Clone(Cloner cloner) {
48      return new ParsedConstraint(this, cloner);
49    }
50
51    public ParsedConstraint() {
52      this.input = string.Empty;
53      this.constraints = new CheckedItemList<IntervalConstraint>();
54    }
55
56    public ParsedConstraint(string input, IRegressionProblemData problemData) {
57      this.input = input;
58      this.constraints = new CheckedItemList<IntervalConstraint>();
59      this.problemData = problemData;
60    }
61
62    public ParsedConstraint(string input, IEnumerable<IntervalConstraint> constraints) {
63      this.input = input;
64      this.constraints = constraints;
65    }
66
67    public event EventHandler Changed;
68    protected virtual void OnChanged(EventArgs e) {
69      EventHandler handlers = Changed;
70      if (handlers != null)
71        handlers(this, e);
72    }
73  }
74}
Note: See TracBrowser for help on using the repository browser.