diff --git a/src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java b/src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java index 40342f226..40e6c1e1d 100644 --- a/src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java +++ b/src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java @@ -4864,7 +4864,8 @@ else if((mappings > 0 && mappedElementsMoreThanNonMappedT1AndT2(mappings, operat firstMappers.clear(); firstMappers.add(bestMapper); } - for(UMLOperationBodyMapper firstMapper : firstMappers) { + List filteredFirstMappers = promoteSameSourceFolderMoves(firstMappers); + for(UMLOperationBodyMapper firstMapper : filteredFirstMappers) { UMLOperation removedOperation = firstMapper.getOperation1(); if(sameSourceAndTargetClass) { removedOperations.remove(removedOperation); @@ -4971,7 +4972,8 @@ else if((mappings > 0 && mappedElementsMoreThanNonMappedT1AndT2(mappings, operat firstMappers.clear(); firstMappers.add(bestMapper); } - for(UMLOperationBodyMapper firstMapper : firstMappers) { + List filteredFirstMappers = promoteSameSourceFolderMoves(firstMappers); + for(UMLOperationBodyMapper firstMapper : filteredFirstMappers) { UMLOperation addedOperation = firstMapper.getOperation2(); if(sameSourceAndTargetClass) { addedOperations.remove(addedOperation); @@ -4984,6 +4986,42 @@ else if((mappings > 0 && mappedElementsMoreThanNonMappedT1AndT2(mappings, operat } } + private List promoteSameSourceFolderMoves(List firstMappers) { + List list = new ArrayList(firstMappers); + //filter based on source folder + for(int i=0; i list2 = new ArrayList(list); + //filter based on signature + for(int i=0; i