Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/08/19 15:52:35 (6 years ago)
Author:
chaider
Message:

#2971 Set the dictionary to private, renamed methods, added methods to operate on dictionary

File:
1 edited

Legend:

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

    r16921 r16925  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Linq;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
     
    3435      get => HeuristicLab.Common.Resources.VSImageLibrary.Object;
    3536    }
    36     public IDictionary<string, Interval> VariableIntervals { get; } = new Dictionary<string, Interval>();
     37    private IDictionary<string, Interval> VariableIntervals { get; } = new Dictionary<string, Interval>();
    3738
    3839    [Storable(Name = "StorableIntervalInformation")]
     
    6768    }
    6869
    69     public Interval getInterval(string variable) {
    70       if (VariableIntervals.ContainsKey(variable)) {
    71         return VariableIntervals[variable];
    72       } else {
    73         throw new ArgumentException($"The given variable:{variable} is not present!");
    74       }
     70    public Interval GetInterval(string variable) {
     71      if (!VariableIntervals.ContainsKey(variable)) throw new ArgumentException($"The given variable:{ variable } is not present!");
     72
     73      return VariableIntervals[variable];
    7574    }
    7675
    77     public IDictionary<string, Interval> getIntervals() {
     76    public void SetInterval(string key, Interval interval) {
     77      VariableIntervals[key] = interval;
     78    }
     79
     80    public void AddInterval(string key, Interval interval) {
     81      VariableIntervals.Add(key, interval);
     82    }
     83
     84    public void DeleteInterval(string key) {
     85      VariableIntervals.Remove(key);
     86    }
     87
     88    public IDictionary<string, Interval> GetIntervals() {
    7889      return VariableIntervals;
    7990    }
Note: See TracChangeset for help on using the changeset viewer.