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