Changeset 11203 for branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs
- Timestamp:
- 07/18/14 12:35:00 (10 years ago)
- Location:
- branches/HiveStatistics/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources
- Property svn:ignore
-
old new 8 8 FxCopResults.txt 9 9 Google.ProtocolBuffers-0.9.1.dll 10 Google.ProtocolBuffers-2.4.1.473.dll11 10 HeuristicLab 3.3.5.1.ReSharper.user 12 11 HeuristicLab 3.3.6.0.ReSharper.user 13 12 HeuristicLab.4.5.resharper.user 14 13 HeuristicLab.ExtLibs.6.0.ReSharper.user 15 HeuristicLab.Scripting.Development16 14 HeuristicLab.resharper.user 17 15 ProtoGen.exe … … 19 17 _ReSharper.HeuristicLab 20 18 _ReSharper.HeuristicLab 3.3 21 _ReSharper.HeuristicLab 3.3 Tests22 19 _ReSharper.HeuristicLab.ExtLibs 23 20 bin 24 21 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests 23 Google.ProtocolBuffers-2.4.1.473.dll
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
-
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 76 76 var values = variableValues.ElementAt(i); 77 77 IList clonedValues = null; 78 if (values is IList<double>)78 if (values is List<double>) 79 79 clonedValues = new List<double>(values.Cast<double>()); 80 else if (values is IList<string>)80 else if (values is List<string>) 81 81 clonedValues = new List<string>(values.Cast<string>()); 82 else if (values is IList<DateTime>)82 else if (values is List<DateTime>) 83 83 clonedValues = new List<DateTime>(values.Cast<DateTime>()); 84 84 else { 85 85 this.variableNames = new List<string>(); 86 86 this.variableValues = new Dictionary<string, IList>(); 87 throw new ArgumentException("The variable values must be of type IList<double>, IList<string> or IList<DateTime>");87 throw new ArgumentException("The variable values must be of type List<double>, List<string> or List<DateTime>"); 88 88 } 89 89 this.variableValues.Add(this.variableNames[i], clonedValues); … … 170 170 yield return value; 171 171 } 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 evaluation181 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<DateTime> values = list as List<DateTime>;190 if (values == null) throw new ArgumentException("The variable " + variableName + " is not a datetime variable.");191 192 //mkommend yield return used to enable lazy evaluation193 foreach (DateTime value in values)194 yield return value;195 }196 197 172 public ReadOnlyCollection<double> GetReadOnlyDoubleValues(string variableName) { 198 173 IList list; … … 219 194 220 195 return rows.Select(index => values[index]); 221 }222 223 public bool VariableHasType<T>(string variableName) {224 return variableValues[variableName] is IList<T>;225 196 } 226 197
Note: See TracChangeset
for help on using the changeset viewer.