Skip to content

Commit

Permalink
Fix for issue #715
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Apr 27, 2024
1 parent 7c07871 commit d710f53
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java
Original file line number Diff line number Diff line change
Expand Up @@ -954,20 +954,24 @@ private TreeSet<UMLClassRenameDiff> findRenameMatchesForRemovedClass(UMLClass re
}
}
int matchingMovedInnerClasses = 0;
if(addedClass.getAttributes().size() == 0 && addedClass.getOperations().size() == 0 &&
removedClass.getAttributes().size() == 0 && removedClass.getOperations().size() == 0) {
MatchResult matchResult = matcher.match(removedClass, addedClass);
if((addedClass.getAttributes().size() == 0 && addedClass.getOperations().size() == 0 &&
removedClass.getAttributes().size() == 0 && removedClass.getOperations().size() == 0) ||
matchResult.getMatchedOperations() >= 10) {
for(UMLClassMoveDiff classMoveDiff : classMoveDiffList) {
if(classMoveDiff.getOriginalClass().getName().startsWith(removedClass.getName() + ".") &&
classMoveDiff.getMovedClass().getName().startsWith(addedClass.getName() + ".")) {
(classMoveDiff.getMovedClass().getName().startsWith(addedClass.getName() + ".") ||
classMoveDiff.getMovedClass().getPackageName().equals(addedClass.getPackageName()))) {
matchingMovedInnerClasses++;
}
}
}
MatchResult matchResult = matcher.match(removedClass, addedClass);
if(matchResult.isMatch() || matchingMovedInnerClasses > 0) {
if(!conflictingMoveOfTopLevelClass(removedClass, addedClass) && !innerClassWithTheSameName(removedClass, addedClass)) {
UMLClassRenameDiff classRenameDiff = new UMLClassRenameDiff(removedClass, addedClass, this, matchResult);
diffSet.add(classRenameDiff);
if(!classRenameDiff.getOriginalClass().getNonQualifiedName().equals(classRenameDiff.getRenamedClass().getNonQualifiedName())) {
diffSet.add(classRenameDiff);
}
}
}
}
Expand All @@ -988,20 +992,24 @@ private TreeSet<UMLClassRenameDiff> findRenameMatchesForAddedClass(UMLClass adde
}
}
int matchingMovedInnerClasses = 0;
if(addedClass.getAttributes().size() == 0 && addedClass.getOperations().size() == 0 &&
removedClass.getAttributes().size() == 0 && removedClass.getOperations().size() == 0) {
MatchResult matchResult = matcher.match(removedClass, addedClass);
if((addedClass.getAttributes().size() == 0 && addedClass.getOperations().size() == 0 &&
removedClass.getAttributes().size() == 0 && removedClass.getOperations().size() == 0) ||
matchResult.getMatchedOperations() >= 10) {
for(UMLClassMoveDiff classMoveDiff : classMoveDiffList) {
if(classMoveDiff.getOriginalClass().getName().startsWith(removedClass.getName() + ".") &&
classMoveDiff.getMovedClass().getName().startsWith(addedClass.getName() + ".")) {
(classMoveDiff.getMovedClass().getName().startsWith(addedClass.getName() + ".") ||
classMoveDiff.getMovedClass().getPackageName().equals(addedClass.getPackageName()))) {
matchingMovedInnerClasses++;
}
}
}
MatchResult matchResult = matcher.match(removedClass, addedClass);
if(matchResult.isMatch() || matchingMovedInnerClasses > 0) {
if(!conflictingMoveOfTopLevelClass(removedClass, addedClass) && !innerClassWithTheSameName(removedClass, addedClass)) {
UMLClassRenameDiff classRenameDiff = new UMLClassRenameDiff(removedClass, addedClass, this, matchResult);
diffSet.add(classRenameDiff);
if(!classRenameDiff.getOriginalClass().getNonQualifiedName().equals(classRenameDiff.getRenamedClass().getNonQualifiedName())) {
diffSet.add(classRenameDiff);
}
}
}
}
Expand Down

0 comments on commit d710f53

Please sign in to comment.