Skip to content

Commit

Permalink
Further improvement in optimize(TreeSet<UMLClassRenameDiff> diffSet)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Dec 12, 2024
1 parent 7545313 commit 6d102ae
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,18 @@ private TreeSet<UMLClassRenameDiff> optimize(TreeSet<UMLClassRenameDiff> diffSet
TreeSet<UMLClassRenameDiff> identicalBodyDiffSet = new TreeSet<UMLClassRenameDiff>(new ClassRenameComparator());
TreeSet<UMLClassRenameDiff> identicalStatementDiffSet = new TreeSet<UMLClassRenameDiff>(new ClassRenameComparator());
TreeSet<UMLClassRenameDiff> identicalSignatureDiffSet = new TreeSet<UMLClassRenameDiff>(new ClassRenameComparator());
TreeSet<UMLClassRenameDiff> identicalPackageDeclarationDocDiffSet = new TreeSet<UMLClassRenameDiff>(new ClassRenameComparator());
for(UMLClassRenameDiff diff : diffSet) {
if(diff.getOriginalClass().getPackageDeclarationJavadoc() != null && diff.getNextClass().getPackageDeclarationJavadoc() != null) {
if(diff.getOriginalClass().getPackageDeclarationJavadoc().getFullText().equals(diff.getNextClass().getPackageDeclarationJavadoc().getFullText())) {
identicalPackageDeclarationDocDiffSet.add(diff);
}
}
if(diff.getOriginalClass().getPackageDeclarationComments().size() > 0 && diff.getNextClass().getPackageDeclarationComments().size() > 0) {
if(diff.getOriginalClass().getPackageDeclarationComments().get(0).getFullText().equals(diff.getNextClass().getPackageDeclarationComments().get(0).getFullText())) {
identicalPackageDeclarationDocDiffSet.add(diff);
}
}
List<UMLOperation> operations1 = diff.getOriginalClass().getOperations();
List<UMLOperation> operations2 = diff.getNextClass().getOperations();
int identicalBodies = 0;
Expand Down Expand Up @@ -1180,6 +1191,9 @@ else if(identicalBodyDiffSet.size() < diffSet.size() && identicalStatementDiffSe
if(identicalSignatureDiffSet.size() == 1) {
return identicalSignatureDiffSet;
}
if(identicalPackageDeclarationDocDiffSet.size() == 1) {
return identicalPackageDeclarationDocDiffSet;
}
}
return diffSet;
}
Expand Down

0 comments on commit 6d102ae

Please sign in to comment.