1 | using HeuristicLab.Common;
|
---|
2 | using HeuristicLab.Core;
|
---|
3 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
4 | using HeuristicLab.Problems.DataAnalysis;
|
---|
5 | using System;
|
---|
6 | using System.Collections.Generic;
|
---|
7 | using System.Linq;
|
---|
8 | using System.Text;
|
---|
9 | using System.Threading.Tasks;
|
---|
10 |
|
---|
11 | namespace 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 | }
|
---|