Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/06/19 13:01:29 (5 years ago)
Author:
chaider
Message:

#2971 Changed IntervalConstraint

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/IntervalConstraintView.cs

    r16885 r16895  
    124124    }
    125125
    126     private static string UpdateExpression(IntervalConstraint constraint) {
    127       var expression = "";
    128 
    129       if (!constraint.IsDerivation) {
    130         expression = string.Format("{0} in {1}{2} .. {3}{4}",
    131           constraint.Variable,
    132           (constraint.InclusiveLowerBound) ? "[" : "]",
    133           constraint.Interval.LowerBound,
    134           constraint.Interval.UpperBound,
    135           (constraint.InclusiveUpperBound) ? "]" : "[");
    136       } else {
    137         expression = string.Format("\u2202{5}Target/\u2202{0}{6} in {1}{2} .. {3}{4}",
    138           constraint.Variable,
    139           (constraint.InclusiveLowerBound) ? "[" : "]",
    140           constraint.Interval.LowerBound,
    141           constraint.Interval.UpperBound,
    142           (constraint.InclusiveUpperBound) ? "]" : "[",
    143           GetDerivationString(constraint.numberOfDerivation),
    144           GetDerivationString(constraint.numberOfDerivation));
    145       }
    146 
    147       return expression;
    148     }
    149 
    150     private static string UpdateDefintion(IntervalConstraint constraint) {
    151       var definition = "";
    152 
    153       if (!constraint.IsDerivation) {
    154         return "Target " + constraint.Variable;
    155       }
    156 
    157       definition = $"\u2202{GetDerivationString(constraint.numberOfDerivation)}Target/\u2202{constraint.Variable}{GetDerivationString(constraint.numberOfDerivation)}";
    158 
    159       return definition;
    160     }
    161 
    162     private static string GetDerivationString(int derivation) {
    163       switch (derivation) {
    164         case 1:
    165           return "";
    166         case 2:
    167           return "²";
    168         case 3:
    169           return "³";
    170         default:
    171           return "";
    172       }
    173     }
    174 
    175126    #endregion
    176127
     
    198149      if (!double.IsNaN(value)) {
    199150        Content.Interval = new Interval(value, Content.Interval.UpperBound);
    200         var exp = UpdateExpression(Content);
    201         Content.Name = exp;
    202         Content.Expression = exp;
    203151      }
    204152    }
     
    226174      if (!double.IsNaN(value)) {
    227175        Content.Interval = new Interval(Content.Interval.LowerBound, value);
    228         var exp = UpdateExpression(Content);
    229         Content.Name = exp;
    230         Content.Expression = exp;
    231176      }
    232177    }
     
    234179    private void incllowerboundInput_CheckedChanged(object sender, EventArgs e) {
    235180        Content.InclusiveLowerBound = incllowerboundInput.Checked;
    236         var exp = UpdateExpression(Content);
    237         Content.Name = exp;
    238         Content.Expression = exp;
    239181    }
    240182
    241183    private void inclupperboundInput_CheckedChanged(object sender, EventArgs e) {
    242184        Content.InclusiveUpperBound = inclupperboundInput.Checked;
    243         var exp = UpdateExpression(Content);
    244         Content.Name = exp;
    245         Content.Expression = exp;
    246185    }
    247186
     
    257196      else if ((int)numberderivationInput.SelectedItem == 3)
    258197        Content.numberOfDerivation = 3;
    259 
    260       var exp = UpdateExpression(Content);
    261       var def = UpdateDefintion(Content);
    262       Content.Name = exp;
    263       Content.Expression = exp;
    264       Content.Definition = def;
    265198    }
    266199
Note: See TracChangeset for help on using the changeset viewer.