Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/08/19 10:22:58 (6 years ago)
Author:
chaider
Message:

#2971

  • changed VariableIntervals from ObservableDictionary to IDictionary
  • Added methods to get single intervals and all intervals
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/IntervalCollection.cs

    r16904 r16918  
    1919 */
    2020#endregion
     21
     22using System;
    2123using System.Collections.Generic;
    2224using HeuristicLab.Common;
     
    3234      get => HeuristicLab.Common.Resources.VSImageLibrary.Object;
    3335    }
    34     public ObservableDictionary<string, Interval> VariableIntervals { get; } = new ObservableDictionary<string, Interval>();
     36    public IDictionary<string, Interval> VariableIntervals { get; } = new Dictionary<string, Interval>();
    3537
    3638    [Storable(Name = "StorableIntervalInformation")]
     
    6163    }
    6264
     65    public IntervalCollection(IDictionary<string, Interval> variableIntervals) {
     66      this.VariableIntervals = variableIntervals;
     67    }
     68
     69    public KeyValuePair<string, Interval> getInterval(string variable) {
     70      if (VariableIntervals.ContainsKey(variable)) {
     71        return new KeyValuePair<string, Interval>(variable, VariableIntervals[variable]);
     72      } else {
     73        throw new ArgumentException($"The given variable:{variable} is not present!");
     74      }
     75    }
     76
     77    public IDictionary<string, Interval> getIntervals() {
     78      return VariableIntervals;
     79    }
     80
    6381    public override IDeepCloneable Clone(Cloner cloner) {
    6482      return new IntervalCollection(this, cloner);
Note: See TracChangeset for help on using the changeset viewer.