Changeset 16772
- Timestamp:
- 04/08/19 15:29:49 (6 years ago)
- Location:
- branches/2971_named_intervals
- Files:
-
- 4 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj
r16756 r16772 576 576 <DependentUpon>TimeSeriesPrognosisSolutionErrorCharacteristicsCurveView.cs</DependentUpon> 577 577 </Compile> 578 <Compile Include="IntervalConstraintView.cs"> 579 <SubType>UserControl</SubType> 580 </Compile> 581 <Compile Include="IntervalConstraintView.Designer.cs"> 582 <DependentUpon>IntervalConstraintView.cs</DependentUpon> 583 </Compile> 578 584 <None Include="HeuristicLab.snk" /> 579 585 <None Include="Plugin.cs.frame" /> … … 628 634 <DependentUpon>TextValueView.cs</DependentUpon> 629 635 </EmbeddedResource> 636 <EmbeddedResource Include="IntervalConstraintView.resx"> 637 <DependentUpon>IntervalConstraintView.cs</DependentUpon> 638 </EmbeddedResource> 630 639 </ItemGroup> 631 640 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/ParsedConstraintView.cs
r16756 r16772 8 8 using System.Threading.Tasks; 9 9 using System.Windows.Forms; 10 using HeuristicLab.Core; 10 11 using HeuristicLab.MainForm; 11 12 using HeuristicLab.MainForm.WindowsForms; … … 22 23 public ParsedConstraintView() { 23 24 InitializeComponent(); 24 constraintsOutput.ReadOnly = true;25 errorOutput.Text = ""; 25 26 } 26 27 … … 29 30 if (Content == null) { 30 31 constraintsInput.Text = string.Empty; 31 constraintsOutput.Text = string.Empty;32 } else { 32 errorOutput.Text = ""; 33 } else { 33 34 constraintsInput.Text = Content.Input; 34 constraintsOutput. Text = ConstraintsOutput(Content.Constraints ?? new List<IntervalConstraint>());35 constraintsOutput.Content = new ItemList<IntervalConstraint>(Content.Constraints) ?? new ItemList<IntervalConstraint>(); 35 36 } 36 37 } 37 38 38 private I Enumerable<IntervalConstraint> ParseConstraints(string input) {39 var parsedIntervals = IntervalConstraintsParser.Parse(input);40 return parsedIntervals;39 private ItemList<IntervalConstraint> ParseConstraints(string input) { 40 ItemList<IntervalConstraint> constraints = new ItemList<IntervalConstraint>(IntervalConstraintsParser.Parse(input)); 41 return constraints; 41 42 } 42 43 … … 55 56 private void parseBtn_Click(object sender, EventArgs e) { 56 57 if (constraintsInput.Text != null) { 57 var const raints = ParseConstraints(constraintsInput.Text);58 constraintsOutput. Text = ConstraintsOutput(constraints);59 Content.Constraints = const raints;58 var constaints = ParseConstraints(constraintsInput.Text); 59 constraintsOutput.Content = constaints; 60 Content.Constraints = constaints; 60 61 Content.Input = constraintsInput.Text; 61 } else { 62 constraintsOutput.Text = "No Constraints found!"; 62 errorOutput.Text = ""; 63 } else { 64 errorOutput.Text = "No constraints were found!"; 63 65 } 66 } 67 68 private void constraintsInput_TextChanged(object sender, EventArgs e) { 69 errorOutput.Text = "Unparsed changes! Press parse button to save changes."; 64 70 } 65 71 } -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/ParsedConstraintView.designer.cs
r16756 r16772 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ParsedConstraintView)); 26 27 this.splitContainer1 = new System.Windows.Forms.SplitContainer(); 28 this.groupBox1 = new System.Windows.Forms.GroupBox(); 29 this.constraintsInput = new System.Windows.Forms.TextBox(); 27 30 this.parseBtn = new System.Windows.Forms.Button(); 28 this.constraintsOutput = new System.Windows.Forms.TextBox(); 29 this.constraintsInput = new System.Windows.Forms.TextBox(); 31 this.label1 = new System.Windows.Forms.Label(); 32 this.groupBox2 = new System.Windows.Forms.GroupBox(); 33 //this.constraintsOutput = new System.Windows.Forms.Label(); 34 this.constraintsOutput = new HeuristicLab.Core.Views.ItemListView<IntervalConstraint>(); 35 this.errorOutput = new System.Windows.Forms.Label(); 30 36 ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); 31 37 this.splitContainer1.Panel1.SuspendLayout(); 32 38 this.splitContainer1.Panel2.SuspendLayout(); 33 39 this.splitContainer1.SuspendLayout(); 40 this.groupBox1.SuspendLayout(); 41 this.groupBox2.SuspendLayout(); 34 42 this.SuspendLayout(); 35 43 // … … 39 47 this.splitContainer1.Location = new System.Drawing.Point(0, 0); 40 48 this.splitContainer1.Name = "splitContainer1"; 41 this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;42 49 // 43 50 // splitContainer1.Panel1 44 51 // 45 this.splitContainer1.Panel1.Controls.Add(this.constraintsInput); 46 this.splitContainer1.Panel1.Controls.Add(this.constraintsOutput); 52 this.splitContainer1.Panel1.Controls.Add(this.groupBox1); 47 53 // 48 54 // splitContainer1.Panel2 49 55 // 50 this.splitContainer1.Panel2.Controls.Add(this. parseBtn);51 this.splitContainer1.Size = new System.Drawing.Size( 517, 386);52 this.splitContainer1.SplitterDistance = 347;56 this.splitContainer1.Panel2.Controls.Add(this.groupBox2); 57 this.splitContainer1.Size = new System.Drawing.Size(888, 629); 58 this.splitContainer1.SplitterDistance = 296; 53 59 this.splitContainer1.TabIndex = 0; 60 // 61 // groupBox1 62 // 63 this.groupBox1.Controls.Add(this.constraintsInput); 64 this.groupBox1.Controls.Add(this.parseBtn); 65 this.groupBox1.Controls.Add(this.label1); 66 this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; 67 this.groupBox1.Location = new System.Drawing.Point(0, 0); 68 this.groupBox1.Name = "groupBox1"; 69 this.groupBox1.Size = new System.Drawing.Size(296, 629); 70 this.groupBox1.TabIndex = 3; 71 this.groupBox1.TabStop = false; 72 this.groupBox1.Text = "Constraints Input"; 73 // 74 // constraintsInput 75 // 76 this.constraintsInput.AcceptsTab = true; 77 this.constraintsInput.Dock = System.Windows.Forms.DockStyle.Fill; 78 this.constraintsInput.Location = new System.Drawing.Point(3, 198); 79 this.constraintsInput.Multiline = true; 80 this.constraintsInput.Name = "constraintsInput"; 81 this.constraintsInput.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; 82 this.constraintsInput.Size = new System.Drawing.Size(290, 405); 83 this.constraintsInput.TabIndex = 2; 84 this.constraintsInput.TextChanged += new System.EventHandler(this.constraintsInput_TextChanged); 54 85 // 55 86 // parseBtn 56 87 // 57 this.parseBtn.Location = new System.Drawing.Point(3, 3); 88 this.parseBtn.Dock = System.Windows.Forms.DockStyle.Bottom; 89 this.parseBtn.Location = new System.Drawing.Point(3, 603); 58 90 this.parseBtn.Name = "parseBtn"; 59 this.parseBtn.Size = new System.Drawing.Size( 75, 23);60 this.parseBtn.TabIndex = 0;61 this.parseBtn.Text = "Parse ";91 this.parseBtn.Size = new System.Drawing.Size(290, 23); 92 this.parseBtn.TabIndex = 1; 93 this.parseBtn.Text = "Parse Constraints"; 62 94 this.parseBtn.UseVisualStyleBackColor = true; 63 95 this.parseBtn.Click += new System.EventHandler(this.parseBtn_Click); 64 96 // 97 // label1 98 // 99 this.label1.AutoSize = true; 100 this.label1.Dock = System.Windows.Forms.DockStyle.Top; 101 this.label1.Location = new System.Drawing.Point(3, 16); 102 this.label1.Name = "label1"; 103 this.label1.Size = new System.Drawing.Size(250, 182); 104 this.label1.TabIndex = 0; 105 this.label1.Text = resources.GetString("label1.Text"); 106 // 107 // groupBox2 108 // 109 this.groupBox2.Controls.Add(this.constraintsOutput); 110 this.groupBox2.Controls.Add(this.errorOutput); 111 this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill; 112 this.groupBox2.Location = new System.Drawing.Point(0, 0); 113 this.groupBox2.Name = "groupBox2"; 114 this.groupBox2.Size = new System.Drawing.Size(588, 629); 115 this.groupBox2.TabIndex = 0; 116 this.groupBox2.TabStop = false; 117 this.groupBox2.Text = "Parsed Constraints"; 118 // 65 119 // constraintsOutput 66 120 // 67 this.constraintsOutput.Dock = System.Windows.Forms.DockStyle.Right; 68 this.constraintsOutput.Location = new System.Drawing.Point(276, 0); 69 this.constraintsOutput.Multiline = true; 121 this.constraintsOutput.Dock = System.Windows.Forms.DockStyle.Fill; 122 this.constraintsOutput.Location = new System.Drawing.Point(3, 16); 70 123 this.constraintsOutput.Name = "constraintsOutput"; 71 this.constraintsOutput.Size = new System.Drawing.Size( 241, 347);72 this.constraintsOutput.TabIndex = 0;124 this.constraintsOutput.Size = new System.Drawing.Size(582, 587); 125 this.constraintsOutput.TabIndex = 2; 73 126 // 74 // constraintsInput127 // errorOutput 75 128 // 76 this.constraintsInput.Dock = System.Windows.Forms.DockStyle.Left; 77 this.constraintsInput.Location = new System.Drawing.Point(0, 0); 78 this.constraintsInput.Multiline = true; 79 this.constraintsInput.Name = "constraintsInput"; 80 this.constraintsInput.Size = new System.Drawing.Size(241, 347); 81 this.constraintsInput.TabIndex = 1; 129 this.errorOutput.Dock = System.Windows.Forms.DockStyle.Bottom; 130 this.errorOutput.ForeColor = System.Drawing.Color.Red; 131 this.errorOutput.Location = new System.Drawing.Point(3, 603); 132 this.errorOutput.Name = "errorOutput"; 133 this.errorOutput.Size = new System.Drawing.Size(582, 23); 134 this.errorOutput.TabIndex = 1; 135 this.errorOutput.Text = "ERROR"; 136 this.errorOutput.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 82 137 // 83 138 // ParsedConstraintView … … 87 142 this.Controls.Add(this.splitContainer1); 88 143 this.Name = "ParsedConstraintView"; 89 this.Size = new System.Drawing.Size( 517, 386);144 this.Size = new System.Drawing.Size(888, 629); 90 145 this.splitContainer1.Panel1.ResumeLayout(false); 91 this.splitContainer1.Panel1.PerformLayout();92 146 this.splitContainer1.Panel2.ResumeLayout(false); 93 147 ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); 94 148 this.splitContainer1.ResumeLayout(false); 149 this.groupBox1.ResumeLayout(false); 150 this.groupBox1.PerformLayout(); 151 this.groupBox2.ResumeLayout(false); 95 152 this.ResumeLayout(false); 96 153 … … 100 157 101 158 private System.Windows.Forms.SplitContainer splitContainer1; 159 private System.Windows.Forms.GroupBox groupBox1; 102 160 private System.Windows.Forms.Button parseBtn; 161 private System.Windows.Forms.Label label1; 103 162 private System.Windows.Forms.TextBox constraintsInput; 104 private System.Windows.Forms.TextBox constraintsOutput; 163 private System.Windows.Forms.GroupBox groupBox2; 164 private System.Windows.Forms.Label errorOutput; 165 166 //private System.Windows.Forms.Label constraintsOutput; 167 private HeuristicLab.Core.Views.ItemListView<IntervalConstraint> constraintsOutput; 105 168 } 106 169 } -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/ParsedConstraintView.resx
r16756 r16772 118 118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 119 119 </resheader> 120 <data name="label1.Text" xml:space="preserve"> 121 <value>Input your Constraints here. 122 The constraints must be in a form like this: 123 Target:F1 in [0 .. 100] 124 dF1 / X1 in ].inf .. 100] 125 126 - Mark Target Variable with Prefix Target: 127 - Derivation can be written with d or symbol 128 - the in keywords seperates formulation from interval 129 - Interval can be closed [ or open ] 130 - Lowerbound and Upperbound are seperated by .. 131 - Postive infinity (inf.) 132 - Negative infinity (-inf.) 133 134 Comments can be written with leading # 135 </value> 136 </data> 120 137 </root> -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj
r16756 r16772 306 306 <Compile Include="Implementation\Classification\ThresholdCalculators\NormalDistributionCutPointsThresholdCalculator.cs" /> 307 307 <Compile Include="Implementation\Classification\ThresholdCalculators\ThresholdCalculator.cs" /> 308 <Compile Include="Properties\Annotations.cs" /> 308 309 <Compile Include="TextValue.cs" /> 309 310 <None Include="HeuristicLab.snk" /> -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Parser/IntervalConstraint.cs
r16644 r16772 1 using HEAL.Attic; 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; 2 9 3 10 namespace HeuristicLab.Problems.DataAnalysis { 4 11 [StorableType("8109BE58-CCFB-4462-A2F4-EEE5DFADAFF7")] 5 public class IntervalConstraint { 12 [Item("Interval Constraint", "Constraint on intervals.")] 13 public class IntervalConstraint : Item { 6 14 public string Expression { get; set; } 7 15 public string Definition { get; set; } … … 13 21 public int NumberOfDerivation { get; set; } 14 22 15 public IntervalConstraint() { 23 public IntervalConstraint() {} 16 24 17 public IntervalConstraint(string expression, string definition, Interval interval, bool inclusiveLowerBound, bool inclusiveUpperBound, bool isDerivation, string variable, int numberOfDerivation) { 25 public IntervalConstraint(string expression, string definition, Interval interval, bool inclusiveLowerBound, 26 bool inclusiveUpperBound, bool isDerivation, string variable, int numberOfDerivation) { 18 27 Expression = expression; 19 28 Definition = definition; … … 25 34 NumberOfDerivation = numberOfDerivation; 26 35 } 36 37 public override IDeepCloneable Clone(Cloner cloner) { 38 return new IntervalConstraint(this, cloner); 39 } 40 41 protected IntervalConstraint(IntervalConstraint original, Cloner cloner) 42 : base(original, cloner) { 43 this.Expression = original.Expression; 44 this.Definition = original.Definition; 45 this.Interval = original.Interval; 46 this.InclusiveLowerBound = original.InclusiveLowerBound; 47 this.InclusiveUpperBound = original.InclusiveUpperBound; 48 this.IsDerivation = original.IsDerivation; 49 this.Variable = original.Variable; 50 this.NumberOfDerivation = NumberOfDerivation; 51 } 52 53 public event EventHandler Changed; 54 protected virtual void OnChanged(EventArgs e) { 55 EventHandler handlers = Changed; 56 if (handlers != null) 57 handlers(this, e); 58 } 27 59 } 28 60 } -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/ParsedConstraint.cs
r16759 r16772 29 29 : base(original, cloner) { 30 30 this.input = original.Input ?? string.Empty; 31 this.constraints = original.Constraints ?? new List<IntervalConstraint>();31 this.constraints = original.Constraints ?? new ItemList<IntervalConstraint>(); 32 32 } 33 33 … … 38 38 public ParsedConstraint() { 39 39 this.input = string.Empty; 40 this.constraints = new List<IntervalConstraint>();40 this.constraints = new ItemList<IntervalConstraint>(); 41 41 } 42 42 43 43 public ParsedConstraint(string input) { 44 44 this.input = input; 45 this.constraints = new List<IntervalConstraint>();45 this.constraints = new ItemList<IntervalConstraint>(); 46 46 } 47 47
Note: See TracChangeset
for help on using the changeset viewer.