Index: Ringtoets/Common/src/Ringtoets.Common.Data/UpdateDataStrategies/UpdateDataStrategyBase.cs =================================================================== diff -u -re9a40c653a63e31757bf87930745200f9c22cb2e -r352102f53efcda2247dd7ff8c2d833eccc709c4d --- Ringtoets/Common/src/Ringtoets.Common.Data/UpdateDataStrategies/UpdateDataStrategyBase.cs (.../UpdateDataStrategyBase.cs) (revision e9a40c653a63e31757bf87930745200f9c22cb2e) +++ Ringtoets/Common/src/Ringtoets.Common.Data/UpdateDataStrategies/UpdateDataStrategyBase.cs (.../UpdateDataStrategyBase.cs) (revision 352102f53efcda2247dd7ff8c2d833eccc709c4d) @@ -51,7 +51,7 @@ /// Instantiates a object. /// /// The failure mechanism which needs to be updated. - /// The comparer which should be used to determine when two objects are equal + /// The comparer which should be used to determine when two objects are equal. /// Thrown when any input parameter is null. protected UpdateDataStrategyBase(TFailureMechanism failureMechanism, IEqualityComparer equalityComparer) { @@ -98,7 +98,7 @@ /// Thrown when duplicate items are being added to the /// . /// Thrown when duplicate items are found during the - /// update of the items to be updatd in the . + /// update of the items in the . protected IEnumerable UpdateTargetCollectionData(ObservableUniqueItemCollectionWithSourcePath targetDataCollection, IEnumerable importedDataCollection, string sourceFilePath) @@ -120,7 +120,7 @@ } /// - /// Identifies which models were changed, removed and added to the target collection + /// Identifies which items were changed, removed and added to the target collection /// when compared with the imported data and performs the necessary operations for /// the dependent data of the affected elements. /// @@ -134,39 +134,39 @@ /// Thrown when duplicate items are found during the /// update of the items to be updatd in the . private IEnumerable ModifyDataCollection(ObservableUniqueItemCollectionWithSourcePath targetDataCollection, - IEnumerable importedDataCollection, - string sourceFilePath) + IEnumerable importedDataCollection, + string sourceFilePath) { TTargetData[] importedObjects = importedDataCollection.ToArray(); - TTargetData[] addedObjects = GetAddedObjects(targetDataCollection, importedObjects).ToArray(); - TTargetData[] removedObjects = GetRemovedObjects(targetDataCollection, importedObjects).ToArray(); - TTargetData[] updatedObjects = GetUpdatedObjects(targetDataCollection, importedObjects).ToArray(); + TTargetData[] objectsToBeAdded = GetObjectsToBeAdded(targetDataCollection, importedObjects).ToArray(); + TTargetData[] objectsToBeRemoved = GetObjectsToBeRemoved(targetDataCollection, importedObjects).ToArray(); + TTargetData[] objectsToBeUpdated = GetObjectsToBeUpdated(targetDataCollection, importedObjects).ToArray(); var affectedObjects = new List(); - if (addedObjects.Any()) + if (objectsToBeAdded.Any()) { affectedObjects.Add(targetDataCollection); } - affectedObjects.AddRange(UpdateData(updatedObjects, importedObjects)); - affectedObjects.AddRange(RemoveData(removedObjects)); + affectedObjects.AddRange(UpdateData(objectsToBeUpdated, importedObjects)); + affectedObjects.AddRange(RemoveData(objectsToBeRemoved)); targetDataCollection.Clear(); - targetDataCollection.AddRange(addedObjects.Union(updatedObjects), sourceFilePath); + targetDataCollection.AddRange(objectsToBeAdded.Union(objectsToBeUpdated), sourceFilePath); return affectedObjects.Distinct(new ReferenceEqualityComparer()); } - private IEnumerable GetRemovedObjects(IEnumerable existingCollection, IEnumerable importedDataOjects) + private IEnumerable GetObjectsToBeRemoved(IEnumerable existingCollection, IEnumerable importedDataOjects) { return existingCollection.Except(importedDataOjects, equalityComparer); } - private IEnumerable GetUpdatedObjects(IEnumerable existingCollection, IEnumerable importedDataObjects) + private IEnumerable GetObjectsToBeUpdated(IEnumerable existingCollection, IEnumerable importedDataObjects) { return existingCollection.Intersect(importedDataObjects, equalityComparer); } - private IEnumerable GetAddedObjects(IEnumerable existingCollection, IEnumerable importedDataObjects) + private IEnumerable GetObjectsToBeAdded(IEnumerable existingCollection, IEnumerable importedDataObjects) { return importedDataObjects.Where(source => !existingCollection.Contains(source, equalityComparer)); }