source: branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Parser/IntervalConstraint.cs @ 16774

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

#2971 Changed Parser and IntevalConstraint View

File size: 2.5 KB
Line 
1using System;
2using System.ComponentModel;
3using System.Drawing;
4using System.Runtime.CompilerServices;
5using HeuristicLab.Common;
6using HeuristicLab.Core;
7using HeuristicLab.Problems.DataAnalysis.Annotations;
8using HEAL.Attic;
9
10namespace HeuristicLab.Problems.DataAnalysis {
11  [StorableType("8109BE58-CCFB-4462-A2F4-EEE5DFADAFF7")]
12  [Item("Interval Constraint", "Constraint on intervals.")]
13  public class IntervalConstraint : NamedItem {
14    public string Expression { get; set; }
15    public string Definition { get; set; }
16    public Interval Interval { get; set; }
17    public bool InclusiveLowerBound { get; set; }
18    public bool InclusiveUpperBound { get; set; }
19    public bool IsDerivation { get; set; }
20
21    private string variable;
22    public string Variable {
23      get => variable;
24      set {
25        if (value != variable) {
26          variable = value;
27          OnChanged(EventArgs.Empty);
28        }
29      }
30    }
31    public int NumberOfDerivation { get; set; }
32
33    public IntervalConstraint() {}
34
35    public IntervalConstraint(string name) {
36      base.name = name;
37    }
38
39    public IntervalConstraint(string expression, string definition, Interval interval, bool inclusiveLowerBound,
40      bool inclusiveUpperBound, bool isDerivation, string variable, int numberOfDerivation) {
41      base.name = expression;
42      Expression = expression;
43      Definition = definition;
44      Interval = interval;
45      InclusiveLowerBound = inclusiveLowerBound;
46      InclusiveUpperBound = inclusiveUpperBound;
47      IsDerivation = isDerivation;
48      Variable = variable;
49      NumberOfDerivation = numberOfDerivation;
50    }
51
52    public override IDeepCloneable Clone(Cloner cloner) {
53      return new IntervalConstraint(this, cloner);
54    }
55
56    protected IntervalConstraint(IntervalConstraint original, Cloner cloner)
57      : base(original, cloner) {
58      this.Expression = original.Expression;
59      this.Definition = original.Definition;
60      this.Interval = original.Interval;
61      this.InclusiveLowerBound = original.InclusiveLowerBound;
62      this.InclusiveUpperBound = original.InclusiveUpperBound;
63      this.IsDerivation = original.IsDerivation;
64      this.Variable = original.Variable;
65      this.NumberOfDerivation = original.NumberOfDerivation;
66    }
67
68    public event EventHandler Changed;
69    protected virtual void OnChanged(EventArgs e) {
70      EventHandler handlers = Changed;
71      if (handlers != null)
72        handlers(this, e);
73    }
74  }
75}
Note: See TracBrowser for help on using the repository browser.