Free cookie consent management tool by TermsFeed Policy Generator

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

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

#2971

  • removed unused constructors
  • changed creation of IntervalConstraint in IntervalConstraintParser
File size: 4.2 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21using System;
22using HeuristicLab.Common;
23using HeuristicLab.Core;
24using HEAL.Attic;
25
26namespace HeuristicLab.Problems.DataAnalysis {
27  [StorableType("8109BE58-CCFB-4462-A2F4-EEE5DFADAFF7")]
28  [Item("Interval Constraint", "Constraint on intervals.")]
29  public class IntervalConstraint : NamedItem {
30    private string expression;
31    public string Expression {
32      get => expression;
33      set {
34        if (value != expression) {
35          expression = value;
36          OnChanged(EventArgs.Empty);
37        }
38      }
39    }
40
41    private string definition;
42    public string Definition {
43      get => definition;
44      set {
45        if (value != definition) {
46          definition = value;
47          OnChanged(EventArgs.Empty);
48        }
49      }
50    }
51    public Interval Interval { get; set; }
52    private bool inclusiveLowerBound;
53    public bool InclusiveLowerBound {
54      get => inclusiveLowerBound;
55      set {
56        if (value != inclusiveLowerBound) {
57          inclusiveLowerBound = value;
58          OnChanged(EventArgs.Empty);
59        }
60      }
61    }
62    public bool InclusiveUpperBound { get; set; }
63    public bool IsDerivation { get; set; }
64
65    private string variable;
66    public string Variable {
67      get => variable;
68      set {
69        if (value != variable) {
70          variable = value;
71          OnChanged(EventArgs.Empty);
72        }
73      }
74    }
75
76    public int numberOfDerivation;
77    public int NumberOfDerivation {
78      get => numberOfDerivation;
79      set {
80        if (value != numberOfDerivation) {
81          numberOfDerivation = value;
82          OnChanged(EventArgs.Empty);
83        }
84      }
85    }
86
87    private bool enabled;
88    public bool Enabled {
89      get => enabled;
90      set {
91        if (value != enabled) {
92          enabled = value;
93          OnChanged(EventArgs.Empty);
94        }
95      }
96    }
97
98    public IntervalConstraint(string expression, string definition, Interval interval, bool inclusiveLowerBound,
99      bool inclusiveUpperBound, bool isDerivation, string variable, int numberOfDerivation, bool isChecked) {
100      base.name = expression;
101      Expression = expression;
102      Definition = definition;
103      Interval = interval;
104      InclusiveLowerBound = inclusiveLowerBound;
105      InclusiveUpperBound = inclusiveUpperBound;
106      IsDerivation = isDerivation;
107      Variable = variable;
108      NumberOfDerivation = numberOfDerivation;
109      enabled = isChecked;
110    }
111
112    public override IDeepCloneable Clone(Cloner cloner) {
113      return new IntervalConstraint(this, cloner);
114    }
115
116    protected IntervalConstraint(IntervalConstraint original, Cloner cloner)
117      : base(original, cloner) {
118      this.Expression = original.Expression;
119      this.Definition = original.Definition;
120      this.Interval = original.Interval;
121      this.InclusiveLowerBound = original.InclusiveLowerBound;
122      this.InclusiveUpperBound = original.InclusiveUpperBound;
123      this.IsDerivation = original.IsDerivation;
124      this.Variable = original.Variable;
125      this.NumberOfDerivation = original.NumberOfDerivation;
126      this.enabled = original.enabled;
127    }
128
129    public event EventHandler Changed;
130    protected virtual void OnChanged(EventArgs e) {
131      EventHandler handlers = Changed;
132      if (handlers != null)
133        handlers(this, e);
134    }
135  }
136}
Note: See TracBrowser for help on using the repository browser.