Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16918 for branches


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
Location:
branches/2971_named_intervals
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/ParsedConstraintView.cs

    r16896 r16918  
    5151      intervalConstraints.CheckedItemsChanged += constraint_CheckedItemChanged;
    5252      intervalConstraints.ItemsAdded += constraints_Updated;
    53       intervalConstraints.ItemsRemoved += constraints_Updated;
     53      intervalConstraints.ItemsRemoved += constraint_removed;
    5454    }
    5555
     
    5757      intervalConstraints.CheckedItemsChanged -= constraint_CheckedItemChanged;
    5858      intervalConstraints.ItemsAdded -= constraints_Updated;
    59       intervalConstraints.ItemsRemoved -= constraints_Updated;
     59      intervalConstraints.ItemsRemoved -= constraint_removed;
    6060      base.DeregisterContentEvents();
    6161    }
     
    109109    }
    110110
     111    private void constraint_removed(object sender, CollectionItemsChangedEventArgs<IndexedItem<IntervalConstraint>> e) {
     112      foreach (var removedItem in e.Items) {
     113        removedItem.Value.Changed -= constraint_Changed;
     114      }
     115    }
     116
    111117    private void constraint_CheckedItemChanged(object sender,
    112118      CollectionItemsChangedEventArgs<IndexedItem<IntervalConstraint>> e) {
  • 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.