Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3.2/sources/HeuristicLab.GP.StructureIdentification/3.3/Symbols/VariableView.cs @ 9015

Last change on this file since 9015 was 2843, checked in by gkronber, 15 years ago

Removed max. and min. time offset constraints as algorithm parameters and from all engines. The time constraints were added to the relevant terminal symbols (variable & differential) instead. The time offset constraint can be changed by editing the symbols in the function library. #880 (Max and min time offsets for variable symbols are not set correctly by FunctionLibraryInjectors)

File size: 2.6 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 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 System.Collections.Generic;
23using System.ComponentModel;
24using System.Drawing;
25using System.Data;
26using System.Linq;
27using System.Text;
28using System.Windows.Forms;
29
30namespace HeuristicLab.GP.StructureIdentification {
31  public partial class VariableView : FunctionView {
32    public Variable Variable {
33      get {
34        return (Variable)Item;
35      }
36      set {
37        Item = value;
38      }
39    }
40    public VariableView()
41      : base() {
42      InitializeComponent();
43    }
44
45    public VariableView(Variable variable)
46      : base() {
47      InitializeComponent();
48      Variable = variable;
49    }
50
51    protected override void UpdateControls() {
52      base.UpdateControls();
53      minTimeOffsetTextBox.Text = Variable.MinTimeOffset.ToString();
54      maxTimeOffsetTextBox.Text = Variable.MaxTimeOffset.ToString();
55    }
56
57    private void minTimeOffsetTextBox_TextChanged(object sender, EventArgs e) {
58      int minTimeOffset;
59      if (int.TryParse(minTimeOffsetTextBox.Text, out minTimeOffset)) {
60        Variable.MinTimeOffset = minTimeOffset;
61        functionPropertiesErrorProvider.SetError(minTimeOffsetTextBox, string.Empty);
62      } else {
63        functionPropertiesErrorProvider.SetError(minTimeOffsetTextBox, "Invalid value");
64      }
65    }
66
67    private void maxTimeOffsetTextBox_TextChanged(object sender, EventArgs e) {
68      int maxTimeOffset;
69      if (int.TryParse(maxTimeOffsetTextBox.Text, out maxTimeOffset)) {
70        Variable.MaxTimeOffset = maxTimeOffset;
71        functionPropertiesErrorProvider.SetError(maxTimeOffsetTextBox, string.Empty);
72      } else {
73        functionPropertiesErrorProvider.SetError(maxTimeOffsetTextBox, "Invalid value");
74      }
75
76    }
77  }
78}
Note: See TracBrowser for help on using the repository browser.