Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2971_named_intervals/HeuristicLab.Data/3.3/VariableRanges.cs @ 16414

Last change on this file since 16414 was 16413, checked in by chaider, 5 years ago

#2971

  • Added parameter VariableRanges to RegressionProblemData
  • Added VariableRanges class
  • Added View class for VariableRanges
File size: 2.6 KB
Line 
1using HeuristicLab.Common;
2using HeuristicLab.Core;
3using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
4using HeuristicLab.Problems.DataAnalysis;
5using System;
6using System.Collections.Generic;
7using System.Linq;
8using System.Text;
9using System.Threading.Tasks;
10
11namespace HeuristicLab.Data {
12  [Item("VariableRanges", "Represents the lower and upper bounds of the given variables.")]
13  [StorableClass]
14  public class VariableRanges : Item, IVariableRanges {
15    private Dictionary<string, Interval> variableRanges;
16    protected VariableRanges(VariableRanges original, Cloner cloner)
17      : base(original, cloner) { }
18
19    [StorableConstructor]
20    protected VariableRanges(bool deserializing) : base(deserializing) { }
21
22    public override IDeepCloneable Clone(Cloner cloner) {
23      return new VariableRanges(this, cloner);
24    }
25
26    public VariableRanges() : base() { }
27
28    public int Rows { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
29    public int Columns { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
30    public IEnumerable<string> ColumnNames { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
31    public IEnumerable<string> RowNames { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
32    public bool SortableView { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
33
34    public bool ReadOnly => throw new NotImplementedException();
35
36    public event EventHandler ColumnsChanged;
37    public event EventHandler RowsChanged;
38    public event EventHandler ColumnNamesChanged;
39    public event EventHandler RowNamesChanged;
40    public event EventHandler SortableViewChanged;
41    public event EventHandler<EventArgs<int, int>> ItemChanged;
42    public event EventHandler Reset;
43
44
45
46    public Interval GetValue(string variable) {
47      if (variableRanges.ContainsKey(variable))
48        return variableRanges[variable];
49      else
50        throw new ArgumentException($"The variable: {variable} is not present.");
51    }
52
53    public bool SetValue(string variable, Interval value) {
54      if (variableRanges.ContainsKey(variable)) {
55        variableRanges[variable] = value;
56        return true;
57      }  else
58        throw new ArgumentException($"The variable: {variable} is not present.");
59    }
60
61    public bool Validate(string value, out string errorMessage) {
62      throw new NotImplementedException();
63    }
64  }
65}
Note: See TracBrowser for help on using the repository browser.