Changeset 13949 for stable/HeuristicLab.Problems.DataAnalysis
- Timestamp:
- 06/29/16 13:56:59 (8 years ago)
- Location:
- stable
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 13760-13761
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis merged: 13760-13761
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs
r13881 r13949 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 118 118 } 119 119 120 public ModifiableDataset ToModifiable() { 121 var values = new List<IList>(); 122 foreach (var v in variableNames) { 123 if (VariableHasType<double>(v)) { 124 values.Add(new List<double>((List<double>)variableValues[v])); 125 } else if (VariableHasType<string>(v)) { 126 values.Add(new List<string>((List<string>)variableValues[v])); 127 } else if (VariableHasType<DateTime>(v)) { 128 values.Add(new List<DateTime>((List<DateTime>)variableValues[v])); 129 } else { 130 throw new ArgumentException("Unknown variable type."); 131 } 132 } 133 return new ModifiableDataset(variableNames, values); 134 } 135 120 136 protected Dataset(Dataset dataset) : this(dataset.variableNames, dataset.variableValues.Values) { } 121 137 -
stable/HeuristicLab.Problems.DataAnalysis/3.4/ModifiableDataset.cs
r13179 r13949 2 2 3 3 /* HeuristicLab 4 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)4 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 5 5 * 6 6 * This file is part of HeuristicLab. … … 56 56 public ModifiableDataset() : base() { } 57 57 58 public ModifiableDataset(Dataset dataset) : base(dataset) { }59 58 public ModifiableDataset(IEnumerable<string> variableNames, IEnumerable<IList> variableValues) : base(variableNames, variableValues) { } 60 59 … … 74 73 } 75 74 OnReset(); 75 } 76 77 public void ReplaceVariable(string variableName, IList values) { 78 if (!variableValues.ContainsKey(variableName)) 79 throw new ArgumentException(string.Format("Variable {0} is not present in the dataset."), variableName); 80 if (values.Count != variableValues[variableName].Count) 81 throw new ArgumentException("The number of values must coincide with the number of dataset rows."); 82 if (GetVariableType(variableName) != values[0].GetType()) 83 throw new ArgumentException("The type of the provided value does not match the variable type."); 84 variableValues[variableName] = values; 76 85 } 77 86
Note: See TracChangeset
for help on using the changeset viewer.