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

Last change on this file since 16778 was 16778, checked in by chaider, 11 months ago

#2971

  • Changed field numberOfDerivation
  • Added numberOfDerivation to Expression string
  • Added numberOfDerivation to parser
File size: 2.2 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;
12using HEAL.Attic;
13
14namespace HeuristicLab.Problems.DataAnalysis {
15  [StorableType("A56BFB05-8F11-4766-9FBF-20C7010F1CA3")]
16  [Item("ParsedConstraint", "Represents parsed constraints.")]
17  public class ParsedConstraint : Item {
18
19    protected string input;
20    public string Input {
21      get => input;
22      set => input = value;
23    }
24
25    protected IEnumerable<IntervalConstraint> constraints;
26    public IEnumerable<IntervalConstraint> Constraints {
27      get => constraints;
28      set { 
29        constraints = value;
30        OnChanged(EventArgs.Empty);
31      }
32  }
33
34    protected IRegressionProblemData problemData;
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      this.problemData = original.problemData;
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.