Changeset 16778
- Timestamp:
- 04/12/19 13:09:17 (6 years ago)
- Location:
- branches/2971_named_intervals
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/IntervalConstraintView.Designer.cs
r16777 r16778 37 37 this.lowerboundInput = new System.Windows.Forms.TextBox(); 38 38 this.variableInput = new System.Windows.Forms.TextBox(); 39 this.numberderivationInput = new System.Windows.Forms.TextBox();40 39 this.groupBox1 = new System.Windows.Forms.GroupBox(); 41 40 this.ischeckedCheckBox = new System.Windows.Forms.CheckBox(); … … 46 45 this.derivationInput = new System.Windows.Forms.CheckBox(); 47 46 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 47 this.numberderivationInput = new System.Windows.Forms.ComboBox(); 48 48 this.groupBox1.SuspendLayout(); 49 49 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); … … 162 162 this.variableInput.TabIndex = 15; 163 163 // 164 // numberderivationInput165 //166 this.numberderivationInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)167 | System.Windows.Forms.AnchorStyles.Right)));168 this.numberderivationInput.Location = new System.Drawing.Point(111, 221);169 this.numberderivationInput.Name = "numberderivationInput";170 this.numberderivationInput.Size = new System.Drawing.Size(470, 20);171 this.numberderivationInput.TabIndex = 17;172 this.numberderivationInput.Validating += new System.ComponentModel.CancelEventHandler(this.numberderivationInput_Validating);173 this.numberderivationInput.Validated += new System.EventHandler(this.numberderivationInput_Validated);174 //175 164 // groupBox1 176 165 // 166 this.groupBox1.Controls.Add(this.numberderivationInput); 177 167 this.groupBox1.Controls.Add(this.ischeckedCheckBox); 178 168 this.groupBox1.Controls.Add(this.expressionInput); … … 181 171 this.groupBox1.Controls.Add(this.incllowerboundInput); 182 172 this.groupBox1.Controls.Add(this.derivationInput); 183 this.groupBox1.Controls.Add(this.numberderivationInput);184 173 this.groupBox1.Controls.Add(this.variableInput); 185 174 this.groupBox1.Controls.Add(this.lowerboundInput); … … 217 206 this.expressionInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 218 207 | System.Windows.Forms.AnchorStyles.Right))); 219 this.expressionInput.Location = new System.Drawing.Point(1 08, 17);208 this.expressionInput.Location = new System.Drawing.Point(111, 17); 220 209 this.expressionInput.Name = "expressionInput"; 221 210 this.expressionInput.Size = new System.Drawing.Size(473, 20); … … 264 253 this.errorProvider.ContainerControl = this; 265 254 this.errorProvider.RightToLeft = true; 255 // 256 // numberderivationInput 257 // 258 this.numberderivationInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 259 | System.Windows.Forms.AnchorStyles.Right))); 260 this.numberderivationInput.FormattingEnabled = true; 261 this.numberderivationInput.Location = new System.Drawing.Point(111, 224); 262 this.numberderivationInput.Name = "numberderivationInput"; 263 this.numberderivationInput.Size = new System.Drawing.Size(470, 21); 264 this.numberderivationInput.TabIndex = 27; 265 this.numberderivationInput.SelectedIndexChanged += new System.EventHandler(this.numberderivationInput_SelectedIndexChanged); 266 266 // 267 267 // IntervalConstraintView … … 291 291 private System.Windows.Forms.TextBox lowerboundInput; 292 292 private System.Windows.Forms.TextBox variableInput; 293 private System.Windows.Forms.TextBox numberderivationInput;294 293 private System.Windows.Forms.GroupBox groupBox1; 295 294 private System.Windows.Forms.CheckBox derivationInput; … … 300 299 private System.Windows.Forms.ErrorProvider errorProvider; 301 300 private System.Windows.Forms.CheckBox ischeckedCheckBox; 301 private System.Windows.Forms.ComboBox numberderivationInput; 302 302 } 303 303 } -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/IntervalConstraintView.cs
r16777 r16778 25 25 public IntervalConstraintView() { 26 26 InitializeComponent(); 27 int [] items = {1, 2, 3}; 27 28 expressionInput.ReadOnly = true; 28 29 definitionInput.ReadOnly = true; 29 30 derivationInput.Enabled = false; 30 31 derivationInput.Checked = Content?.IsDerivation ?? false; 31 if (Content != null && !Content.IsDerivation) 32 numberderivationInput.ReadOnly = true; 32 numberderivationInput.DataSource = items; 33 33 } 34 34 … … 85 85 derivationInput.Checked = Content.IsDerivation; 86 86 variableInput.Text = Content.Variable; 87 numberderivationInput.Text = Content.NumberOfDerivation.ToString(); 87 if (!Content.IsDerivation) { 88 numberderivationInput.Enabled = false; 89 } else { 90 numberderivationInput.Enabled = true; 91 numberderivationInput.SelectedItem = Content.NumberOfDerivation; 92 } 88 93 ischeckedCheckBox.Checked = Content.IsChecked; 89 //Content.Changed += Content_Changed; 90 94 Content.Changed += Content_Changed; 91 95 } 92 96 SetEnabledStateOfControls(); … … 104 108 (Content.InclusiveUpperBound) ? "]" : "["); 105 109 } else { 106 expression = string.Format("\u2202 Target/\u2202{0} in {1}{2} .. {3}{4}",110 expression = string.Format("\u2202{5}Target/\u2202{0}{6} in {1}{2} .. {3}{4}", 107 111 Content.Variable, 108 112 (Content.InclusiveLowerBound) ? "[" : "]", 109 113 Content.Interval.LowerBound, 110 114 Content.Interval.UpperBound, 111 (Content.InclusiveUpperBound) ? "]" : "["); 115 (Content.InclusiveUpperBound) ? "]" : "[", 116 PrintNumberOfDerivation(Content.numberOfDerivation), 117 PrintNumberOfDerivation(Content.numberOfDerivation)); 112 118 } 113 119 … … 117 123 } 118 124 125 private string PrintNumberOfDerivation(int derivation) { 126 switch (derivation) { 127 case 1: 128 return ""; 129 case 2: 130 return "²"; 131 case 3: 132 return "³"; 133 default: 134 return ""; 135 } 136 } 137 119 138 #endregion 120 139 121 140 #region control event handlers 122 123 private void numberderivationInput_Validating(object sender, CancelEventArgs e) {124 if (int.TryParse(numberderivationInput.Text, out var derivation)) {125 if (derivation >= 0) {126 errorProvider.SetError(numberderivationInput, string.Empty);127 e.Cancel = false;128 } else {129 errorProvider.SetError(numberderivationInput, "Invalid Input: Derivation must be positive!");130 e.Cancel = true;131 }132 } else {133 errorProvider.SetError(numberderivationInput, "Invalid Input: Derivation must be an integer!");134 e.Cancel = true;135 }136 }137 138 private void numberderivationInput_Validated(object sender, EventArgs e) {139 if (int.TryParse(numberderivationInput.Text, out var derivation)) {140 Content.NumberOfDerivation = derivation;141 UpdateExpression();142 }143 }144 145 141 private void lowerboundInput_Validating(object sender, CancelEventArgs e) { 146 142 var value = ParseDoubleValue(lowerboundInput.Text, lowerboundInput); … … 212 208 } 213 209 210 private void numberderivationInput_SelectedIndexChanged(object sender, EventArgs e) { 211 if ((int)numberderivationInput.SelectedItem == 1) 212 Content.numberOfDerivation = 1; 213 else if ((int)numberderivationInput.SelectedItem == 2) 214 Content.numberOfDerivation = 2; 215 else if ((int)numberderivationInput.SelectedItem == 3) 216 Content.numberOfDerivation = 3; 217 218 UpdateExpression(); 219 } 220 214 221 #endregion 215 222 … … 221 228 222 229 #endregion 230 231 223 232 } 224 233 } -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/ParsedConstraintView.cs
r16777 r16778 35 35 if (constraintsInput.Text != null) { 36 36 intervalConstraints = ParseConstraints(constraintsInput.Text); 37 intervalConstraints.CheckedItemsChanged -= constraints_CheckedItemsChanged; 37 38 intervalConstraints.CheckedItemsChanged += constraints_CheckedItemsChanged; 38 39 constraintsOutput.Content = intervalConstraints; -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Parser/IntervalConstraint.cs
r16777 r16778 47 47 } 48 48 } 49 public int NumberOfDerivation { get; set; } 49 50 public int numberOfDerivation; 51 public int NumberOfDerivation { 52 get => numberOfDerivation; 53 set { 54 if (value != numberOfDerivation) { 55 numberOfDerivation = value; 56 OnChanged(EventArgs.Empty); 57 } 58 } 59 } 50 60 51 61 private bool isChecked; -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Parser/IntervalConstraintsParser.cs
r16774 r16778 71 71 var upperBound = ParseIntervalBounds(match.Groups[6].Value); 72 72 var constraint = new IntervalConstraint(match.Groups[0].Value); 73 constraint.Expression = match.Groups[0].Value;74 constraint.Definition = " ";73 constraint.Expression = "Target " + match.Groups[0].Value; 74 constraint.Definition = "Target " + match.Groups[1].Value.Trim(); 75 75 constraint.Variable = match.Groups[1].Value.Trim(); 76 76 constraint.InclusiveLowerBound = match.Groups[3].Value.Trim() == "["; … … 122 122 constraint.InclusiveUpperBound = match.Groups[12].Value.Trim() == "]"; 123 123 constraint.Variable = match.Groups[6].Value.Trim(); 124 constraint.NumberOfDerivation = ParseDerivationCount(match.Groups[2].Value );124 constraint.NumberOfDerivation = ParseDerivationCount(match.Groups[2].Value.Trim()); 125 125 constraint.Interval = new Interval(lowerBound, upperBound); 126 126 … … 160 160 private static int ParseDerivationCount(string input) { 161 161 switch (input) { 162 case "": 163 return 1; 162 164 case "²": 163 165 return 2; -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/ParsedConstraint.cs
r16777 r16778 10 10 using HeuristicLab.Data; 11 11 using HeuristicLab.Parameters; 12 using HEAL.Attic; 12 13 13 14 namespace HeuristicLab.Problems.DataAnalysis { 15 [StorableType("A56BFB05-8F11-4766-9FBF-20C7010F1CA3")] 14 16 [Item("ParsedConstraint", "Represents parsed constraints.")] 15 17 public class ParsedConstraint : Item { … … 22 24 23 25 protected IEnumerable<IntervalConstraint> constraints; 24 25 26 public IEnumerable<IntervalConstraint> Constraints { 26 27 get => constraints; … … 32 33 33 34 protected IRegressionProblemData problemData; 34 35 35 public IRegressionProblemData ProblemData { 36 36 get => problemData;
Note: See TracChangeset
for help on using the changeset viewer.