- Timestamp:
- 01/23/19 12:45:26 (6 years ago)
- Location:
- branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval.cs
r16547 r16548 28 28 29 29 namespace HeuristicLab.Problems.DataAnalysis { 30 [StorableClass] 31 public class Interval :Item, IEquatable<Interval> { 32 [Storable] 30 public class Interval : IEquatable<Interval> { 33 31 public double LowerBound { get; private set; } 34 [Storable]35 32 public double UpperBound { get; private set; } 36 33 37 [StorableConstructor] 38 protected Interval(bool deserializing) : base(deserializing) { } 39 protected Interval(Interval original, Cloner cloner) 40 : base(original, cloner) { 41 } 34 42 35 public Interval(double lowerBound, double upperBound) { 43 36 if (lowerBound > upperBound) … … 50 43 public bool Contains(double value) { 51 44 return LowerBound <= value && value <= UpperBound; 52 }53 54 public override IDeepCloneable Clone(Cloner cloner) {55 return new Interval(this, cloner);56 45 } 57 46 -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/NamedIntervals.cs
r16545 r16548 13 13 [Item("NamedIntervals", "Represents variables with their interval ranges.")] 14 14 [StorableClass] 15 public class NamedIntervals : Item { 15 public class NamedIntervals : Item { 16 16 ObservableDictionary<string, Interval> variableIntervals = new ObservableDictionary<string, Interval>(); 17 public ObservableDictionary<string, Interval> VariableIntervals { 18 get { return variableIntervals; } 19 } 20 21 [Storable(Name = "StorableIntervalInformation")] 22 private IEnumerable<Tuple<string, double, double>> StorableIntervalInformation { 23 get { 24 foreach (var varInt in variableIntervals) 25 yield return Tuple.Create(varInt.Key, varInt.Value.LowerBound, varInt.Value.UpperBound); 26 } 27 28 set { 29 foreach (var varInt in value) 30 variableIntervals.Add(varInt.Item1,new Interval(varInt.Item2,varInt.Item3)); 31 } 32 } 17 33 18 34 public NamedIntervals() : base(){} 19 35 protected NamedIntervals(bool deserializing) : base(deserializing) { } 20 protected NamedIntervals(NamedIntervals original, Cloner cloner) : base(original, cloner) { } 36 37 protected NamedIntervals(NamedIntervals original, Cloner cloner) : base(original, cloner) { 38 foreach (var keyValuePair in original.VariableIntervals) { 39 variableIntervals.Add(keyValuePair.Key, keyValuePair.Value); 40 } 41 } 21 42 22 43 public override IDeepCloneable Clone(Cloner cloner) { 23 44 return new NamedIntervals(this, cloner); 24 45 } 25 26 public ObservableDictionary<string, Interval> VariableIntervals => variableIntervals;27 46 28 47 public bool ReadOnly { get; }
Note: See TracChangeset
for help on using the changeset viewer.