Changeset 13419
- Timestamp:
- 11/30/15 12:07:37 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs
r12509 r13419 52 52 } 53 53 54 /// <summary> 55 /// Creates a new dataset. The variableValues are not cloned. 56 /// </summary> 57 /// <param name="variableNames">The names of the variables in the dataset</param> 58 /// <param name="variableValues">The values for the variables (column-oriented storage). Values are not cloned!</param> 54 59 public Dataset(IEnumerable<string> variableNames, IEnumerable<IList> variableValues) 55 60 : base() { … … 75 80 for (int i = 0; i < this.variableNames.Count; i++) { 76 81 var values = variableValues.ElementAt(i); 77 IList clonedValues = null; 78 if (values is IList<double>) 79 clonedValues = new List<double>(values.Cast<double>()); 80 else if (values is IList<string>) 81 clonedValues = new List<string>(values.Cast<string>()); 82 else if (values is IList<DateTime>) 83 clonedValues = new List<DateTime>(values.Cast<DateTime>()); 84 else { 85 this.variableNames = new List<string>(); 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>"); 88 } 89 this.variableValues.Add(this.variableNames[i], clonedValues); 82 this.variableValues.Add(this.variableNames[i], values); 90 83 } 91 84 }
Note: See TracChangeset
for help on using the changeset viewer.