Changeset 10740 for branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingData.cs
- Timestamp:
- 04/09/14 13:32:50 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingData.cs
r10695 r10740 34 34 public class PreprocessingData : NamedItem, IPreprocessingData { 35 35 36 protected I Dictionary<int,IList> variableValues;36 protected IList<IList> variableValues; 37 37 38 38 protected IList<string> variableNames; … … 57 57 58 58 int columnIndex = 0; 59 variableValues = new Dictionary<int,IList>();59 variableValues = new List<IList>(); 60 60 foreach (var variableName in problemData.Dataset.VariableNames) { 61 61 if (problemData.Dataset.IsType<double>(variableName)) { 62 variableValues [columnIndex] = problemData.Dataset.GetDoubleValues(variableName).ToList();62 variableValues.Insert(columnIndex, problemData.Dataset.GetDoubleValues(variableName).ToList()); 63 63 } else if (problemData.Dataset.IsType<string>(variableName)) { 64 variableValues [columnIndex] = CreateColumn<string>(problemData.Dataset, columnIndex, x => x);64 variableValues.Insert(columnIndex, CreateColumn<string>(problemData.Dataset, columnIndex, x => x)); 65 65 } else if (problemData.Dataset.IsType<DateTime>(variableName)) { 66 variableValues [columnIndex] = CreateColumn<DateTime>(problemData.Dataset, columnIndex, x => DateTime.Parse(x));66 variableValues.Insert(columnIndex, CreateColumn<DateTime>(problemData.Dataset, columnIndex, x => DateTime.Parse(x))); 67 67 } else { 68 68 throw new ArgumentException("The datatype of column " + variableName + " must be of type List<double>, List<string> or List<DateTime>"); … … 82 82 } 83 83 84 protected I Dictionary<int, IList> CopyVariableValues(IDictionary<int,IList> original) {85 var copy = new Dictionary<int,IList>(variableValues);86 for (int i = 0; i < original.Count; i++) {84 protected IList<IList> CopyVariableValues(IList<IList> original) { 85 var copy = new List<IList>(variableValues); 86 for (int i = 0; i < original.Count; ++i) { 87 87 variableValues[i] = (IList)Activator.CreateInstance(original[i].GetType(), original[i]); 88 88 } … … 133 133 134 134 public virtual void InsertRow(int rowIndex) { 135 foreach (IList column in variableValues .Values) {135 foreach (IList column in variableValues) { 136 136 Type type = column.GetType().GetGenericArguments()[0]; 137 137 column.Insert(rowIndex, type.IsValueType ? Activator.CreateInstance(type) : null); … … 140 140 141 141 public virtual void DeleteRow(int rowIndex) { 142 foreach (IList column in variableValues .Values) {142 foreach (IList column in variableValues) { 143 143 column.RemoveAt(rowIndex); 144 144 } … … 146 146 147 147 public virtual void InsertColumn<T>(string variableName, int columnIndex) { 148 variableValues. Add(columnIndex, new List<T>(Rows));148 variableValues.Insert(columnIndex, new List<T>(Rows)); 149 149 variableNames.Insert(columnIndex, variableName); 150 150 } 151 151 152 152 public virtual void DeleteColumn(int columnIndex) { 153 variableValues.Remove (columnIndex);153 variableValues.RemoveAt(columnIndex); 154 154 variableNames.RemoveAt(columnIndex); 155 155 }
Note: See TracChangeset
for help on using the changeset viewer.