[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 {
|
---|
[16592] | 14 | public string Expression { get; set; }
|
---|
[16587] | 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; }
|
---|
[16774] | 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 | }
|
---|
[16587] | 31 | public int NumberOfDerivation { get; set; }
|
---|
[16596] | 32 |
|
---|
[16772] | 33 | public IntervalConstraint() {}
|
---|
[16596] | 34 |
|
---|
[16773] | 35 | public IntervalConstraint(string name) {
|
---|
| 36 | base.name = name;
|
---|
| 37 | }
|
---|
| 38 |
|
---|
[16772] | 39 | public IntervalConstraint(string expression, string definition, Interval interval, bool inclusiveLowerBound,
|
---|
| 40 | bool inclusiveUpperBound, bool isDerivation, string variable, int numberOfDerivation) {
|
---|
[16773] | 41 | base.name = expression;
|
---|
[16596] | 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 | }
|
---|
[16772] | 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;
|
---|
[16774] | 65 | this.NumberOfDerivation = original.NumberOfDerivation;
|
---|
[16772] | 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 | }
|
---|
[16587] | 74 | }
|
---|
| 75 | }
|
---|