Changeset 14075 for stable/HeuristicLab.DataPreprocessing/3.4/Data
- Timestamp:
- 07/14/16 22:38:23 (8 years ago)
- Location:
- stable
- Files:
-
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 13502,13504,13507-13508,13512,13514,13517
- Property svn:mergeinfo changed
-
stable/HeuristicLab.DataPreprocessing/3.4
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.DataPreprocessing/3.4 merged: 13502,13504,13507-13508,13512,13514,13517
- Property svn:mergeinfo changed
-
stable/HeuristicLab.DataPreprocessing/3.4/Data/TransactionalPreprocessingData.cs
r13508 r14075 216 216 } 217 217 218 219 public override void InsertRow(int rowIndex) { 220 SaveSnapshot(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex); 221 foreach (IList column in variableValues) { 222 Type type = column.GetType().GetGenericArguments()[0]; 223 column.Insert(rowIndex, type.IsValueType ? Activator.CreateInstance(type) : null); 224 } 225 if (TrainingPartition.Start <= rowIndex && rowIndex <= TrainingPartition.End) { 226 TrainingPartition.End++; 227 if (TrainingPartition.End <= TestPartition.Start) { 228 TestPartition.Start++; 229 TestPartition.End++; 230 } 231 } else if (TestPartition.Start <= rowIndex && rowIndex <= TestPartition.End) { 232 TestPartition.End++; 233 if (TestPartition.End <= TrainingPartition.Start) { 234 TestPartition.Start++; 235 TestPartition.End++; 236 } 237 } 238 if (!IsInTransaction) 239 OnChanged(DataPreprocessingChangedEventType.AddRow, -1, rowIndex); 240 } 241 public override void DeleteRow(int rowIndex) { 242 SaveSnapshot(DataPreprocessingChangedEventType.AddRow, -1, rowIndex); 243 foreach (IList column in variableValues) { 244 column.RemoveAt(rowIndex); 245 } 246 if (TrainingPartition.Start <= rowIndex && rowIndex <= TrainingPartition.End) { 247 TrainingPartition.End--; 248 if (TrainingPartition.End <= TestPartition.Start) { 249 TestPartition.Start--; 250 TestPartition.End--; 251 } 252 } else if (TestPartition.Start <= rowIndex && rowIndex <= TestPartition.End) { 253 TestPartition.End--; 254 if (TestPartition.End <= TrainingPartition.Start) { 255 TestPartition.Start--; 256 TestPartition.End--; 257 } 258 } 259 if (!IsInTransaction) 260 OnChanged(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex); 261 } 218 262 public override void DeleteRowsWithIndices(IEnumerable<int> rows) { 219 263 SaveSnapshot(DataPreprocessingChangedEventType.AddRow, -1, -1); … … 222 266 column.RemoveAt(rowIndex); 223 267 } 268 if (TrainingPartition.Start <= rowIndex && rowIndex <= TrainingPartition.End) { 269 TrainingPartition.End--; 270 if (TrainingPartition.End <= TestPartition.Start) { 271 TestPartition.Start--; 272 TestPartition.End--; 273 } 274 } else if (TestPartition.Start <= rowIndex && rowIndex <= TestPartition.End) { 275 TestPartition.End--; 276 if (TestPartition.End <= TrainingPartition.Start) { 277 TestPartition.Start--; 278 TestPartition.End--; 279 } 280 } 224 281 } 225 282 if (!IsInTransaction) 226 283 OnChanged(DataPreprocessingChangedEventType.DeleteRow, -1, -1); 227 ResetPartitions();228 }229 230 public override void InsertRow(int rowIndex) {231 SaveSnapshot(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex);232 foreach (IList column in variableValues) {233 Type type = column.GetType().GetGenericArguments()[0];234 column.Insert(rowIndex, type.IsValueType ? Activator.CreateInstance(type) : null);235 }236 if (!IsInTransaction)237 OnChanged(DataPreprocessingChangedEventType.AddRow, -1, rowIndex);238 ResetPartitions();239 }240 241 public override void DeleteRow(int rowIndex) {242 SaveSnapshot(DataPreprocessingChangedEventType.AddRow, -1, rowIndex);243 foreach (IList column in variableValues) {244 column.RemoveAt(rowIndex);245 }246 if (!IsInTransaction)247 OnChanged(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex);248 ResetPartitions();249 284 } 250 285 … … 308 343 if (listeners != null) listeners(this, EventArgs.Empty); 309 344 } 310 311 312 private void ResetPartitions() {313 TrainingPartition = new IntRange();314 TestPartition = new IntRange();315 }316 317 345 #endregion 318 346
Note: See TracChangeset
for help on using the changeset viewer.