Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/11/14 15:43:05 (10 years ago)
Author:
mleitner
Message:

Refactoring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs

    r10538 r11002  
    170170        yield return value;
    171171    }
     172
     173    public IEnumerable<string> GetStringValues(string variableName) {
     174      IList list;
     175      if (!variableValues.TryGetValue(variableName, out list))
     176        throw new ArgumentException("The variable " + variableName + " does not exist in the dataset.");
     177      List<string> values = list as List<string>;
     178      if (values == null) throw new ArgumentException("The variable " + variableName + " is not a string variable.");
     179
     180      //mkommend yield return used to enable lazy evaluation
     181      foreach (string value in values)
     182        yield return value;
     183    }
     184
     185    public IEnumerable<DateTime> GetDateTimeValues(string variableName) {
     186      IList list;
     187      if (!variableValues.TryGetValue(variableName, out list))
     188        throw new ArgumentException("The variable " + variableName + " does not exist in the dataset.");
     189      List<string> values = list as List<string>;
     190      if (values == null) throw new ArgumentException("The variable " + variableName + " is not a datetime variable.");
     191
     192      //mkommend yield return used to enable lazy evaluation
     193      foreach (string value in values)
     194        yield return DateTime.Parse(value);
     195    }
     196
    172197    public ReadOnlyCollection<double> GetReadOnlyDoubleValues(string variableName) {
    173198      IList list;
Note: See TracChangeset for help on using the changeset viewer.