Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16772 for branches


Ignore:
Timestamp:
04/08/19 15:29:49 (6 years ago)
Author:
chaider
Message:

#2971 Changed IntervalConstraints View

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  
    576576      <DependentUpon>TimeSeriesPrognosisSolutionErrorCharacteristicsCurveView.cs</DependentUpon>
    577577    </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>
    578584    <None Include="HeuristicLab.snk" />
    579585    <None Include="Plugin.cs.frame" />
     
    628634      <DependentUpon>TextValueView.cs</DependentUpon>
    629635    </EmbeddedResource>
     636    <EmbeddedResource Include="IntervalConstraintView.resx">
     637      <DependentUpon>IntervalConstraintView.cs</DependentUpon>
     638    </EmbeddedResource>
    630639  </ItemGroup>
    631640  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/ParsedConstraintView.cs

    r16756 r16772  
    88using System.Threading.Tasks;
    99using System.Windows.Forms;
     10using HeuristicLab.Core;
    1011using HeuristicLab.MainForm;
    1112using HeuristicLab.MainForm.WindowsForms;
     
    2223    public ParsedConstraintView() {
    2324      InitializeComponent();
    24       constraintsOutput.ReadOnly = true;
     25      errorOutput.Text = "";
    2526    }
    2627
     
    2930      if (Content == null) {
    3031        constraintsInput.Text = string.Empty;
    31         constraintsOutput.Text = string.Empty;
    32       } else { 
     32        errorOutput.Text = "";
     33      } else {
    3334        constraintsInput.Text = Content.Input;
    34         constraintsOutput.Text = ConstraintsOutput(Content.Constraints ?? new List<IntervalConstraint>());
     35        constraintsOutput.Content = new ItemList<IntervalConstraint>(Content.Constraints) ?? new ItemList<IntervalConstraint>();
    3536      }
    3637    }
    3738
    38     private IEnumerable<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;
    4142    }
    4243
     
    5556    private void parseBtn_Click(object sender, EventArgs e) {
    5657      if (constraintsInput.Text != null) {
    57         var constraints = ParseConstraints(constraintsInput.Text);
    58         constraintsOutput.Text = ConstraintsOutput(constraints);
    59         Content.Constraints = constraints;
     58        var constaints = ParseConstraints(constraintsInput.Text);
     59        constraintsOutput.Content = constaints;
     60        Content.Constraints = constaints;
    6061        Content.Input = constraintsInput.Text;
    61       } else {
    62         constraintsOutput.Text = "No Constraints found!";
     62        errorOutput.Text = "";
     63      } else {
     64        errorOutput.Text = "No constraints were found!";
    6365      }
     66    }
     67
     68    private void constraintsInput_TextChanged(object sender, EventArgs e) {
     69      errorOutput.Text = "Unparsed changes! Press parse button to save changes.";
    6470    }
    6571  }
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/ParsedConstraintView.designer.cs

    r16756 r16772  
    2424    /// </summary>
    2525    private void InitializeComponent() {
     26      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ParsedConstraintView));
    2627      this.splitContainer1 = new System.Windows.Forms.SplitContainer();
     28      this.groupBox1 = new System.Windows.Forms.GroupBox();
     29      this.constraintsInput = new System.Windows.Forms.TextBox();
    2730      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();
    3036      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
    3137      this.splitContainer1.Panel1.SuspendLayout();
    3238      this.splitContainer1.Panel2.SuspendLayout();
    3339      this.splitContainer1.SuspendLayout();
     40      this.groupBox1.SuspendLayout();
     41      this.groupBox2.SuspendLayout();
    3442      this.SuspendLayout();
    3543      //
     
    3947      this.splitContainer1.Location = new System.Drawing.Point(0, 0);
    4048      this.splitContainer1.Name = "splitContainer1";
    41       this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
    4249      //
    4350      // splitContainer1.Panel1
    4451      //
    45       this.splitContainer1.Panel1.Controls.Add(this.constraintsInput);
    46       this.splitContainer1.Panel1.Controls.Add(this.constraintsOutput);
     52      this.splitContainer1.Panel1.Controls.Add(this.groupBox1);
    4753      //
    4854      // splitContainer1.Panel2
    4955      //
    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;
    5359      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);
    5485      //
    5586      // parseBtn
    5687      //
    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);
    5890      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";
    6294      this.parseBtn.UseVisualStyleBackColor = true;
    6395      this.parseBtn.Click += new System.EventHandler(this.parseBtn_Click);
    6496      //
     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      //
    65119      // constraintsOutput
    66120      //
    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);
    70123      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;
    73126      //
    74       // constraintsInput
     127      // errorOutput
    75128      //
    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;
    82137      //
    83138      // ParsedConstraintView
     
    87142      this.Controls.Add(this.splitContainer1);
    88143      this.Name = "ParsedConstraintView";
    89       this.Size = new System.Drawing.Size(517, 386);
     144      this.Size = new System.Drawing.Size(888, 629);
    90145      this.splitContainer1.Panel1.ResumeLayout(false);
    91       this.splitContainer1.Panel1.PerformLayout();
    92146      this.splitContainer1.Panel2.ResumeLayout(false);
    93147      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
    94148      this.splitContainer1.ResumeLayout(false);
     149      this.groupBox1.ResumeLayout(false);
     150      this.groupBox1.PerformLayout();
     151      this.groupBox2.ResumeLayout(false);
    95152      this.ResumeLayout(false);
    96153
     
    100157
    101158    private System.Windows.Forms.SplitContainer splitContainer1;
     159    private System.Windows.Forms.GroupBox groupBox1;
    102160    private System.Windows.Forms.Button parseBtn;
     161    private System.Windows.Forms.Label label1;
    103162    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;
    105168  }
    106169}
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/ParsedConstraintView.resx

    r16756 r16772  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
     120  <data name="label1.Text" xml:space="preserve">
     121    <value>Input your Constraints here.
     122The constraints must be in a form like this:
     123Target:F1 in [0 .. 100]
     124dF1 / 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
     134Comments can be written with leading #
     135</value>
     136  </data>
    120137</root>
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj

    r16756 r16772  
    306306    <Compile Include="Implementation\Classification\ThresholdCalculators\NormalDistributionCutPointsThresholdCalculator.cs" />
    307307    <Compile Include="Implementation\Classification\ThresholdCalculators\ThresholdCalculator.cs" />
     308    <Compile Include="Properties\Annotations.cs" />
    308309    <Compile Include="TextValue.cs" />
    309310    <None Include="HeuristicLab.snk" />
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Parser/IntervalConstraint.cs

    r16644 r16772  
    1 using HEAL.Attic;
     1using System;
     2using System.ComponentModel;
     3using System.Drawing;
     4using System.Runtime.CompilerServices;
     5using HeuristicLab.Common;
     6using HeuristicLab.Core;
     7using HeuristicLab.Problems.DataAnalysis.Annotations;
     8using HEAL.Attic;
    29
    310namespace HeuristicLab.Problems.DataAnalysis {
    411  [StorableType("8109BE58-CCFB-4462-A2F4-EEE5DFADAFF7")]
    5   public class IntervalConstraint {
     12  [Item("Interval Constraint", "Constraint on intervals.")]
     13  public class IntervalConstraint : Item {
    614    public string Expression { get; set; }
    715    public string Definition { get; set; }
     
    1321    public int NumberOfDerivation { get; set; }
    1422
    15     public IntervalConstraint() { }
     23    public IntervalConstraint() {}
    1624
    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) {
    1827      Expression = expression;
    1928      Definition = definition;
     
    2534      NumberOfDerivation = numberOfDerivation;
    2635    }
     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    }
    2759  }
    2860}
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/ParsedConstraint.cs

    r16759 r16772  
    2929      : base(original, cloner) {
    3030      this.input = original.Input ?? string.Empty;
    31       this.constraints = original.Constraints ?? new List<IntervalConstraint>();
     31      this.constraints = original.Constraints ?? new ItemList<IntervalConstraint>();
    3232    }
    3333
     
    3838    public ParsedConstraint() {
    3939      this.input = string.Empty;
    40       this.constraints = new List<IntervalConstraint>();
     40      this.constraints = new ItemList<IntervalConstraint>();
    4141    }
    4242
    4343    public ParsedConstraint(string input) {
    4444      this.input = input;
    45       this.constraints = new List<IntervalConstraint>();
     45      this.constraints = new ItemList<IntervalConstraint>();
    4646    }
    4747
Note: See TracChangeset for help on using the changeset viewer.