- Timestamp:
- 11/19/15 12:02:40 (9 years ago)
- Location:
- stable
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 12983,12986,13252,13271
- Property svn:mergeinfo changed
-
stable/HeuristicLab.DataPreprocessing/3.4
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.DataPreprocessing/3.4 merged: 12983,12986,13252
- Property svn:mergeinfo changed
-
stable/HeuristicLab.DataPreprocessing/3.4/Implementations/DataGridContent.cs
r12718 r13289 41 41 public IFilterLogic FilterLogic { get; private set; } 42 42 43 private IEnumerable<string> rowNames;44 45 43 public int Rows { 46 44 get { … … 72 70 public IEnumerable<string> RowNames { 73 71 get { 74 return rowNames;72 return Enumerable.Range(1, Rows).Select(n => n.ToString()); 75 73 } 76 74 set { 77 //not supported75 throw new NotSupportedException(); 78 76 } 79 77 } … … 84 82 } 85 83 set { 86 //not supported84 throw new NotSupportedException(); 87 85 } 88 86 } … … 103 101 FilterLogic = theFilterLogic; 104 102 PreProcessingData = preProcessingData; 105 createRowNames();106 103 } 107 104 … … 116 113 public void DeleteRows(IEnumerable<int> rows) { 117 114 PreProcessingData.DeleteRowsWithIndices(rows); 118 createRowNames();119 115 } 120 116 … … 133 129 public bool SetValue(string value, int rowIndex, int columnIndex) { 134 130 return PreProcessingData.SetValue(value, columnIndex, rowIndex); 135 }136 137 private void createRowNames() {138 rowNames = Enumerable.Range(1, Rows).Select(n => n.ToString());139 131 } 140 132 -
stable/HeuristicLab.DataPreprocessing/3.4/Implementations/FilteredPreprocessingData.cs
r12121 r13289 119 119 throw new InvalidOperationException("DeleteColumn not possible while data is filtered"); 120 120 originalData.DeleteColumn(columnIndex); 121 } 122 123 public void RenameColumn(int columnIndex, string name) { 124 if (IsFiltered) 125 throw new InvalidOperationException("RenameColumn not possible while data is filtered"); 126 originalData.RenameColumn(columnIndex, name); 127 } 128 129 public void RenameColumns(IList<string> names) { 130 if (IsFiltered) 131 throw new InvalidOperationException("RenameColumns not possible while data is filtered"); 132 originalData.RenameColumns(names); 121 133 } 122 134 -
stable/HeuristicLab.DataPreprocessing/3.4/Implementations/PreprocessingData.cs
r12702 r13289 196 196 public abstract void DeleteColumn(int columnIndex); 197 197 198 public abstract void RenameColumn(int columnIndex, string name); 199 public abstract void RenameColumns(IList<string> list); 200 198 201 public abstract Dataset ExportToDataset(); 199 202 -
stable/HeuristicLab.DataPreprocessing/3.4/Implementations/TransactionalPreprocessingData.cs
r12009 r13289 98 98 public override void SetCell<T>(int columnIndex, int rowIndex, T value) { 99 99 SaveSnapshot(DataPreprocessingChangedEventType.ChangeItem, columnIndex, rowIndex); 100 101 for (int i = Rows; i <= rowIndex; i++) 102 InsertRow(i); 103 for (int i = Columns; i <= columnIndex; i++) 104 InsertColumn<T>(i.ToString(), i); 105 100 106 variableValues[columnIndex][rowIndex] = value; 101 107 if (!IsInTransaction) … … 116 122 117 123 public override bool VariableHasType<T>(int columnIndex) { 118 return variableValues[columnIndex] is List<T>;124 return columnIndex >= variableValues.Count || variableValues[columnIndex] is List<T>; 119 125 } 120 126 … … 219 225 if (!IsInTransaction) 220 226 OnChanged(DataPreprocessingChangedEventType.DeleteRow, -1, -1); 227 ResetPartitions(); 221 228 } 222 229 … … 229 236 if (!IsInTransaction) 230 237 OnChanged(DataPreprocessingChangedEventType.AddRow, -1, rowIndex); 238 ResetPartitions(); 231 239 } 232 240 … … 238 246 if (!IsInTransaction) 239 247 OnChanged(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex); 248 ResetPartitions(); 240 249 } 241 250 242 251 public override void InsertColumn<T>(string variableName, int columnIndex) { 243 252 SaveSnapshot(DataPreprocessingChangedEventType.DeleteColumn, columnIndex, -1); 244 variableValues.Insert(columnIndex, new List<T>( Rows));253 variableValues.Insert(columnIndex, new List<T>(Enumerable.Repeat(default(T), Rows))); 245 254 variableNames.Insert(columnIndex, variableName); 246 255 if (!IsInTransaction) … … 256 265 } 257 266 267 public override void RenameColumn(int columnIndex, string name) { 268 SaveSnapshot(DataPreprocessingChangedEventType.ChangeColumn, columnIndex, -1); 269 if (columnIndex < 0 || columnIndex > variableNames.Count) 270 throw new ArgumentOutOfRangeException("columnIndex"); 271 variableNames[columnIndex] = name; 272 273 if (!IsInTransaction) 274 OnChanged(DataPreprocessingChangedEventType.ChangeColumn, -1, -1); 275 } 276 277 public override void RenameColumns(IList<string> names) { 278 if (names == null) throw new ArgumentNullException("names"); 279 if (names.Count != variableNames.Count) throw new ArgumentException("number of names must match the number of columns.", "names"); 280 281 SaveSnapshot(DataPreprocessingChangedEventType.ChangeColumn, -1, -1); 282 for (int i = 0; i < names.Count; i++) 283 variableNames[i] = names[i]; 284 285 if (!IsInTransaction) 286 OnChanged(DataPreprocessingChangedEventType.ChangeColumn, -1, -1); 287 } 288 258 289 public override Dataset ExportToDataset() { 259 290 IList<IList> values = new List<IList>(); … … 278 309 } 279 310 311 312 private void ResetPartitions() { 313 TrainingPartition = new IntRange(); 314 TestPartition = new IntRange(); 315 } 280 316 281 317 #endregion
Note: See TracChangeset
for help on using the changeset viewer.