From a0c0547ebd9c9787a7d0435f7d9df28ecee3de67 Mon Sep 17 00:00:00 2001 From: Lukas Kronast Date: Wed, 25 Jun 2025 17:05:28 +0200 Subject: [PATCH 01/17] test refactoring and new tests --- .../cddiff/syndiff/CDSyntaxDiff.java | 212 ++++++++------ .../cddiff/syndiff/AssocDiffTest.java | 108 ------- .../cddiff/syndiff/MemberDiffTest.java | 70 ++--- .../cddiff/syndiff/Syn2SemDiffTest.java | 234 ++++++++------- .../syndiff/Syn2SemDiffValidationTest.java | 274 ------------------ .../cddiff/syndiff/SynAssocDiffTest.java | 115 ++++++++ .../cddiff/syndiff/SynDiffTestBasis.java | 71 +++++ .../cddiff/syndiff/SyntaxDiffTest.java | 213 ++++++++++---- .../cddiff/syndiff/TypeDIffTest.java | 109 ++++--- .../cddiff/syndiff/TypeDiff/Source1.cd | 5 + .../cddiff/syndiff/TypeDiff/Target1.cd | 4 +- 11 files changed, 695 insertions(+), 720 deletions(-) delete mode 100644 cddiff/src/test/java/de/monticore/cddiff/syndiff/AssocDiffTest.java delete mode 100644 cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffValidationTest.java create mode 100644 cddiff/src/test/java/de/monticore/cddiff/syndiff/SynAssocDiffTest.java create mode 100644 cddiff/src/test/java/de/monticore/cddiff/syndiff/SynDiffTestBasis.java diff --git a/cddiff/src/main/java/de/monticore/cddiff/syndiff/CDSyntaxDiff.java b/cddiff/src/main/java/de/monticore/cddiff/syndiff/CDSyntaxDiff.java index b9f490821..63f537e6f 100644 --- a/cddiff/src/main/java/de/monticore/cddiff/syndiff/CDSyntaxDiff.java +++ b/cddiff/src/main/java/de/monticore/cddiff/syndiff/CDSyntaxDiff.java @@ -1,9 +1,6 @@ /* (c) https://github.com/MontiCore/monticore */ package de.monticore.cddiff.syndiff; -import static de.monticore.cddiff.ow2cw.CDInheritanceHelper.getAllSuper; -import static de.monticore.cddiff.syn2semdiff.odgen.Syn2SemDiffHelper.*; - import de.monticore.cd4code._symboltable.ICD4CodeArtifactScope; import de.monticore.cd4code.trafo.CD4CodeDirectCompositionTrafo; import de.monticore.cdassociation._ast.ASTCDAssociation; @@ -13,14 +10,38 @@ import de.monticore.cdbasis._ast.ASTCDCompilationUnit; import de.monticore.cdbasis._ast.ASTCDType; import de.monticore.cddiff.CDDiffUtil; -import de.monticore.cddiff.syn2semdiff.datastructures.*; +import de.monticore.cddiff.syn2semdiff.datastructures.AssocDiffStruct; +import de.monticore.cddiff.syn2semdiff.datastructures.AssocDirection; +import de.monticore.cddiff.syn2semdiff.datastructures.AssocMatching; +import de.monticore.cddiff.syn2semdiff.datastructures.AssocStruct; +import de.monticore.cddiff.syn2semdiff.datastructures.ClassSide; +import de.monticore.cddiff.syn2semdiff.datastructures.DeleteStruct; +import de.monticore.cddiff.syn2semdiff.datastructures.InheritanceDiff; +import de.monticore.cddiff.syn2semdiff.datastructures.MatchingStrategy; +import de.monticore.cddiff.syn2semdiff.datastructures.OverlappingAssocsDirect; +import de.monticore.cddiff.syn2semdiff.datastructures.TypeDiffStruct; import de.monticore.cddiff.syn2semdiff.odgen.Syn2SemDiffHelper; import de.monticore.cdinterfaceandenum._ast.ASTCDEnum; import de.monticore.cdinterfaceandenum._ast.ASTCDInterface; import edu.mit.csail.sdg.alloy4.Pair; -import java.util.*; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; +import static de.monticore.cddiff.ow2cw.CDInheritanceHelper.getAllSuper; +import static de.monticore.cddiff.syn2semdiff.odgen.Syn2SemDiffHelper.areZeroAssocs; +import static de.monticore.cddiff.syn2semdiff.odgen.Syn2SemDiffHelper.getConflict; +import static de.monticore.cddiff.syn2semdiff.odgen.Syn2SemDiffHelper.getConnectedTypes; +import static de.monticore.cddiff.syn2semdiff.odgen.Syn2SemDiffHelper.isInConflict; +import static de.monticore.cddiff.syn2semdiff.odgen.Syn2SemDiffHelper.mergeAssocs; +import static de.monticore.cddiff.syn2semdiff.odgen.Syn2SemDiffHelper.setBiDirRoleName; + /** * This is the core class for semantic differencing. It contains the results of the syntactic * analysis as attributes. All changed types and associations are stored in lists. The class is used @@ -28,7 +49,7 @@ * this class the overlapping and duplicated associations are handled. */ public class CDSyntaxDiff extends SyntaxDiffHelper implements ICDSyntaxDiff { - + private ASTCDCompilationUnit srcCD; private ASTCDCompilationUnit tgtCD; private List changedTypes; @@ -52,27 +73,27 @@ public class CDSyntaxDiff extends SyntaxDiffHelper implements ICDSyntaxDiff { private List baseDiff; List srcCDTypes; ICD4CodeArtifactScope scopeSrcCD, scopeTgtCD; - + protected CDSynDiffMatches matches; protected Syn2SemDiffHelper helper; private final List matchingStrategies; - + public CDSyntaxDiff(ASTCDCompilationUnit srcCD, ASTCDCompilationUnit tgtCD) { this(srcCD, tgtCD, List.of()); // Use all matching strategies } - + public CDSyntaxDiff(ASTCDCompilationUnit srcCD, ASTCDCompilationUnit tgtCD, List matchingStrategies) { this.srcCD = srcCD; this.tgtCD = tgtCD; CDDiffUtil.refreshSymbolTable(srcCD); CDDiffUtil.refreshSymbolTable(tgtCD); - + this.matchingStrategies = matchingStrategies; boolean structureMatch = matchingStrategies.contains(MatchingStrategy.STRUCTURE_TYPE_MATCHING) || matchingStrategies.isEmpty(); this.matches = new CDSynDiffMatches(this.srcCD, this.tgtCD, structureMatch); - + helper = new Syn2SemDiffHelper(matches); // Don't change the order of the calls! helper.setNotInstClassesSrc(new HashSet<>()); helper.setNotInstClassesTgt(new HashSet<>()); @@ -106,11 +127,11 @@ public CDSyntaxDiff(ASTCDCompilationUnit srcCD, ASTCDCompilationUnit tgtCD, srcCDTypes.addAll(srcCD.getCDDefinition().getCDClassesList()); srcCDTypes.addAll(srcCD.getCDDefinition().getCDEnumsList()); srcCDTypes.addAll(srcCD.getCDDefinition().getCDInterfacesList()); - + // Trafo to make in-class declarations of compositions appear in the association list new CD4CodeDirectCompositionTrafo().transform(srcCD); new CD4CodeDirectCompositionTrafo().transform(tgtCD); - + loadAllLists(srcCD, tgtCD, scopeSrcCD, scopeTgtCD); helper.setMatchedClasses(matchedClasses); helper.setDeletedAssocs(deletedAssocs); @@ -120,129 +141,130 @@ public CDSyntaxDiff(ASTCDCompilationUnit srcCD, ASTCDCompilationUnit tgtCD, helper.setDiffs(changedAssocs); helper.setMatcher(); } - + @Override public ASTCDCompilationUnit getSrcCD() { return srcCD; } - + @Override public void setSrcCD(ASTCDCompilationUnit srcCD) { this.srcCD = srcCD; } - + @Override public ASTCDCompilationUnit getTgtCD() { return tgtCD; } - + @Override public void setTgtCD(ASTCDCompilationUnit tgtCD) { this.tgtCD = tgtCD; } - + public Syn2SemDiffHelper getHelper() { return helper; } - + @Override public List getBaseDiff() { return baseDiff; } - + @Override public void setBaseDiff(List baseDiff) { this.baseDiff = baseDiff; } - + @Override - public List getChangedTypes() { return changedTypes; } - + public List getChangedTypes() { + return changedTypes; } + @Override public void setChangedTypes(List changedTypes) { this.changedTypes = changedTypes; } - + @Override public List getChangedAssocs() { return changedAssocs; } - + @Override public void setChangedAssocs(List changedAssocs) { this.changedAssocs = changedAssocs; } - + @Override public List getAddedClasses() { return addedClasses; } - + @Override public void setAddedClasses(List addedClasses) { this.addedClasses = addedClasses; } - + @Override public List getDeletedClasses() { return deletedClasses; } - + @Override public List getAddedInterfaces() { return addedInterfaces; } - + @Override public List getDeletedInterfaces() { return deletedInterfaces; } - + @Override public void setDeletedClasses(List deletedClasses) { this.deletedClasses = deletedClasses; } - + @Override public void setAddedInterfaces(List addedInterfaces) { this.addedInterfaces = addedInterfaces; } - + @Override public void setDeletedInterfaces(List deletedInterfaces) { this.deletedInterfaces = deletedInterfaces; } - + @Override public List getAddedEnums() { return addedEnums; } - + @Override public void setAddedEnums(List addedEnums) { this.addedEnums = addedEnums; } - + @Override public List getDeletedEnums() { return deletedEnums; } - + @Override public void setDeletedEnums(List deletedEnums) { this.deletedEnums = deletedEnums; } - + @Override public List getAddedAssocs() { return addedAssocs; } - + @Override public void setAddedAssocs(List addedAssocs) { this.addedAssocs = addedAssocs; } - + @Override public List getDeletedAssocs() { return deletedAssocs; } - + @Override public void setDeletedAssocs(List deletedAssocs) { this.deletedAssocs = deletedAssocs; } - + @Override public List> getMatchedClasses() { return matchedClasses; } - + @Override public List> getMatchedEnums() { return matchedEnums; } - + @Override public List> getMatchedInterfaces() { return matchedInterfaces; } - + @Override public void setMatchedClasses(List> matchedClasses) { this.matchedClasses = matchedClasses; } - + @Override public List> getMatchedAssocs() { return matchedAssocs; } - + @Override public void setMatchedAssocs(List> matchedAssocs) { this.matchedAssocs = matchedAssocs; } - + @Override public void setMatchedEnums(List> matchedEnums) { this.matchedEnums = matchedEnums; } - + @Override public void setMatchedInterfaces(List> matchedInterfaces) { this.matchedInterfaces = matchedInterfaces; } - + @Override public ASTCDClass isSupClass(ASTCDClass astcdClass) { if (astcdClass.getModifier().isAbstract()) { @@ -273,7 +295,7 @@ public ASTCDClass isSupClass(ASTCDClass astcdClass) { } return null; } - + // CHECKED @Override public Set>> deletedInheritance() { @@ -297,7 +319,7 @@ public Set>> deletedInheritance() { } return diff; } - + // CHECKED @Override public boolean isInheritanceDeleted(ASTCDType superClassTgt, ASTCDType subClassSrc) { @@ -354,7 +376,7 @@ public boolean isInheritanceDeleted(ASTCDType superClassTgt, ASTCDType subClassS } return false; } - + // CHECKED @Override public Set>> addedInheritance() { @@ -376,7 +398,7 @@ && isInheritanceAdded(superClass, struc.a)) { } return diff; } - + // CHECKED @Override public Set mergeInheritanceDiffs() { @@ -407,7 +429,7 @@ public Set mergeInheritanceDiffs() { } return set; } - + // CHECKED @Override public boolean isInheritanceAdded(ASTCDType astcdClass, ASTCDType subClass) { @@ -440,7 +462,7 @@ public boolean isInheritanceAdded(ASTCDType astcdClass, ASTCDType subClass) { } boolean isContained = false; Optional matched = helper.findMatchedTypeTgt(astcdClass); - + for (AssocStruct newAssocs : helper.getSrcMap().get(astcdClass)) { for (AssocStruct srcStruct : helper.getTgtMap().get(helper.findMatchedTypeTgt(subClass) .get())) { @@ -470,7 +492,7 @@ public boolean isInheritanceAdded(ASTCDType astcdClass, ASTCDType subClass) { } return false; } - + // CHECKED @Override public List isAssocDeleted(ASTCDAssociation association, ASTCDType astcdClass) { @@ -563,7 +585,7 @@ else if (!helper.getNotInstClassesTgt().contains(left) && sub.isPresent() && !he } return list; } - + @Override public List isAssocAdded(ASTCDAssociation association) { ASTCDType isAddedSrc = null; @@ -611,7 +633,7 @@ else if (!helper.getNotInstClassesSrc().contains(otherSide) && sub2.isPresent()) } return list; } - + @Override public void findOverlappingAssocs() { Set srcToDelete = new HashSet<>(); @@ -650,7 +672,7 @@ else if (isInConflict(association, superAssoc) && !helper.inInheritanceRelation( } } } - + for (ASTCDType astcdClass : helper.getTgtMap().keySet()) { Set> toCheck = new HashSet<>(); OverlappingAssocsDirect pairs = helper.computeDirectForType(astcdClass, helper.getTgtMap(), @@ -741,7 +763,7 @@ else if (helper.sameAssocStruct(association, superAssoc) || helper.sameAssocStru helper.deleteCompositions(); helper.reduceMaps(); } - + // CHECKED @Override public List>> addedAssocList() { @@ -758,7 +780,7 @@ public List>> addedAssocList() { } return associationList; } - + // CHECKED @Override public List>> deletedAssocList() { @@ -794,7 +816,7 @@ else if (association.getCDAssocDir().isDefinitiveNavigableLeft()) { } return list; } - + // CHECKED @Override public List> addedClassList() { @@ -807,7 +829,7 @@ public List> addedClassList() { } return classList; } - + // CHECKED @Override public List changedTypes() { @@ -861,7 +883,7 @@ else if (!helper.getNotInstClassesSrc().contains(typeDiff.getSrcElem())) { } return list; } - + // CHECKED @Override public List changedAssoc() { @@ -901,7 +923,7 @@ public List changedAssoc() { changed = true; } } - + if (assocDiff.getBaseDiff().contains(DiffTypes.CHANGED_ASSOCIATION_TARGET_CLASS)) { if (!helper.inheritanceTgt(matchedPairs.a, matchedPairs.b)) { List added = isAssocAdded(matchedPairs.a.getAssociation()); @@ -967,7 +989,7 @@ else if (!deleted1.isEmpty()) { } return list; } - + // CHECKED @Override public List srcExistsTgtNot() { @@ -980,7 +1002,7 @@ public List srcExistsTgtNot() { } return list; } - + // CHECKED @Override public List>> srcAssocExistsTgtNot() { @@ -998,7 +1020,7 @@ public List>> srcAssocExistsTgtNot() { } return allAddedAssocs; } - + // CHECKED @Override public List>> tgtAssocsExistsSrcNot() { @@ -1027,7 +1049,7 @@ else if (assoc.getSide() == ClassSide.Right) { } return new ArrayList<>(allDeletedAssocs); } - + // CHECKED @Override public List getAssocDiffs() { @@ -1067,7 +1089,7 @@ public List getAssocDiffs() { } return result; } - + // CHECKED @Override public List hasDiffSuper() { @@ -1088,7 +1110,7 @@ public List hasDiffSuper() { } return list; } - + public void addAllAddedClassesSem(ASTCDCompilationUnit srcCD, ASTCDCompilationUnit tgtCD) { boolean found = false; for (ASTCDClass srcClass : srcCD.getCDDefinition().getCDClassesList()) { @@ -1106,7 +1128,7 @@ public void addAllAddedClassesSem(ASTCDCompilationUnit srcCD, ASTCDCompilationUn baseDiff.add(DiffTypes.ADDED_CLASS); } } - + public void addAllDeletedClassesSem(ASTCDCompilationUnit srcCD, ASTCDCompilationUnit tgtCD) { boolean found = false; for (ASTCDClass tgtClass : tgtCD.getCDDefinition().getCDClassesList()) { @@ -1124,9 +1146,9 @@ public void addAllDeletedClassesSem(ASTCDCompilationUnit srcCD, ASTCDCompilation baseDiff.add(DiffTypes.DELETED_CLASS); } } - + /*--------------------------------------------------------------------*/ - + /** * Adds matched CD types from the computed matching map to their respective type lists (classes, * enums, or interfaces). It iterates through the keys (source CD types) of the computed matching @@ -1149,7 +1171,7 @@ public void addAllMatchedTypes(Map computedMatchingMapType } } } - + /** * Adds matched associations from the computed matching map to the 'matchedAssocs' list. It * iterates through the keys (source associations) of the computed matching map and creates pairs @@ -1165,7 +1187,7 @@ public void addAllMatchedAssocs( matchedAssocs.add(new Pair<>(x, computedMatchingMapAssocs.get(x))); } } - + /** * Adds changed type differences from the matched classes and enums in the source and target CDs * to the 'changedTypes' list. It iterates through the matched classes and enums, calculates the @@ -1188,7 +1210,7 @@ public void addAllChangedTypes() { } } } - + /** * Adds changed association differences from the matched associations in the source and target CDs * to the 'changedAssocs' list. It iterates through the matched associations and calculates the @@ -1204,7 +1226,7 @@ public void addAllChangedAssocs() { } } } - + /** * Adds added class types from the source CD to the 'addedClasses' list based on matching maps * between source and target CD types. It identifies the class types in the source CD that do not @@ -1226,7 +1248,7 @@ public void addAllAddedClasses(ASTCDCompilationUnit srcCD, baseDiff.add(DiffTypes.ADDED_CLASS); } } - + /** * Adds deleted class types in the target CD to the 'deletedClasses' list based on matching maps * between source and target CD types. It identifies the class types in the target CD that do not @@ -1248,7 +1270,7 @@ public void addAllDeletedClasses(ASTCDCompilationUnit tgtCD, baseDiff.add(DiffTypes.DELETED_CLASS); } } - + public void addAllAddedInterfaces(ASTCDCompilationUnit srcCD, Map computedMatchingMapTypes) { List tmp = new ArrayList<>(srcCD.getCDDefinition().getCDInterfacesList()); @@ -1262,7 +1284,7 @@ public void addAllAddedInterfaces(ASTCDCompilationUnit srcCD, baseDiff.add(DiffTypes.ADDED_INTERFACE); } } - + public void addAllDeletedInterfaces(ASTCDCompilationUnit tgtCD, Map computedMatchingMapTypes) { List tmp = new ArrayList<>(tgtCD.getCDDefinition().getCDInterfacesList()); @@ -1276,7 +1298,7 @@ public void addAllDeletedInterfaces(ASTCDCompilationUnit tgtCD, baseDiff.add(DiffTypes.DELETED_INTERFACE); } } - + /** * Adds added enumeration types in the source CD to the 'addedEnums' list based on matching maps * between source and target CD types. It identifies the enumeration types in the source CD that @@ -1298,7 +1320,7 @@ public void addAllAddedEnums(ASTCDCompilationUnit srcCD, baseDiff.add(DiffTypes.ADDED_ENUM); } } - + /** * Adds deleted enumeration types in the target CD to the 'deletedEnums' list based on matching * maps between source and target CD types. It identifies the enumeration types in the target CD @@ -1320,7 +1342,7 @@ public void addAllDeletedEnums(ASTCDCompilationUnit tgtCD, baseDiff.add(DiffTypes.DELETED_ENUM); } } - + /** * Adds added association relationships in the source CD to the 'addedAssocs' list based on * matching maps between source and target CD associations. It identifies the associations in the @@ -1344,7 +1366,7 @@ public void addAllAddedAssocs(ASTCDCompilationUnit srcCD, baseDiff.add(DiffTypes.ADDED_ASSOCIATION); } } - + /** * Adds deleted association relationships in the target CD to the 'deletedAssocs' list based on * matching maps between source and target CD associations. It identifies the associations in the @@ -1361,12 +1383,12 @@ public void addAllDeletedAssocs(ASTCDCompilationUnit tgtCD) { } } } - + if (!deletedAssocs.isEmpty() && !baseDiff.contains(DiffTypes.DELETED_ASSOCIATION)) { baseDiff.add(DiffTypes.DELETED_ASSOCIATION); } } - + /** * Adds added inheritance relationships to the 'addedInheritance' list based on matching maps * between source and target CD classes. It identifies the added superclasses for each matched @@ -1387,7 +1409,7 @@ public void addAllAddedInheritance(ICD4CodeArtifactScope srcCDScope, allSuperClassOfTgtClass.addAll(getAllSuper(matchOfSrcClass, tgtCDScope)); } } - + for (ASTCDType srcSuper : getAllSuper(srcClass, srcCDScope)) { for (ASTCDType tgtSuper : allSuperClassOfTgtClass) { for (Pair pair : matchedClasses) { @@ -1397,7 +1419,7 @@ public void addAllAddedInheritance(ICD4CodeArtifactScope srcCDScope, } } } - + if (!allSuperClassOfSrcClass.isEmpty()) { addedInheritance.add(new Pair<>(srcClass, allSuperClassOfSrcClass)); } @@ -1406,7 +1428,7 @@ public void addAllAddedInheritance(ICD4CodeArtifactScope srcCDScope, } } } - + /** * Adds deleted inheritance relationships to the 'deletedInheritance' list based on matching maps * between source and target CD classes. It identifies the deleted superclasses for each matched @@ -1425,7 +1447,7 @@ public void addAllDeletedInheritance(ICD4CodeArtifactScope srcCDScope, allSuperClassOfSrcClass.addAll(getAllSuper(entry.getKey(), srcCDScope)); } } - + for (ASTCDType tgtSuper : getAllSuper(tgtClass, srcCDScope)) { for (ASTCDType srcSuper : allSuperClassOfSrcClass) { for (Pair pair : matchedClasses) { @@ -1435,7 +1457,7 @@ public void addAllDeletedInheritance(ICD4CodeArtifactScope srcCDScope, } } } - + if (!allSuperClassOfTgtClass.isEmpty()) { deletedInheritance.add(new Pair<>(tgtClass, allSuperClassOfTgtClass)); } @@ -1444,7 +1466,7 @@ public void addAllDeletedInheritance(ICD4CodeArtifactScope srcCDScope, } } } - + /** * Loads various lists of differences between source and target CD and scopes. This method * populates lists for matched types, associations, changed types, changed associations, added @@ -1475,5 +1497,5 @@ private void loadAllLists(ASTCDCompilationUnit srcCD, ASTCDCompilationUnit tgtCD addAllAddedInheritance(srcCDScope, tgtCDScope, matches.getTypeMatches()); addAllDeletedInheritance(srcCDScope, tgtCDScope, matches.getTypeMatches()); } - + } diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/AssocDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/AssocDiffTest.java deleted file mode 100644 index be2611f9f..000000000 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/AssocDiffTest.java +++ /dev/null @@ -1,108 +0,0 @@ -/* (c) https://github.com/MontiCore/monticore */ -package de.monticore.cddiff.syndiff; - -import static org.junit.jupiter.api.Assertions.fail; - -import de.monticore.cd4code.CD4CodeMill; -import de.monticore.cd4code._symboltable.CD4CodeSymbolTableCompleter; -import de.monticore.cdbasis._ast.ASTCDCompilationUnit; -import de.monticore.cddiff.CDDiffTestBasis; -import de.monticore.cddiff.syn2semdiff.Syn2SemDiff; -import de.monticore.odbasis._ast.ASTODArtifact; -import java.io.IOException; -import java.util.List; -import java.util.Optional; -import org.junit.jupiter.api.Test; - -public class AssocDiffTest extends CDDiffTestBasis { - - @Test - public void testCD5() { - ASTCDCompilationUnit compilationUnitNew = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/AssocDiff/AssocDeletedMerging/CD51.cd"); - ASTCDCompilationUnit compilationUnitOld = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/AssocDiff/AssocDeletedMerging/CD52.cd"); - - Syn2SemDiff syn2semdiff = new Syn2SemDiff(compilationUnitNew, compilationUnitOld); - List witnesses = syn2semdiff.generateODs(false); - - // todo: fix me - // Assertions.assertTrue(witnesses.isEmpty()); - } - - /*--------------------------------------------------------------------*/ - // Syntax Diff Tests - - public static final String dir = "src/test/resources/de/monticore/cddiff/syndiff/AssocDiff/"; - protected ASTCDCompilationUnit tgt; - protected ASTCDCompilationUnit src; - - @Test - public void testAssoc1() { - parseModels("Source1.cd", "Target1.cd"); - - CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - // System.out.println(synDiff.printDiff()); - } - - @Test - public void testAssoc2() { - parseModels("Source2.cd", "Target2.cd"); - - CDSyntaxDiff associationDiff = new CDSyntaxDiff(src, tgt, List.of()); - // System.out.println(associationDiff.printDiff()); - // System.out.println(associationDiff.getBaseDiff()); - // System.out.println(associationDiff.getMatchedAssocs()); - } - - @Test - public void testAssoc3() { - parseModels("Source3.cd", "Target3.cd"); - - CDSyntaxDiff syntaxDiff = new CDSyntaxDiff(src, tgt, List.of()); - // System.out.println(syntaxDiff.printSrcCD()); - // System.out.println(syntaxDiff.printTgtCD()); - // System.out.println(syntaxDiff.getBaseDiff()); - } - - @Test - public void testAssoc4() { - parseModels("Source4.cd", "Target4.cd"); - - CDSyntaxDiff syntaxDiff = new CDSyntaxDiff(src, tgt, List.of()); - System.out.println(syntaxDiff.getBaseDiff()); - } - - @Test - public void testAssoc5() { - parseModels("Source5.cd", "Target5.cd"); - CDSyntaxDiff syntaxDiff = new CDSyntaxDiff(src, tgt, List.of()); - System.out.println(syntaxDiff.getMatchedClasses()); - SyntaxDiffPrinter sb = new SyntaxDiffPrinter(src, tgt); - System.out.println(sb.printDiff()); - } - - public void parseModels(String concrete, String ref) { - try { - Optional src = CD4CodeMill.parser().parseCDCompilationUnit(dir - + concrete); - Optional tgt = CD4CodeMill.parser().parseCDCompilationUnit(dir + ref); - if (src.isPresent() && tgt.isPresent()) { - CD4CodeMill.scopesGenitorDelegator().createFromAST(src.get()); - CD4CodeMill.scopesGenitorDelegator().createFromAST(tgt.get()); - src.get().accept(new CD4CodeSymbolTableCompleter(src.get()).getTraverser()); - tgt.get().accept(new CD4CodeSymbolTableCompleter(tgt.get()).getTraverser()); - this.tgt = tgt.get(); - this.src = src.get(); - } - else { - fail("Could not parse CDs."); - } - - } - catch (IOException e) { - fail(e.getMessage()); - } - } - -} diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/MemberDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/MemberDiffTest.java index 4940d612c..2f17c9b65 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/MemberDiffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/MemberDiffTest.java @@ -1,64 +1,40 @@ /* (c) https://github.com/MontiCore/monticore */ package de.monticore.cddiff.syndiff; -import static org.junit.jupiter.api.Assertions.fail; - import de.monticore.ast.ASTNode; -import de.monticore.cd4code.CD4CodeMill; -import de.monticore.cd4code._symboltable.CD4CodeSymbolTableCompleter; import de.monticore.cdbasis._ast.ASTCDClass; -import de.monticore.cdbasis._ast.ASTCDCompilationUnit; -import de.monticore.cddiff.CDDiffTestBasis; -import java.io.IOException; -import java.util.Optional; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -public class MemberDiffTest extends CDDiffTestBasis { - - /*--------------------------------------------------------------------*/ - // Syntax Diff Tests - - public static final String dir = "src/test/resources/de/monticore/cddiff/syndiff/MemberDiff/"; - protected ASTCDCompilationUnit tgt; - protected ASTCDCompilationUnit src; - +import java.util.HashSet; +import java.util.Set; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class MemberDiffTest extends SynDiffTestBasis { + + @BeforeAll + public static void init() { + SynDiffTestBasis.dir = "src/test/resources/de/monticore/cddiff/syndiff/MemberDiff/"; + } + @Test public void testMember1() { parseModels("Source1.cd", "Target1.cd"); - + ASTCDClass cNew = CDTestHelper.getClass("A", src.getCDDefinition()); ASTCDClass cOld = CDTestHelper.getClass("A", tgt.getCDDefinition()); - + + Assertions.assertNotNull(cNew); + Assertions.assertNotNull(cOld); + ASTNode attributeNew = CDTestHelper.getAttribute(cNew, "a"); ASTNode attributeOld = CDTestHelper.getAttribute(cOld, "a"); - + CDMemberDiff attrDiff = new CDMemberDiff(attributeNew, attributeOld); - System.out.println(attrDiff.printSrcMember()); - System.out.println(attrDiff.printTgtMember()); - System.out.println(attrDiff.getBaseDiff()); - } - - public void parseModels(String concrete, String ref) { - try { - Optional src = CD4CodeMill.parser().parseCDCompilationUnit(dir - + concrete); - Optional tgt = CD4CodeMill.parser().parseCDCompilationUnit(dir + ref); - if (src.isPresent() && tgt.isPresent()) { - CD4CodeMill.scopesGenitorDelegator().createFromAST(src.get()); - CD4CodeMill.scopesGenitorDelegator().createFromAST(tgt.get()); - src.get().accept(new CD4CodeSymbolTableCompleter(src.get()).getTraverser()); - tgt.get().accept(new CD4CodeSymbolTableCompleter(tgt.get()).getTraverser()); - this.tgt = tgt.get(); - this.src = src.get(); - } - else { - fail("Could not parse CDs."); - } - - } - catch (IOException e) { - fail(e.getMessage()); - } + + assertEquals(new HashSet<>(attrDiff.getBaseDiff()), Set.of(DiffTypes.CHANGED_ATTRIBUTE_TYPE, DiffTypes.CHANGED_ATTRIBUTE_MODIFIER)); } - + } diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java index 316569bd7..d3ca9b5b1 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java @@ -1,123 +1,159 @@ /* (c) https://github.com/MontiCore/monticore */ package de.monticore.cddiff.syndiff; -import static org.junit.jupiter.api.Assertions.*; - +import de.monticore.cd4code.CD4CodeMill; import de.monticore.cdbasis._ast.ASTCDCompilationUnit; -import de.monticore.cddiff.CDDiffTestBasis; import de.monticore.cddiff.alloycddiff.CDSemantics; +import de.monticore.cddiff.ow2cw.ReductionTrafo; import de.monticore.cddiff.syn2semdiff.Syn2SemDiff; import de.monticore.od4report._prettyprint.OD4ReportFullPrettyPrinter; import de.monticore.odbasis._ast.ASTODArtifact; import de.monticore.odvalidity.OD2CDMatcher; import de.monticore.prettyprint.IndentPrinter; import de.se_rwth.commons.logging.Log; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.Collection; import java.util.List; -import org.junit.jupiter.api.Test; - -public class Syn2SemDiffTest extends CDDiffTestBasis { - - @Test - public void testCD5() { - ASTCDCompilationUnit compilationUnitNew = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/AssocDiff/AssocDeletedMerging/CD51.cd"); - ASTCDCompilationUnit compilationUnitOld = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/AssocDiff/AssocDeletedMerging/CD52.cd"); - - Syn2SemDiff syn2semdiff = new Syn2SemDiff(compilationUnitNew, compilationUnitOld); - List witnesses = syn2semdiff.generateODs(false); - - assertTrue(witnesses.isEmpty()); +import java.util.stream.Stream; + +import static de.monticore.cddiff.alloycddiff.CDSemantics.SIMPLE_CLOSED_WORLD; +import static de.monticore.cddiff.alloycddiff.CDSemantics.STA_CLOSED_WORLD; +import static de.monticore.cddiff.alloycddiff.CDSemantics.STA_OPEN_WORLD; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class Syn2SemDiffTest extends SynDiffTestBasis { + + private static final String cddiffDir = "src/test/resources/de/monticore/cddiff/"; + private static final String validationDir = "src/test/resources/validation/"; + + public static Stream emptyWitnesses() { + return Stream.of( + Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", false, false), + Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, false), + Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, false), + Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", false, false), + Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, true), + Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, true), + Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin3.cd", false, false), + Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", false, false), + Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin1.cd", true, true), + Arguments.of(cddiffDir, "Employees/Employees2.cd", "Employees/Employees1.cd", true, true), + Arguments.of(cddiffDir, "Employees/Employees8.cd", "Employees/Employees7.cd", true, true), + Arguments.of(validationDir, "cddiff/LibraryV3.cd", "cddiff/LibraryV2.cd", true, true), + Arguments.of(validationDir, "cddiff/LibraryV5.cd", "cddiff/LibraryV4.cd", true, true), + Arguments.of(validationDir, "cd4analysis/ManagementV2.cd", "cd4analysis/ManagementV1.cd", true, true), + Arguments.of(validationDir, "cd4analysis/MyCompanyV2.cd", "cd4analysis/MyCompanyV1.cd", true, true), + Arguments.of(validationDir, "cd4analysis/MyExampleV2.cd", "cd4analysis/MyExampleV1.cd", true, true) + ); } - - @Test - public void test11() { - ASTCDCompilationUnit compilationUnitNew = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/SyntaxDiff/MoveAttributes/CD11.cd"); - ASTCDCompilationUnit compilationUnitOld = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/SyntaxDiff/MoveAttributes/CD12.cd"); - - Syn2SemDiff syn2semdiff = new Syn2SemDiff(compilationUnitNew, compilationUnitOld); - List witnesses = syn2semdiff.generateODs(false); - + + @ParameterizedTest + @MethodSource("emptyWitnesses") + public void testEmptyWitnesses(String baseDir, String srcPath, String tgtPath, boolean staDiff, boolean reduction ) { + dir = baseDir; + parseModels(srcPath, tgtPath); + + if(reduction){ + ReductionTrafo trafo = new ReductionTrafo(); + trafo.transform(src, tgt); + } + + Syn2SemDiff syn2semdiff = new Syn2SemDiff(src, tgt); + List witnesses = syn2semdiff.generateODs(staDiff); + assertTrue(witnesses.isEmpty()); } - - @Test - public void test21() { - ASTCDCompilationUnit compilationUnitNew = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/SyntaxDiff/MoveAttributes/CD12.cd"); - ASTCDCompilationUnit compilationUnitOld = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/SyntaxDiff/MoveAttributes/CD11.cd"); - - Syn2SemDiff syn2semdiff = new Syn2SemDiff(compilationUnitNew, compilationUnitOld); - List witnesses = syn2semdiff.generateODs(false); - - assertTrue(witnesses.isEmpty()); + + public static Stream witnesses() { + return Stream.of( + //Arguments.of("syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", SIMPLE_CLOSED_WORLD, true), + Arguments.of(cddiffDir, "syndiff/SyntaxDiff/AddedDeletedAssocs/CD31.cd", "syndiff/SyntaxDiff/AddedDeletedAssocs/CD32.cd", SIMPLE_CLOSED_WORLD, false), + Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", SIMPLE_CLOSED_WORLD, true), + Arguments.of(cddiffDir, "syndiff/SyntaxDiff/SS1.cd", "syndiff/SyntaxDiff/SS2.cd", SIMPLE_CLOSED_WORLD, false), + Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin1.cd", SIMPLE_CLOSED_WORLD, false), + Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin1.cd", "DigitalTwins/DigitalTwin2.cd", SIMPLE_CLOSED_WORLD, true), + Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin3.cd", SIMPLE_CLOSED_WORLD, true), + Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", SIMPLE_CLOSED_WORLD, true), + Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd", SIMPLE_CLOSED_WORLD, false), + Arguments.of(cddiffDir, "Employees/Employees2.cd", "Employees/Employees1.cd", SIMPLE_CLOSED_WORLD, false), + Arguments.of(cddiffDir, "Employees/Employees7.cd", "Employees/Employees8.cd", STA_CLOSED_WORLD, true) + ); } - - @Test - public void test31() { - ASTCDCompilationUnit compilationUnitNew = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/SyntaxDiff/AddedDeletedAssocs/CD31.cd"); - ASTCDCompilationUnit compilationUnitOld = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/SyntaxDiff/AddedDeletedAssocs/CD32.cd"); - - Syn2SemDiff syn2semdiff = new Syn2SemDiff(compilationUnitNew, compilationUnitOld); - List witnesses = syn2semdiff.generateODs(false); - - assertFalse(witnesses.isEmpty()); - - for (ASTODArtifact od : witnesses) { - if (!new OD2CDMatcher().checkIfDiffWitness(CDSemantics.SIMPLE_CLOSED_WORLD, - compilationUnitNew, compilationUnitOld, od)) { - Log.println(new OD4ReportFullPrettyPrinter(new IndentPrinter()).prettyprint(od)); - fail(); - } + + @ParameterizedTest + @MethodSource("witnesses") + public void testWitnesses(String baseDir, String srcPath, String tgtPath, CDSemantics semantics, boolean reduction) { + dir = baseDir; + parseModels(srcPath, tgtPath); + + if(reduction){ + ReductionTrafo trafo = new ReductionTrafo(); + trafo.transform(src, tgt); } + + Syn2SemDiff syn2semdiff = new Syn2SemDiff(src, tgt); + List witnesses = syn2semdiff.generateODs(semantics.equals(STA_CLOSED_WORLD) || semantics.equals(STA_OPEN_WORLD)); + + assertFalse(witnesses.isEmpty()); + + checkDiffWitnesses(semantics, src, tgt, witnesses); } - - @Test - public void testSimpleSem() { - ASTCDCompilationUnit compilationUnitNew = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/SyntaxDiff/SS1.cd"); - ASTCDCompilationUnit compilationUnitOld = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/SyntaxDiff/SS2.cd"); - - Syn2SemDiff syn2semdiff = new Syn2SemDiff(compilationUnitNew, compilationUnitOld); - List witnesses = syn2semdiff.generateODs(false); - for (ASTODArtifact od : witnesses) { - if (!new OD2CDMatcher().checkIfDiffWitness(CDSemantics.SIMPLE_CLOSED_WORLD, - compilationUnitNew, compilationUnitOld, od)) { - Log.println(new OD4ReportFullPrettyPrinter(new IndentPrinter()).prettyprint(od)); - fail(); - } - } + + public static Stream witnessesReduction() { + return Stream.of( + Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd"), + Arguments.of(validationDir, "Performance/5A.cd", "Performance/5B.cd"), + Arguments.of(validationDir, "Performance/10A.cd", "Performance/10B.cd"), + Arguments.of(validationDir, "Performance/15A.cd", "Performance/15B.cd"), + Arguments.of(validationDir, "Performance/20A.cd", "Performance/20B.cd"), + Arguments.of(validationDir, "Performance/25A.cd", "Performance/25B.cd"), + Arguments.of(validationDir, "cddiff/DEv2.cd", "cddiff/DEv1.cd"), + Arguments.of(validationDir, "cddiff/EAv2.cd", "cddiff/EAv1.cd"), + Arguments.of(validationDir, "cddiff/EMTv1.cd", "cddiff/EMTv2.cd"), + Arguments.of(validationDir, "cddiff/LibraryV2.cd", "cddiff/LibraryV1.cd"), + Arguments.of(validationDir, "cddiff/LibraryV4.cd", "cddiff/LibraryV3.cd"), + Arguments.of(validationDir, "cd4analysis/MyLifeV2.cd", "cd4analysis/MyLifeV1.cd"), + Arguments.of(validationDir, "cd4analysis/TeachingV2.cd", "cd4analysis/TeachingV1.cd") + ); } - - @Test - public void testDT23() { - ASTCDCompilationUnit compilationUnitNew = parseModel( - "src/test/resources/de/monticore/cddiff/DigitalTwins/DigitalTwin2.cd"); - ASTCDCompilationUnit compilationUnitOld = parseModel( - "src/test/resources/de/monticore/cddiff/DigitalTwins/DigitalTwin3.cd"); - Syn2SemDiff syn2semdiff = new Syn2SemDiff(compilationUnitNew, compilationUnitOld); - List witnesses = syn2semdiff.generateODs(false); - assertTrue(witnesses.isEmpty()); + + @ParameterizedTest + @MethodSource("witnessesReduction") + public void testWitnessesReduction(String baseDir, String srcPath, String tgtPath) { + dir = baseDir; + parseModels(srcPath, tgtPath); + + ASTCDCompilationUnit srcOriginal = src.deepClone(); + ASTCDCompilationUnit tgtOriginal = tgt.deepClone(); + + // reduction-based + ReductionTrafo trafo = new ReductionTrafo(); + trafo.transform(src, tgt); + + Syn2SemDiff syn2semdiff = new Syn2SemDiff(src, tgt); + List witnesses = syn2semdiff.generateODs(true); + + Assertions.assertFalse(witnesses.isEmpty()); + + checkDiffWitnesses(CDSemantics.STA_CLOSED_WORLD, src, tgt, witnesses); + + CD4CodeMill.scopesGenitorDelegator().createFromAST(srcOriginal); + CD4CodeMill.scopesGenitorDelegator().createFromAST(tgtOriginal); + checkDiffWitnesses(CDSemantics.STA_OPEN_WORLD, srcOriginal, tgtOriginal, witnesses); } - - @Test - public void testDT32() { - ASTCDCompilationUnit compilationUnitNew = parseModel( - "src/test/resources/de/monticore/cddiff/DigitalTwins/DigitalTwin3.cd"); - ASTCDCompilationUnit compilationUnitOld = parseModel( - "src/test/resources/de/monticore/cddiff/DigitalTwins/DigitalTwin2.cd"); - Syn2SemDiff syn2semdiff = new Syn2SemDiff(compilationUnitNew, compilationUnitOld); - List witnesses = syn2semdiff.generateODs(false); + + protected void checkDiffWitnesses(CDSemantics semantics, ASTCDCompilationUnit cd1, + ASTCDCompilationUnit cd2, Collection witnesses) { for (ASTODArtifact od : witnesses) { - System.out.println(new OD4ReportFullPrettyPrinter(new IndentPrinter()).prettyprint(od)); + if (!new OD2CDMatcher().checkIfDiffWitness(semantics, cd1, cd2, od)) { + Log.println(new OD4ReportFullPrettyPrinter(new IndentPrinter()).prettyprint(od)); + Assertions.fail(); + } } - assertTrue(witnesses.isEmpty()); } - } diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffValidationTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffValidationTest.java deleted file mode 100644 index 3890c9b26..000000000 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffValidationTest.java +++ /dev/null @@ -1,274 +0,0 @@ -/* (c) https://github.com/MontiCore/monticore */ -package de.monticore.cddiff.syndiff; - -import de.monticore.cd._symboltable.BuiltInTypes; -import de.monticore.cd4code.CD4CodeMill; -import de.monticore.cdbasis._ast.ASTCDCompilationUnit; -import de.monticore.cddiff.CDDiffUtil; -import de.monticore.cddiff.alloycddiff.CDSemantics; -import de.monticore.cddiff.ow2cw.ReductionTrafo; -import de.monticore.cddiff.syn2semdiff.Syn2SemDiff; -import de.monticore.od4report._prettyprint.OD4ReportFullPrettyPrinter; -import de.monticore.odbasis._ast.ASTODArtifact; -import de.monticore.odvalidity.OD2CDMatcher; -import de.monticore.prettyprint.IndentPrinter; -import de.se_rwth.commons.logging.Log; -import java.io.IOException; -import java.util.Collection; -import java.util.List; -import java.util.stream.Stream; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; - -public class Syn2SemDiffValidationTest { - - @BeforeEach - public void init() { - Log.init(); - CD4CodeMill.reset(); - CD4CodeMill.init(); - CD4CodeMill.globalScope().init(); - BuiltInTypes.addBuiltInTypes(CD4CodeMill.globalScope()); - } - - @Test - public void testEmployees1() { - try { - ASTCDCompilationUnit cd1 = CDDiffUtil.loadCD( - "src/test/resources/de/monticore/cddiff/Employees/Employees1.cd"); - ASTCDCompilationUnit cd2 = CDDiffUtil.loadCD( - "src/test/resources/de/monticore/cddiff/Employees/Employees2.cd"); - - Syn2SemDiff syn2semdiff = new Syn2SemDiff(cd1, cd2); - List witnesses = syn2semdiff.generateODs(false); - - Assertions.assertFalse(witnesses.isEmpty()); - - checkDiffWitnesses(CDSemantics.SIMPLE_CLOSED_WORLD, cd1, cd2, witnesses); - - } - catch (IOException e) { - Assertions.fail(e.getMessage()); - } - } - - @Test - public void testEmployees2() { - try { - ASTCDCompilationUnit cd1 = CDDiffUtil.loadCD( - "src/test/resources/de/monticore/cddiff/Employees/Employees2.cd"); - ASTCDCompilationUnit cd2 = CDDiffUtil.loadCD( - "src/test/resources/de/monticore/cddiff/Employees/Employees1.cd"); - - Syn2SemDiff syn2semdiff = new Syn2SemDiff(cd1, cd2); - List witnesses = syn2semdiff.generateODs(false); - - Assertions.assertFalse(witnesses.isEmpty()); - - checkDiffWitnesses(CDSemantics.SIMPLE_CLOSED_WORLD, cd1, cd2, witnesses); - - } - catch (IOException e) { - Assertions.fail(e.getMessage()); - } - } - - @Test - public void testOWEmployees() { - try { - ASTCDCompilationUnit cd1 = CDDiffUtil.loadCD( - "src/test/resources/de/monticore/cddiff/Employees/Employees2.cd"); - ASTCDCompilationUnit cd2 = CDDiffUtil.loadCD( - "src/test/resources/de/monticore/cddiff/Employees/Employees1.cd"); - - ReductionTrafo trafo = new ReductionTrafo(); - trafo.transform(cd1, cd2); - CDDiffUtil.saveDiffCDs2File(cd1, cd2, "target/generated/syn2semdiff-test/Employees"); - - Syn2SemDiff syn2semdiff = new Syn2SemDiff(cd1, cd2); - List witnesses = syn2semdiff.generateODs(true); - - Assertions.assertTrue(witnesses.isEmpty()); - - } - catch (IOException e) { - Assertions.fail(e.getMessage()); - } - } - - @Test - public void testEmployeesWithPackagesDiffEmpty() { - try { - ASTCDCompilationUnit cd1 = CDDiffUtil.loadCD( - "src/test/resources/de/monticore/cddiff/Employees/Employees8.cd"); - ASTCDCompilationUnit cd2 = CDDiffUtil.loadCD( - "src/test/resources/de/monticore/cddiff/Employees/Employees7.cd"); - - ReductionTrafo trafo = new ReductionTrafo(); - trafo.transform(cd1, cd2); - CDDiffUtil.saveDiffCDs2File(cd1, cd2, "target/generated/syn2semdiff-test/EmployeesEmpty"); - - Syn2SemDiff syn2semdiff = new Syn2SemDiff(cd1, cd2); - List witnesses = syn2semdiff.generateODs(true); - - Assertions.assertTrue(witnesses.isEmpty()); - - } - catch (IOException e) { - Assertions.fail(e.getMessage()); - } - } - - @Test - public void testEmployeesWithPackagesOWDiffPresent() { - try { - ASTCDCompilationUnit cd1 = CDDiffUtil.loadCD( - "src/test/resources/de/monticore/cddiff/Employees/Employees7.cd"); - ASTCDCompilationUnit cd2 = CDDiffUtil.loadCD( - "src/test/resources/de/monticore/cddiff/Employees/Employees8.cd"); - - ReductionTrafo trafo = new ReductionTrafo(); - trafo.transform(cd1, cd2); - CDDiffUtil.saveDiffCDs2File(cd1, cd2, "target/generated/syn2semdiff-test/EmployeesPresent"); - - Syn2SemDiff syn2semdiff = new Syn2SemDiff(cd1, cd2); - List witnesses = syn2semdiff.generateODs(true); - - Assertions.assertFalse(witnesses.isEmpty()); - - checkDiffWitnesses(CDSemantics.STA_CLOSED_WORLD, cd1, cd2, witnesses); - - } - catch (IOException e) { - Assertions.fail(e.getMessage()); - } - } - - @Test - public void testOWDigitalTwin1() { - try { - ASTCDCompilationUnit cd1 = CDDiffUtil.loadCD( - "src/test/resources/de/monticore/cddiff/DigitalTwins/DigitalTwin2.cd"); - ASTCDCompilationUnit cd2 = CDDiffUtil.loadCD( - "src/test/resources/de/monticore/cddiff/DigitalTwins/DigitalTwin1.cd"); - - ReductionTrafo trafo = new ReductionTrafo(); - trafo.transform(cd1, cd2); - CDDiffUtil.saveDiffCDs2File(cd1, cd2, "target/generated/syn2semdiff-test/DT2vsDT1"); - - Syn2SemDiff syn2semdiff = new Syn2SemDiff(cd1, cd2); - List witnesses = syn2semdiff.generateODs(true); - - Assertions.assertTrue(witnesses.isEmpty()); - - } - catch (IOException e) { - Assertions.fail(e.getMessage()); - } - } - - @Test - public void testOWDigitalTwin2() { - String path = "src/test/resources/de/monticore/cddiff/DigitalTwins/"; - String file1 = "DigitalTwin3.cd"; - String file2 = "DigitalTwin2.cd"; - checkReductionBasedDiff(path, file1, file2, true); - } - - @ParameterizedTest - @MethodSource("performanceSet") - public void testReductionBasedOWDiff(String file1, String file2) { - String path = "src/test/resources/validation/Performance/"; - checkReductionBasedDiff(path, file1, file2, true); - } - - @ParameterizedTest - @MethodSource("cddiffSet") - public void testReductionBasedOWDiff2(String file1, String file2, boolean diff) { - String path = "src/test/resources/validation/cddiff/"; - checkReductionBasedDiff(path, file1, file2, diff); - } - - @ParameterizedTest // Fixed test - @MethodSource("cd4analysisSet") - public void testReductionBasedOWDiff3(String file1, String file2, boolean diff) { - String path = "src/test/resources/validation/cd4analysis/"; - checkReductionBasedDiff(path, file1, file2, diff); - } - - protected void checkReductionBasedDiff(String path, String file1, String file2, boolean diff) { - try { - ASTCDCompilationUnit cd1 = CDDiffUtil.loadCD(path + file1); - ASTCDCompilationUnit cd2 = CDDiffUtil.loadCD(path + file2); - - ASTCDCompilationUnit original1 = cd1.deepClone(); - ASTCDCompilationUnit original2 = cd2.deepClone(); - - // reduction-based - ReductionTrafo trafo = new ReductionTrafo(); - trafo.transform(cd1, cd2); - - // print modified CDs - String dir1 = file1.replaceAll("\\.cd", ""); - String dir2 = file2.replaceAll("\\.cd", ""); - CDDiffUtil.saveDiffCDs2File(cd1, cd2, "target/generated/syn2semdiff-test/" + dir1 + "vs" - + dir2); - - Syn2SemDiff syn2semdiff = new Syn2SemDiff(cd1, cd2); - List witnesses = syn2semdiff.generateODs(true); - if (diff) { - Assertions.assertFalse(witnesses.isEmpty()); - } - else { - Assertions.assertTrue(witnesses.isEmpty()); - } - - checkDiffWitnesses(CDSemantics.STA_CLOSED_WORLD, cd1, cd2, witnesses); - - CD4CodeMill.scopesGenitorDelegator().createFromAST(original1); - CD4CodeMill.scopesGenitorDelegator().createFromAST(original2); - checkDiffWitnesses(CDSemantics.STA_OPEN_WORLD, original1, original2, witnesses); - - } - catch (IOException e) { - Assertions.fail(e.getMessage()); - } - } - - protected void checkDiffWitnesses(CDSemantics semantics, ASTCDCompilationUnit cd1, - ASTCDCompilationUnit cd2, Collection witnesses) { - for (ASTODArtifact od : witnesses) { - if (!new OD2CDMatcher().checkIfDiffWitness(semantics, cd1, cd2, od)) { - Log.println(new OD4ReportFullPrettyPrinter(new IndentPrinter()).prettyprint(od)); - Assertions.fail(); - } - } - } - - protected static Stream performanceSet() { - return Stream.of(Arguments.of("5A.cd", "5B.cd"), Arguments.of("10A.cd", "10B.cd"), Arguments.of( - "15A.cd", "15B.cd"), Arguments.of("20A.cd", "20B.cd"), Arguments.of("25A.cd", "25B.cd")); - } - - protected static Stream cddiffSet() { - return Stream.of(Arguments.of("DEv2.cd", "DEv1.cd", true), Arguments.of("EAv2.cd", "EAv1.cd", - true), Arguments.of("EMTv1.cd", "EMTv2.cd", true), Arguments.of("LibraryV2.cd", - "LibraryV1.cd", true), Arguments.of("LibraryV3.cd", "LibraryV2.cd", false), Arguments - .of("LibraryV4.cd", "LibraryV3.cd", true), Arguments.of("LibraryV5.cd", - "LibraryV4.cd", false)); - } - - protected static Stream cd4analysisSet() { - return Stream.of(Arguments.of("ManagementV2.cd", "ManagementV1.cd", false), Arguments.of( - "MyCompanyV2.cd", "MyCompanyV1.cd", false), Arguments.of("MyExampleV2.cd", "MyExampleV1.cd", - false), - // virtual associations should use qualified names - fixed - Arguments.of("MyLifeV2.cd", "MyLifeV1.cd", true), Arguments.of("TeachingV2.cd", - "TeachingV1.cd", true)); - } - -} diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/SynAssocDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SynAssocDiffTest.java new file mode 100644 index 000000000..57689be7c --- /dev/null +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SynAssocDiffTest.java @@ -0,0 +1,115 @@ +/* (c) https://github.com/MontiCore/monticore */ +package de.monticore.cddiff.syndiff; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class SynAssocDiffTest extends SynDiffTestBasis { + + @BeforeAll + public static void init() { + dir = "src/test/resources/de/monticore/cddiff/syndiff/AssocDiff/"; + } + + @Test + public void testAssoc1() { + parseModels("Source1.cd", "Target1.cd"); + + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); + + assertEquals(1, synDiff.getChangedAssocs().size()); + assertEquals(1, synDiff.getAddedAssocs().size()); + assertEquals(1, synDiff.getDeletedAssocs().size()); + assertEquals(1, synDiff.getAddedClasses().size()); + assertEquals(3, synDiff.getMatchedClasses().size()); + assertEquals(1, synDiff.getMatchedAssocs().size()); + + // Check that no other diffs exist + Map expectedDiffTypes = new HashMap<>(); + expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_CARDINALITY, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_CLASS, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_ASSOCIATION, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_INHERITANCE, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); + + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); + } + + @Test + public void testAssoc2() { + parseModels("Source2.cd", "Target2.cd"); + + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); + + assertEquals(1, synDiff.getChangedAssocs().size()); + assertEquals(1, synDiff.getMatchedAssocs().size()); + assertEquals(3, synDiff.getMatchedClasses().size()); + + Map expectedDiffTypes = new HashMap<>(); + expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_CARDINALITY, 1L); + expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_SOURCE_CLASS, 1L); + + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); + } + + @Test + public void testAssoc3() { + parseModels("Source3.cd", "Target3.cd"); + + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); + + assertEquals(2, synDiff.getChangedTypes().size()); + assertEquals(3, synDiff.getChangedAssocs().size()); + assertEquals(3, synDiff.getMatchedAssocs().size()); + assertEquals(4, synDiff.getMatchedClasses().size()); + + Map expectedDiffTypes = new HashMap<>(); + expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_CARDINALITY, 3L); + expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_DIRECTION, 1L); + expectedDiffTypes.put(DiffTypes.CHANGED_TYPE_EXTENDS, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_INHERITANCE, 1L); + expectedDiffTypes.put(DiffTypes.CHANGED_CLASS_MODIFIER, 1L); + + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); + } + + @Test + public void testAssoc4() { + parseModels("Source4.cd", "Target4.cd"); + + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); + + assertEquals(4, synDiff.getAddedAssocs().size()); + assertEquals(4, synDiff.getDeletedAssocs().size()); + assertEquals(0, synDiff.getMatchedAssocs().size()); + assertEquals(4, synDiff.getMatchedClasses().size()); + + Map expectedDiffTypes = new HashMap<>(); + expectedDiffTypes.put(DiffTypes.ADDED_ASSOCIATION, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); + + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); + } + + @Test + public void testAssoc5() { + parseModels("Source5.cd", "Target5.cd"); + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); + + assertEquals(1, synDiff.getChangedAssocs().size()); + assertEquals(1, synDiff.getMatchedAssocs().size()); + assertEquals(2, synDiff.getMatchedClasses().size()); + + Map expectedDiffTypes = new HashMap<>(); + expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_CARDINALITY, 1L); + + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); + } + +} diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/SynDiffTestBasis.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SynDiffTestBasis.java new file mode 100644 index 000000000..3ef952c88 --- /dev/null +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SynDiffTestBasis.java @@ -0,0 +1,71 @@ +package de.monticore.cddiff.syndiff; + +import de.monticore.cd._symboltable.BuiltInTypes; +import de.monticore.cd4analysis.trafo.CD4AnalysisAfterParseTrafo; +import de.monticore.cd4code.CD4CodeMill; +import de.monticore.cd4code._symboltable.CD4CodeSymbolTableCompleter; +import de.monticore.cdbasis._ast.ASTCDCompilationUnit; +import de.se_rwth.commons.logging.Log; +import de.se_rwth.commons.logging.LogStub; +import org.junit.jupiter.api.BeforeEach; + +import java.io.IOException; +import java.util.Map; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.junit.jupiter.api.Assertions.fail; + +public abstract class SynDiffTestBasis { + + @BeforeEach + public void setup() { + LogStub.init(); + Log.enableFailQuick(false); + CD4CodeMill.reset(); + CD4CodeMill.init(); + CD4CodeMill.globalScope().clear(); + CD4CodeMill.globalScope().init(); + BuiltInTypes.addBuiltInTypes(CD4CodeMill.globalScope()); + } + + public static String dir; + protected ASTCDCompilationUnit tgt; + protected ASTCDCompilationUnit src; + + public void parseModels(String concrete, String ref) { + try { + Optional src = CD4CodeMill.parser().parseCDCompilationUnit(dir + + concrete); + Optional tgt = CD4CodeMill.parser().parseCDCompilationUnit(dir + ref); + if (src.isPresent() && tgt.isPresent()) { + (new CD4AnalysisAfterParseTrafo()).transform(src.get()); + (new CD4AnalysisAfterParseTrafo()).transform(tgt.get()); + CD4CodeMill.scopesGenitorDelegator().createFromAST(src.get()); + CD4CodeMill.scopesGenitorDelegator().createFromAST(tgt.get()); + src.get().accept(new CD4CodeSymbolTableCompleter(src.get()).getTraverser()); + tgt.get().accept(new CD4CodeSymbolTableCompleter(tgt.get()).getTraverser()); + this.tgt = tgt.get(); + this.src = src.get(); + } + else { + fail(String.format("Parsing src: '%s', tgt: '%s'.", src.isPresent() ? "success" : "failure", tgt.isPresent() ? "success" : "failure")); + } + + } + catch (IOException e) { + fail(e.getMessage()); + } + } + + public Map getDiffTypesCount(CDSyntaxDiff synDiff) { + return synDiff.getBaseDiff().stream().collect( + Collectors.groupingBy( + Function.identity(), + Collectors.counting() + ) + ); + } + +} diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java index 9476e9814..d7c53dcc2 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java @@ -1,8 +1,6 @@ /* (c) https://github.com/MontiCore/monticore */ package de.monticore.cddiff.syndiff; -import static org.junit.jupiter.api.Assertions.*; - import de.monticore.cd4code.CD4CodeMill; import de.monticore.cdbasis._ast.ASTCDCompilationUnit; import de.monticore.cdconformance.CDConfParameter; @@ -13,123 +11,198 @@ import de.monticore.cddiff.syn2semdiff.Syn2SemDiff; import de.monticore.odbasis._ast.ASTODArtifact; import de.monticore.odvalidity.OD2CDMatcher; +import de.se_rwth.commons.logging.Log; +import org.junit.jupiter.api.Test; + import java.io.IOException; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Optional; import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; -import de.se_rwth.commons.logging.Log; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; public class SyntaxDiffTest extends CDDiffTestBasis { - + /*--------------------------------------------------------------------*/ // Syntax Diff Tests - + public static final String dir = "src/test/resources/de/monticore/cddiff/syndiff/SyntaxDiff/"; protected ASTCDCompilationUnit tgt; protected ASTCDCompilationUnit src; - + @Test public void testDTs() { ASTCDCompilationUnit compilationUnitNew = parseModel( "src/test/resources/de/monticore/cddiff/DigitalTwins/DigitalTwin3.cd"); ASTCDCompilationUnit compilationUnitOld = parseModel( "src/test/resources/de/monticore/cddiff/DigitalTwins/DigitalTwin1.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(compilationUnitNew, compilationUnitOld, List.of()); assertEquals(4, synDiff.getAddedClasses().size()); assertEquals(2, synDiff.getAddedAssocs().size()); + assertEquals(3, synDiff.getChangedAssocs().size()); + assertEquals(4, synDiff.getMatchedClasses().size()); + assertEquals(3, synDiff.getMatchedAssocs().size()); + + Map expectedDiffTypes = new HashMap<>(); + expectedDiffTypes.put(DiffTypes.ADDED_CLASS, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_ASSOCIATION, 1L); + expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_TARGET_CLASS, 1L); + expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_CARDINALITY, 2L); + expectedDiffTypes.put(DiffTypes.ADDED_INHERITANCE, 1L); + expectedDiffTypes.put(DiffTypes.CHANGED_TYPE_EXTENDS, 1L); + expectedDiffTypes.put(DiffTypes.CHANGED_CLASS_MODIFIER, 1L); + + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testSyntaxDiff1() { parseModels("Source1.cd", "Target1.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); SyntaxDiffPrinter sb = new SyntaxDiffPrinter(synDiff); Log.println(sb.printDiff()); - + // check added / deleted classes assertEquals(2, synDiff.getAddedClasses().size()); assertEquals(2, synDiff.getDeletedClasses().size()); - + // check added / deleted enums assertEquals(1, synDiff.getAddedEnums().size()); assertEquals(1, synDiff.getDeletedEnums().size()); - + // check changed types assertEquals(4, synDiff.getChangedTypes().size()); - + // check associations assertEquals(2, synDiff.getChangedAssocs().size()); assertEquals(2, synDiff.getAddedAssocs().size()); assertEquals(2, synDiff.getDeletedAssocs().size()); - + // check no changes assertTrue(synDiff.getAddedInterfaces().isEmpty()); assertTrue(synDiff.getDeletedInterfaces().isEmpty()); + + Map expectedDiffTypes = new HashMap<>(); + expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_ENUM, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_INHERITANCE, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_ATTRIBUTE, 2L); + expectedDiffTypes.put(DiffTypes.DELETED_CLASS, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_CONSTANT, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_ASSOCIATION, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_ENUM, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_INHERITANCE, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_ATTRIBUTE, 2L); + expectedDiffTypes.put(DiffTypes.ADDED_CLASS, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_CONSTANT, 1L); + expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_NAME, 1L); + expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_ROLE, 1L); + expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_CARDINALITY, 2L); + expectedDiffTypes.put(DiffTypes.CHANGED_ATTRIBUTE_TYPE, 1L); + expectedDiffTypes.put(DiffTypes.CHANGED_CLASS_MODIFIER, 1L); + expectedDiffTypes.put(DiffTypes.INHERITED_ATTRIBUTE, 1L); + + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testSyntaxDiff2() { parseModels("Source2.cd", "Target2.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); SyntaxDiffPrinter sb = new SyntaxDiffPrinter(synDiff); Log.println(sb.printDiff()); - + // check changes assertEquals(2, synDiff.getAddedClasses().size()); assertEquals(2, synDiff.getDeletedClasses().size()); - + assertEquals(1, synDiff.getAddedEnums().size()); assertEquals(1, synDiff.getDeletedEnums().size()); - + assertEquals(1, synDiff.getAddedAssocs().size()); assertEquals(1, synDiff.getDeletedAssocs().size()); - + // check no changes assertTrue(synDiff.getAddedInterfaces().isEmpty()); assertTrue(synDiff.getDeletedInterfaces().isEmpty()); assertTrue(synDiff.getChangedTypes().isEmpty()); assertTrue(synDiff.getChangedAssocs().isEmpty()); + + Map expectedDiffTypes = new HashMap<>(); + expectedDiffTypes.put(DiffTypes.ADDED_CLASS, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_ASSOCIATION, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_INHERITANCE, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_ENUM, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_CLASS, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_INHERITANCE, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_ENUM, 1L); + + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testSyntaxDiff3() { parseModels("TechStoreV2.cd", "TechStoreV1.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); SyntaxDiffPrinter sb = new SyntaxDiffPrinter(synDiff); Log.println(sb.printDiff()); - + assertEquals(2, synDiff.getDeletedClasses().size()); assertEquals(3, synDiff.getChangedTypes().size()); - + assertEquals(5, synDiff.getChangedAssocs().size()); assertEquals(4, synDiff.getAddedAssocs().size()); assertEquals(2, synDiff.getDeletedAssocs().size()); - + // check no changes assertTrue(synDiff.getAddedClasses().isEmpty()); assertTrue(synDiff.getAddedInterfaces().isEmpty()); assertTrue(synDiff.getDeletedInterfaces().isEmpty()); assertTrue(synDiff.getAddedEnums().isEmpty()); assertTrue(synDiff.getDeletedEnums().isEmpty()); + + Map expectedDiffTypes = new HashMap<>(); + expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_INHERITANCE, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_ATTRIBUTE, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_CLASS, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_ASSOCIATION, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_ATTRIBUTE, 2L); + expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_NAME, 3L); + expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_ROLE, 3L); + expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_CARDINALITY, 3L); + expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_DIRECTION, 3L); + expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_TARGET_CLASS, 1L); + expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_CLASS, 2L); + expectedDiffTypes.put(DiffTypes.CHANGED_ATTRIBUTE_TYPE, 1L); + expectedDiffTypes.put(DiffTypes.CHANGED_CLASS_NAME, 1L); + + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testSyntaxDiff4() { parseModels("TechStoreV9.cd", "TechStoreV10.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); SyntaxDiffPrinter sb = new SyntaxDiffPrinter(synDiff); Log.println(sb.printDiff()); - + // check changes assertEquals(1, synDiff.getDeletedAssocs().size()); - + // check no changes assertTrue(synDiff.getAddedClasses().isEmpty()); assertTrue(synDiff.getAddedInterfaces().isEmpty()); @@ -139,20 +212,24 @@ public void testSyntaxDiff4() { assertTrue(synDiff.getChangedTypes().isEmpty()); assertTrue(synDiff.getChangedAssocs().isEmpty()); assertTrue(synDiff.getAddedAssocs().isEmpty()); - + + Map expectedDiffTypes = new HashMap<>(); + expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); + + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testSyntaxDiff5() { parseModels("TechStoreV11.cd", "TechStoreV12.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); SyntaxDiffPrinter sb = new SyntaxDiffPrinter(synDiff); Log.println(sb.printDiff()); - + // check changes assertEquals(3, synDiff.getChangedTypes().size()); - + // check no changes assertTrue(synDiff.getAddedClasses().isEmpty()); assertTrue(synDiff.getAddedInterfaces().isEmpty()); @@ -162,21 +239,27 @@ public void testSyntaxDiff5() { assertTrue(synDiff.getChangedAssocs().isEmpty()); assertTrue(synDiff.getAddedAssocs().isEmpty()); assertTrue(synDiff.getDeletedAssocs().isEmpty()); + + Map expectedDiffTypes = new HashMap<>(); + expectedDiffTypes.put(DiffTypes.ADDED_ATTRIBUTE, 1L); + expectedDiffTypes.put(DiffTypes.INHERITED_ATTRIBUTE, 2L); + + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testMaCoCo() { CDDiffUtil.setUseJavaTypes(true); parseModels("MaCoCo_v1.cd", "MaCoCo_v2.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); SyntaxDiffPrinter sb = new SyntaxDiffPrinter(synDiff); Log.println(sb.printDiff()); - + assertEquals(1, synDiff.getAddedClasses().size()); assertEquals(1, synDiff.getAddedEnums().size()); assertEquals(1, synDiff.getAddedAssocs().size()); - + assertTrue(synDiff.getDeletedClasses().isEmpty()); assertTrue(synDiff.getAddedInterfaces().isEmpty()); assertTrue(synDiff.getDeletedInterfaces().isEmpty()); @@ -184,52 +267,68 @@ public void testMaCoCo() { assertTrue(synDiff.getChangedTypes().isEmpty()); assertTrue(synDiff.getChangedAssocs().isEmpty()); assertTrue(synDiff.getDeletedAssocs().isEmpty()); - + + Map expectedDiffTypes = new HashMap<>(); + expectedDiffTypes.put(DiffTypes.ADDED_CLASS, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_ENUM, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_ASSOCIATION, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_INHERITANCE, 1L); + + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); + // Conformance Checking without stereotype mapping constitutes a refinement check boolean conform = new CDConformanceChecker(Set.of(CDConfParameter.STEREOTYPE_MAPPING, CDConfParameter.NAME_MAPPING, CDConfParameter.SRC_TARGET_ASSOC_MAPPING, CDConfParameter.ALLOW_CARD_RESTRICTION)).checkConformance(src, tgt, "incarnates"); - + assertTrue(conform); - + // Syn2SemDiff produces correct diff-witnesses Syn2SemDiff semDiff = new Syn2SemDiff(src, tgt); OD2CDMatcher matcher = new OD2CDMatcher(); List ods = semDiff.generateODs(false); - + assertFalse(ods.isEmpty()); assertTrue(semDiff.generateODs(false).stream().allMatch(od -> matcher.checkIfDiffWitness( CDSemantics.SIMPLE_CLOSED_WORLD, src, tgt, od))); - + synDiff = new CDSyntaxDiff(tgt, src, List.of()); sb = new SyntaxDiffPrinter(synDiff); Log.println(sb.printDiff()); assertEquals(1, synDiff.getDeletedClasses().size()); assertEquals(1, synDiff.getDeletedEnums().size()); assertEquals(1, synDiff.getDeletedAssocs().size()); - + assertTrue(synDiff.getAddedClasses().isEmpty()); assertTrue(synDiff.getAddedInterfaces().isEmpty()); assertTrue(synDiff.getDeletedInterfaces().isEmpty()); - assertTrue(synDiff.getAddedInterfaces().isEmpty()); + assertTrue(synDiff.getAddedEnums().isEmpty()); assertTrue(synDiff.getChangedTypes().isEmpty()); assertTrue(synDiff.getChangedAssocs().isEmpty()); assertTrue(synDiff.getAddedAssocs().isEmpty()); - + + expectedDiffTypes = new HashMap<>(); + expectedDiffTypes.put(DiffTypes.DELETED_CLASS, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_ENUM, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_INHERITANCE, 1L); + + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); + // Conformance Checking without stereotype mapping constitutes a refinement check conform = new CDConformanceChecker(Set.of(CDConfParameter.STEREOTYPE_MAPPING, CDConfParameter.NAME_MAPPING, CDConfParameter.SRC_TARGET_ASSOC_MAPPING, CDConfParameter.ALLOW_CARD_RESTRICTION)).checkConformance(tgt, src, "incarnates"); - + assertFalse(conform); - + // Syn2SemDiff produces correct diff-witnesses semDiff = new Syn2SemDiff(tgt, src); ods = semDiff.generateODs(false); - + assertTrue(ods.isEmpty()); } - + public void parseModels(String concrete, String ref) { try { Optional src = CD4CodeMill.parser().parseCDCompilationUnit(dir @@ -244,11 +343,19 @@ public void parseModels(String concrete, String ref) { else { fail("Could not parse CDs."); } - + } catch (IOException e) { fail(e.getMessage()); } } - + + private Map getDiffTypesCount(CDSyntaxDiff synDiff) { + return synDiff.getBaseDiff().stream().collect( + Collectors.groupingBy( + Function.identity(), + Collectors.counting() + ) + ); + } } diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/TypeDIffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/TypeDIffTest.java index 4d2135ab9..71a899bb4 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/TypeDIffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/TypeDIffTest.java @@ -1,8 +1,6 @@ /* (c) https://github.com/MontiCore/monticore */ package de.monticore.cddiff.syndiff; -import static org.junit.jupiter.api.Assertions.fail; - import de.monticore.cd4code.CD4CodeMill; import de.monticore.cd4code._prettyprint.CD4CodeFullPrettyPrinter; import de.monticore.cd4code._symboltable.CD4CodeSymbolTableCompleter; @@ -17,41 +15,48 @@ import de.monticore.odvalidity.OD2CDMatcher; import de.monticore.prettyprint.IndentPrinter; import de.se_rwth.commons.logging.Log; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + import java.io.IOException; import java.util.List; +import java.util.Map; import java.util.Optional; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; public class TypeDIffTest extends CDDiffTestBasis { - + @Test public void testCD2() { - + ASTCDCompilationUnit compilationUnitNew = parseModel( "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/RemovedAttributeNoDiff/CD21.cd"); ASTCDCompilationUnit compilationUnitOld = parseModel( "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/RemovedAttributeNoDiff/CD22.cd"); - + Syn2SemDiff syn2semdiff = new Syn2SemDiff(compilationUnitNew, compilationUnitOld); List witnesses = syn2semdiff.generateODs(false); - + Assertions.assertTrue(witnesses.isEmpty()); } - + @Test public void testCD1() { - + ASTCDCompilationUnit compilationUnitNew = parseModel( "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/DeletedAttribute/CD11.cd"); ASTCDCompilationUnit compilationUnitOld = parseModel( "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/DeletedAttribute/CD12.cd"); - + Syn2SemDiff syn2semdiff = new Syn2SemDiff(compilationUnitNew, compilationUnitOld); List witnesses = syn2semdiff.generateODs(false); - + Assertions.assertFalse(witnesses.isEmpty()); - + for (ASTODArtifact od : witnesses) { if (!new OD2CDMatcher().checkIfDiffWitness(CDSemantics.SIMPLE_CLOSED_WORLD, compilationUnitNew, compilationUnitOld, od)) { @@ -60,19 +65,19 @@ public void testCD1() { } } } - + @Test public void testCD3() { ASTCDCompilationUnit compilationUnitNew = parseModel( "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/RemovedAddedAttributeDiff/CD31.cd"); ASTCDCompilationUnit compilationUnitOld = parseModel( "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/RemovedAddedAttributeDiff/CD32.cd"); - + Syn2SemDiff syn2semdiff = new Syn2SemDiff(compilationUnitNew, compilationUnitOld); List witnesses = syn2semdiff.generateODs(false); - + Assertions.assertFalse(witnesses.isEmpty()); - + for (ASTODArtifact od : witnesses) { if (!new OD2CDMatcher().checkIfDiffWitness(CDSemantics.SIMPLE_CLOSED_WORLD, compilationUnitNew, compilationUnitOld, od)) { @@ -81,20 +86,20 @@ public void testCD3() { } } } - + @Test public void testCD7() { - + ASTCDCompilationUnit compilationUnitNew = parseModel( "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/ChangedAttribute/CD71.cd"); ASTCDCompilationUnit compilationUnitOld = parseModel( "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/ChangedAttribute/CD72.cd"); - + Syn2SemDiff syn2semdiff = new Syn2SemDiff(compilationUnitNew, compilationUnitOld); List witnesses = syn2semdiff.generateODs(false); - + Assertions.assertFalse(witnesses.isEmpty()); - + for (ASTODArtifact od : witnesses) { if (!new OD2CDMatcher().checkIfDiffWitness(CDSemantics.SIMPLE_CLOSED_WORLD, compilationUnitNew, compilationUnitOld, od)) { @@ -103,26 +108,35 @@ public void testCD7() { } } } - + /*--------------------------------------------------------------------*/ // Syntax Diff Tests - + public static final String dir = "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/"; protected ASTCDCompilationUnit tgt; protected ASTCDCompilationUnit src; - + // Test for all kinds of changes in attributes @Test public void testType1() { parseModels("Source1.cd", "Target1.cd"); - + CDDiffUtil.refreshSymbolTable(src); CDDiffUtil.refreshSymbolTable(tgt); - - CDSyntaxDiff syntaxDiff = new CDSyntaxDiff(src, tgt, List.of()); - // System.out.println(syntaxDiff.printDiff()); + + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); + + assertEquals(3, synDiff.getMatchedClasses().size()); + assertEquals(1, synDiff.getMatchedEnums().size()); + assertEquals(4, synDiff.getChangedTypes().size()); + assertEquals(1, synDiff.getAddedClasses().size()); + assertEquals(1, synDiff.getAddedEnums().size()); + assertEquals(1, synDiff.getDeletedClasses().size()); + assertEquals(1, synDiff.getDeletedEnums().size()); + assertEquals(1, synDiff.getAddedAssocs().size()); + assertEquals(2, synDiff.getDeletedAssocs().size()); } - + // Tests for all kinds of changes in enum constants @Test public void testType2() { @@ -134,34 +148,34 @@ public void testType2() { ASTCDClass astcdClass22 = CDTestHelper.getClass("B", tgt.getCDDefinition()); CDDiffUtil.refreshSymbolTable(src); CDDiffUtil.refreshSymbolTable(tgt); - + CDSyntaxDiff diff = new CDSyntaxDiff(src, tgt, List.of()); CDTypeDiff typeDiff1 = new CDTypeDiff(astcdClass11, astcdClass12, tgt, src, diff.getHelper()); CDTypeDiff typeDiff2 = new CDTypeDiff(astcdClass21, astcdClass22, tgt, src, diff.getHelper()); - + // System.out.println(diff.printOnlyAdded()); - + /*System.out.println(typeDiff1.printSrcCD()); System.out.println(typeDiff2.printSrcCD()); System.out.println("--------------------------------"); System.out.println(typeDiff1.printTgtCD()); System.out.println(typeDiff2.printTgtCD());*/ } - + // Test for change of modifiers, extensions, and implementations @Test public void testType3() { parseModels("Source3.cd", "Target3.cd"); - + ASTCDClass astcdClass11 = CDTestHelper.getClass("A", src.getCDDefinition()); ASTCDClass astcdClass12 = CDTestHelper.getClass("A", tgt.getCDDefinition()); ASTCDClass astcdClass21 = CDTestHelper.getClass("B", src.getCDDefinition()); ASTCDClass astcdClass22 = CDTestHelper.getClass("B", tgt.getCDDefinition()); ASTCDClass astcdClass31 = CDTestHelper.getClass("C", src.getCDDefinition()); ASTCDClass astcdClass32 = CDTestHelper.getClass("C", tgt.getCDDefinition()); - + CDSyntaxDiff diff = new CDSyntaxDiff(src, tgt, List.of()); - + CDTypeDiff typeDiff1 = new CDTypeDiff(astcdClass11, astcdClass12, tgt, src, diff.getHelper()); CDTypeDiff typeDiff2 = new CDTypeDiff(astcdClass21, astcdClass22, tgt, src, diff.getHelper()); CDTypeDiff typeDiff3 = new CDTypeDiff(astcdClass31, astcdClass32, tgt, src, diff.getHelper()); @@ -177,21 +191,21 @@ public void testType3() { System.out.println(typeDiff2.getBaseDiff()); System.out.println(typeDiff3.getBaseDiff()); } - + // Test for inherited attributes @Test public void testType4() { parseModels("Source4.cd", "Target4.cd"); - + ASTCDClass astcdClass = CDTestHelper.getClass("A", src.getCDDefinition()); ASTCDClass astcdClass1 = CDTestHelper.getClass("A", tgt.getCDDefinition()); - + CDSyntaxDiff diff = new CDSyntaxDiff(src, tgt, List.of()); CDTypeDiff typeDiff = new CDTypeDiff(astcdClass, astcdClass1, tgt, src, diff.getHelper()); System.out.println(typeDiff.printSrcCD()); System.out.println(typeDiff.printTgtCD()); } - + public void parseModels(String concrete, String ref) { try { Optional src = CD4CodeMill.parser().parseCDCompilationUnit(dir @@ -208,11 +222,20 @@ public void parseModels(String concrete, String ref) { else { fail("Could not parse CDs."); } - + } catch (IOException e) { fail(e.getMessage()); } } - + + private Map getDiffTypesCount(CDSyntaxDiff synDiff) { + return synDiff.getBaseDiff().stream().collect( + Collectors.groupingBy( + Function.identity(), + Collectors.counting() + ) + ); + } + } diff --git a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/Source1.cd b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/Source1.cd index ca592bf80..f603ead4d 100644 --- a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/Source1.cd +++ b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/Source1.cd @@ -6,6 +6,11 @@ classdiagram Source1 { class A { int a; String d; + / String der; + } + + class D extends A { + String i; } class C{ diff --git a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/Target1.cd b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/Target1.cd index 2068ef360..6a6f072e7 100644 --- a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/Target1.cd +++ b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/Target1.cd @@ -5,10 +5,12 @@ classdiagram Target1 { enum MatchedEnum{k,l;} class A{ double a; + String i; String f; + String der; } - class D{} + class D extends A {} class K{ int j; From efca5541bd484c3d08c7a4138fa6f9378be8428d Mon Sep 17 00:00:00 2001 From: Lukas Kronast Date: Fri, 27 Jun 2025 12:17:26 +0200 Subject: [PATCH 02/17] test refactoring and new tests --- .../cddiff/syndiff/AssertSynDiff.java | 121 + .../cddiff/syndiff/MemberDiffTest.java | 40 - .../monticore/cddiff/syndiff/Performance.java | 183 - .../cddiff/syndiff/PerformanceTest.java | 44 + .../cddiff/syndiff/Syn2SemDiffTest.java | 102 +- .../cddiff/syndiff/SynAssocDiffTest.java | 49 +- .../cddiff/syndiff/SyntaxDiffTest.java | 265 +- .../cddiff/syndiff/TypeDIffTest.java | 241 - .../cddiff/syndiff/TypeDiffTest.java | 127 + .../cddiff/syndiff/Performance/100/CD1.cd | 588 ++ .../cddiff/syndiff/Performance/100/CD2.cd | 565 ++ .../cddiff/syndiff/Performance/1000/CD1.cd | 5805 +++++++++++++++++ .../cddiff/syndiff/Performance/1000/CD2.cd | 5605 ++++++++++++++++ .../cddiff/syndiff/TypeDiff/Source2.cd | 1 + .../cddiff/syndiff/TypeDiff/Target2.cd | 1 + 15 files changed, 13067 insertions(+), 670 deletions(-) create mode 100644 cddiff/src/test/java/de/monticore/cddiff/syndiff/AssertSynDiff.java delete mode 100644 cddiff/src/test/java/de/monticore/cddiff/syndiff/MemberDiffTest.java delete mode 100644 cddiff/src/test/java/de/monticore/cddiff/syndiff/Performance.java create mode 100644 cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java delete mode 100644 cddiff/src/test/java/de/monticore/cddiff/syndiff/TypeDIffTest.java create mode 100644 cddiff/src/test/java/de/monticore/cddiff/syndiff/TypeDiffTest.java create mode 100644 cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/100/CD1.cd create mode 100644 cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/100/CD2.cd create mode 100644 cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/1000/CD1.cd create mode 100644 cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/1000/CD2.cd diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/AssertSynDiff.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/AssertSynDiff.java new file mode 100644 index 000000000..e812eac77 --- /dev/null +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/AssertSynDiff.java @@ -0,0 +1,121 @@ +package de.monticore.cddiff.syndiff; + +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Map; +import java.util.function.Function; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class AssertSynDiff { + CDSyntaxDiff diff; + Map> remainingFunctions = new HashMap<>(); + + public AssertSynDiff(CDSyntaxDiff diff) { + this.diff = diff; + remainingFunctions.put("assertAddedClasses", this::assertAddedClasses); + remainingFunctions.put("assertDeletedClasses", this::assertDeletedClasses); + remainingFunctions.put("assertMatchedClasses", this::assertMatchedClasses); + remainingFunctions.put("assertChangedTypes", this::assertChangedTypes); + remainingFunctions.put("assertAddedEnums", this::assertAddedEnums); + remainingFunctions.put("assertDeletedEnums", this::assertDeletedEnums); + remainingFunctions.put("assertMatchedEnums", this::assertMatchedEnums); + remainingFunctions.put("assertChangedAssocs", this::assertChangedAssocs); + remainingFunctions.put("assertAddedAssocs", this::assertAddedAssocs); + remainingFunctions.put("assertDeletedAssocs", this::assertDeletedAssocs); + remainingFunctions.put("assertMatchedAssocs", this::assertMatchedAssocs); + remainingFunctions.put("assertAddedInterfaces", this::assertAddedInterfaces); + remainingFunctions.put("assertDeletedInterfaces", this::assertDeletedInterfaces); + remainingFunctions.put("assertMatchedInterfaces", this::assertMatchedInterfaces); + } + + public AssertSynDiff assertAddedClasses(int expected) { + assertEquals(expected, diff.getAddedClasses().size(), "Expected " + expected + " added classes, but found " + diff.getAddedClasses().size()); + remainingFunctions.remove("assertAddedClasses"); + return this; + } + + public AssertSynDiff assertDeletedClasses(int expected) { + assertEquals(expected, diff.getDeletedClasses().size(), "Expected " + expected + " deleted classes, but found " + diff.getDeletedClasses().size()); + remainingFunctions.remove("assertDeletedClasses"); + return this; + } + + public AssertSynDiff assertMatchedClasses(int expected) { + assertEquals(expected, diff.getMatchedClasses().size(), "Expected " + expected + " matched classes, but found " + diff.getMatchedClasses().size()); + remainingFunctions.remove("assertMatchedClasses"); + return this; + } + + public AssertSynDiff assertChangedTypes(int expected) { + assertEquals(expected, diff.getChangedTypes().size(), "Expected " + expected + " changed types, but found " + diff.getChangedTypes().size()); + remainingFunctions.remove("assertChangedTypes"); + return this; + } + + public AssertSynDiff assertAddedEnums(int expected) { + assertEquals(expected, diff.getAddedEnums().size(), "Expected " + expected + " added enums, but found " + diff.getAddedEnums().size()); + remainingFunctions.remove("assertAddedEnums"); + return this; + } + + public AssertSynDiff assertDeletedEnums(int expected) { + assertEquals(expected, diff.getDeletedEnums().size(), "Expected " + expected + " deleted enums, but found " + diff.getDeletedEnums().size()); + remainingFunctions.remove("assertDeletedEnums"); + return this; + } + + public AssertSynDiff assertMatchedEnums(int expected) { + assertEquals(expected, diff.getMatchedEnums().size(), "Expected " + expected + " matched enums, but found " + diff.getMatchedEnums().size()); + remainingFunctions.remove("assertMatchedEnums"); + return this; + } + + public AssertSynDiff assertChangedAssocs(int expected) { + assertEquals(expected, diff.getChangedAssocs().size(), "Expected " + expected + " changed associations, but found " + diff.getChangedAssocs().size()); + remainingFunctions.remove("assertChangedAssocs"); + return this; + } + + public AssertSynDiff assertAddedAssocs(int expected) { + assertEquals(expected, diff.getAddedAssocs().size(), "Expected " + expected + " added associations, but found " + diff.getAddedAssocs().size()); + remainingFunctions.remove("assertAddedAssocs"); + return this; + } + + public AssertSynDiff assertDeletedAssocs(int expected) { + assertEquals(expected, diff.getDeletedAssocs().size(), "Expected " + expected + " deleted associations, but found " + diff.getDeletedAssocs().size()); + remainingFunctions.remove("assertDeletedAssocs"); + return this; + } + + public AssertSynDiff assertMatchedAssocs(int expected) { + assertEquals(expected, diff.getMatchedAssocs().size(), "Expected " + expected + " matched associations, but found " + diff.getMatchedAssocs().size()); + remainingFunctions.remove("assertMatchedAssocs"); + return this; + } + + public AssertSynDiff assertAddedInterfaces(int expected) { + assertEquals(expected, diff.getAddedInterfaces().size(), "Expected " + expected + " added interfaces, but found " + diff.getAddedInterfaces().size()); + remainingFunctions.remove("assertAddedInterfaces"); + return this; + } + + public AssertSynDiff assertDeletedInterfaces(int expected) { + assertEquals(expected, diff.getDeletedInterfaces().size(), "Expected " + expected + " deleted interfaces, but found " + diff.getDeletedInterfaces().size()); + remainingFunctions.remove("assertDeletedInterfaces"); + return this; + } + + public AssertSynDiff assertMatchedInterfaces(int expected) { + assertEquals(expected, diff.getMatchedInterfaces().size(), "Expected " + expected + " matched interfaces, but found " + diff.getMatchedInterfaces().size()); + remainingFunctions.remove("assertMatchedInterfaces"); + return this; + } + + public void assertRemainingEmpty() { + Collection> functionsToCall = new LinkedList<>(remainingFunctions.values()); + functionsToCall.forEach(func -> func.apply(0)); + } +} diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/MemberDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/MemberDiffTest.java deleted file mode 100644 index 2f17c9b65..000000000 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/MemberDiffTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* (c) https://github.com/MontiCore/monticore */ -package de.monticore.cddiff.syndiff; - -import de.monticore.ast.ASTNode; -import de.monticore.cdbasis._ast.ASTCDClass; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.util.HashSet; -import java.util.Set; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class MemberDiffTest extends SynDiffTestBasis { - - @BeforeAll - public static void init() { - SynDiffTestBasis.dir = "src/test/resources/de/monticore/cddiff/syndiff/MemberDiff/"; - } - - @Test - public void testMember1() { - parseModels("Source1.cd", "Target1.cd"); - - ASTCDClass cNew = CDTestHelper.getClass("A", src.getCDDefinition()); - ASTCDClass cOld = CDTestHelper.getClass("A", tgt.getCDDefinition()); - - Assertions.assertNotNull(cNew); - Assertions.assertNotNull(cOld); - - ASTNode attributeNew = CDTestHelper.getAttribute(cNew, "a"); - ASTNode attributeOld = CDTestHelper.getAttribute(cOld, "a"); - - CDMemberDiff attrDiff = new CDMemberDiff(attributeNew, attributeOld); - - assertEquals(new HashSet<>(attrDiff.getBaseDiff()), Set.of(DiffTypes.CHANGED_ATTRIBUTE_TYPE, DiffTypes.CHANGED_ATTRIBUTE_MODIFIER)); - } - -} diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Performance.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Performance.java deleted file mode 100644 index c53d250fb..000000000 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Performance.java +++ /dev/null @@ -1,183 +0,0 @@ -/* (c) https://github.com/MontiCore/monticore */ -package de.monticore.cddiff.syndiff; - -import static org.junit.jupiter.api.Assertions.assertNotNull; - -import de.monticore.cdbasis._ast.ASTCDCompilationUnit; -import de.monticore.cddiff.CDDiff; -import de.monticore.cddiff.CDDiffTestBasis; -import de.monticore.cddiff.alloycddiff.CDSemantics; -import de.monticore.cddiff.ow2cw.ReductionTrafo; -import de.monticore.cddiff.syn2semdiff.Syn2SemDiff; -import de.monticore.odbasis._ast.ASTODArtifact; -import java.util.List; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -public class Performance extends CDDiffTestBasis { - - @Test - @Disabled - public void test() { - String path = "src/test/resources/validation/Performance/"; - - String filePath1; - String filePath2; - for (int i = 1; i <= 5; i++) { - filePath1 = path + 5 * i + "A.cd"; - filePath2 = path + 5 * i + "B.cd"; - System.out.println("******* Test for " + 5 * i + " *******"); - - CDSemantics cdSemantics = CDSemantics.SIMPLE_CLOSED_WORLD; - ASTCDCompilationUnit ast1_old = parseModel(filePath1); - ASTCDCompilationUnit ast2_old = parseModel(filePath2); - ASTCDCompilationUnit ast1_new = parseModel(filePath1); - ASTCDCompilationUnit ast2_new = parseModel(filePath2); - assertNotNull(ast1_old); - assertNotNull(ast2_old); - assertNotNull(ast1_new); - assertNotNull(ast2_new); - - // old method - long startTime_old = System.currentTimeMillis(); // start time - List ods_old = CDDiff.computeAlloySemDiff(ast1_old, ast2_old, 5, 1, - cdSemantics); - long endTime_old = System.currentTimeMillis(); // end time - // new method - long startTime_new2 = System.currentTimeMillis(); // start time - Syn2SemDiff syn2semdiff = new Syn2SemDiff(ast1_new, ast2_new, 1, 5, false); - List witnesses = syn2semdiff.generateODs(false); - long endTime_new2 = System.currentTimeMillis(); // end time - - System.out.println("old witness size: " + ods_old.size()); - System.out.println("Runtime of old method: " + (endTime_old - startTime_old) + "ms"); - System.out.println("new witness size: " + witnesses.size()); - System.out.println("Runtime of new method: " + (endTime_new2 - startTime_new2) + "ms"); - } - } - - @Test - @Disabled - public void test10() { - String path = "src/test/resources/validation/Performance/"; - - String filePath1; - String filePath2; - for (int i = 1; i <= 5; i++) { - filePath1 = path + 5 * i + "A.cd"; - filePath2 = path + 5 * i + "B.cd"; - System.out.println("******* Test for " + 5 * i + " *******"); - - CDSemantics cdSemantics = CDSemantics.SIMPLE_CLOSED_WORLD; - ASTCDCompilationUnit ast1_old = parseModel(filePath1); - ASTCDCompilationUnit ast2_old = parseModel(filePath2); - ASTCDCompilationUnit ast1_new = parseModel(filePath1); - ASTCDCompilationUnit ast2_new = parseModel(filePath2); - assertNotNull(ast1_old); - assertNotNull(ast2_old); - assertNotNull(ast1_new); - assertNotNull(ast2_new); - - // old method - long startTime_old = System.currentTimeMillis(); // start time - List ods_old = CDDiff.computeAlloySemDiff(ast1_old, ast2_old, 10, 5, - cdSemantics); - long endTime_old = System.currentTimeMillis(); // end time - // new method - long startTime_new2 = System.currentTimeMillis(); // start time - Syn2SemDiff syn2semdiff = new Syn2SemDiff(ast1_new, ast2_new, 5, 10, false); - List witnesses = syn2semdiff.generateODs(false); - long endTime_new2 = System.currentTimeMillis(); // end time - - System.out.println("old witness size: " + ods_old.size()); - System.out.println("Runtime of old method: " + (endTime_old - startTime_old) + "ms"); - System.out.println("new witness size: " + witnesses.size()); - System.out.println("Runtime of new method: " + (endTime_new2 - startTime_new2) + "ms"); - } - } - - @Test - @Disabled - public void test15() { - String path = "src/test/resources/validation/Performance/"; - - String filePath1; - String filePath2; - for (int i = 1; i <= 5; i++) { - filePath1 = path + 5 * i + "A.cd"; - filePath2 = path + 5 * i + "B.cd"; - System.out.println("******* Test for " + 5 * i + " *******"); - - CDSemantics cdSemantics = CDSemantics.SIMPLE_CLOSED_WORLD; - ASTCDCompilationUnit ast1_old = parseModel(filePath1); - ASTCDCompilationUnit ast2_old = parseModel(filePath2); - ASTCDCompilationUnit ast1_new = parseModel(filePath1); - ASTCDCompilationUnit ast2_new = parseModel(filePath2); - assertNotNull(ast1_old); - assertNotNull(ast2_old); - assertNotNull(ast1_new); - assertNotNull(ast2_new); - - // old method - long startTime_old = System.currentTimeMillis(); // start time - List ods_old = CDDiff.computeAlloySemDiff(ast1_old, ast2_old, 15, 5, - cdSemantics); - long endTime_old = System.currentTimeMillis(); // end time - // new method - long startTime_new2 = System.currentTimeMillis(); // start time - Syn2SemDiff syn2semdiff = new Syn2SemDiff(ast1_new, ast2_new, 5, 15, false); - List witnesses = syn2semdiff.generateODs(false); - long endTime_new2 = System.currentTimeMillis(); // end time - - System.out.println("old witness size: " + ods_old.size()); - System.out.println("Runtime of old method: " + (endTime_old - startTime_old) + "ms"); - System.out.println("new witness size: " + witnesses.size()); - System.out.println("Runtime of new method: " + (endTime_new2 - startTime_new2) + "ms"); - } - } - - @Test - @Disabled - public void testOpenW() { - String path = "src/test/resources/validation/Performance/"; - - String output = "./target/runtime-test/"; - - String filePath1; - String filePath2; - for (int i = 1; i <= 5; i++) { - filePath1 = path + 5 * i + "A.cd"; - filePath2 = path + 5 * i + "B.cd"; - System.out.println("******* Test for " + 5 * i + " *******"); - - CDSemantics cdSemantics = CDSemantics.STA_OPEN_WORLD; - ASTCDCompilationUnit ast1_old = parseModel(filePath1); - ASTCDCompilationUnit ast2_old = parseModel(filePath2); - ASTCDCompilationUnit ast1_new = parseModel(filePath1); - ASTCDCompilationUnit ast2_new = parseModel(filePath2); - assertNotNull(ast1_old); - assertNotNull(ast2_old); - assertNotNull(ast1_new); - assertNotNull(ast2_new); - - // old method - long startTime_old = System.currentTimeMillis(); // start time - List ods_old = CDDiff.computeAlloySemDiff(ast1_old, ast2_old, 15, 5, - CDSemantics.STA_OPEN_WORLD); - long endTime_old = System.currentTimeMillis(); // end time - // new method - long startTime_new2 = System.currentTimeMillis(); // start time - ReductionTrafo trafo = new ReductionTrafo(); - trafo.transform(ast1_new, ast2_new); - Syn2SemDiff syn2semdiff = new Syn2SemDiff(ast1_new, ast2_new, 5, 15, true); - List witnesses = syn2semdiff.generateODs(true); - long endTime_new2 = System.currentTimeMillis(); // end time - - System.out.println("old witness size: " + ods_old.size()); - System.out.println("Runtime of old method: " + (endTime_old - startTime_old) + "ms"); - System.out.println("new witness size: " + witnesses.size()); - System.out.println("Runtime of new method: " + (endTime_new2 - startTime_new2) + "ms"); - } - } - -} diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java new file mode 100644 index 000000000..f7a0b17b8 --- /dev/null +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java @@ -0,0 +1,44 @@ +/* (c) https://github.com/MontiCore/monticore */ +package de.monticore.cddiff.syndiff; + +import de.monticore.cddiff.syn2semdiff.Syn2SemDiff; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.time.Duration; +import java.util.stream.Stream; + +public class PerformanceTest extends SynDiffTestBasis { + + @BeforeAll + public static void init() { + dir = "src/test/resources/de/monticore/cddiff/syndiff/Performance/"; + } + + public static Stream performanceData() { + return Stream.of( + Arguments.of("5/CD1.cd", "5/CD2.cd", 1), + Arguments.of("10/CD1.cd", "10/CD2.cd", 1), + Arguments.of("15/CD1.cd", "15/CD2.cd", 1), + Arguments.of("20/CD1.cd", "20/CD2.cd", 1), + Arguments.of("25/CD1.cd", "25/CD2.cd", 1), + Arguments.of("100/CD1.cd", "100/CD2.cd", 2), + Arguments.of("1000/CD1.cd", "1000/CD2.cd", 120) + ); + } + + + @ParameterizedTest + @MethodSource("performanceData") + public void testPerformance(String srcPath, String tgtPath, int timeoutSec) { + parseModels(srcPath, tgtPath); + + Duration timeout = Duration.ofSeconds(timeoutSec); + Assertions.assertTimeout(timeout, () -> new Syn2SemDiff(src, tgt)); + + } + +} diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java index d3ca9b5b1..b7b9abdc0 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java @@ -21,6 +21,7 @@ import java.util.stream.Stream; import static de.monticore.cddiff.alloycddiff.CDSemantics.SIMPLE_CLOSED_WORLD; +import static de.monticore.cddiff.alloycddiff.CDSemantics.SIMPLE_OPEN_WORLD; import static de.monticore.cddiff.alloycddiff.CDSemantics.STA_CLOSED_WORLD; import static de.monticore.cddiff.alloycddiff.CDSemantics.STA_OPEN_WORLD; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -33,32 +34,41 @@ public class Syn2SemDiffTest extends SynDiffTestBasis { public static Stream emptyWitnesses() { return Stream.of( - Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", false, false), - Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, false), - Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, false), - Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", false, false), - Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, true), - Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, true), - Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin3.cd", false, false), - Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", false, false), - Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin1.cd", true, true), - Arguments.of(cddiffDir, "Employees/Employees2.cd", "Employees/Employees1.cd", true, true), - Arguments.of(cddiffDir, "Employees/Employees8.cd", "Employees/Employees7.cd", true, true), - Arguments.of(validationDir, "cddiff/LibraryV3.cd", "cddiff/LibraryV2.cd", true, true), - Arguments.of(validationDir, "cddiff/LibraryV5.cd", "cddiff/LibraryV4.cd", true, true), - Arguments.of(validationDir, "cd4analysis/ManagementV2.cd", "cd4analysis/ManagementV1.cd", true, true), - Arguments.of(validationDir, "cd4analysis/MyCompanyV2.cd", "cd4analysis/MyCompanyV1.cd", true, true), - Arguments.of(validationDir, "cd4analysis/MyExampleV2.cd", "cd4analysis/MyExampleV1.cd", true, true) + Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", false, false), + Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, false), + Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, false), + Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", false, false), + Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, true), + Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, true), + Arguments.of(cddiffDir, "syndiff/TypeDiff/ChangedAttribute/CD71.cd", "syndiff/TypeDiff/ChangedAttribute/CD71.cd", false, false), + Arguments.of(cddiffDir, "syndiff/TypeDiff/ChangedAttribute/CD71.cd", "syndiff/TypeDiff/ChangedAttribute/CD71.cd", false, true), + Arguments.of(cddiffDir, "syndiff/TypeDiff/RemovedAttributeNoDiff/CD21.cd", "syndiff/TypeDiff/RemovedAttributeNoDiff/CD22.cd", false, false), + Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MaCoCo_v2.cd", "syndiff/SyntaxDiff/MaCoCo_v1.cd", false, false), + Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin3.cd", false, false), + Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", false, false), + Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin1.cd", true, true), + Arguments.of(cddiffDir, "Employees/Employees2.cd", "Employees/Employees1.cd", true, true), + Arguments.of(cddiffDir, "Employees/Employees2.cd", "Employees/Employees1.cd", false, true), + Arguments.of(cddiffDir, "Employees/Employees8.cd", "Employees/Employees7.cd", true, true), + Arguments.of(validationDir, "cddiff/LibraryV3.cd", "cddiff/LibraryV2.cd", true, true), + Arguments.of(validationDir, "cddiff/LibraryV5.cd", "cddiff/LibraryV4.cd", true, true), + Arguments.of(validationDir, "cd4analysis/ManagementV2.cd", "cd4analysis/ManagementV1.cd", true, true), + Arguments.of(validationDir, "cd4analysis/MyCompanyV2.cd", "cd4analysis/MyCompanyV1.cd", true, true), + Arguments.of(validationDir, "cd4analysis/MyExampleV2.cd", "cd4analysis/MyExampleV1.cd", true, true), + Arguments.of(validationDir, "cd4analysis/MyExampleV1.cd", "cd4analysis/MyExampleV2.cd", true, true), + Arguments.of(validationDir, "cd4analysis/ManagementV2.cd", "cd4analysis/ManagementV1.cd", true, false), + Arguments.of(validationDir, "cd4analysis/MyExampleV2.cd", "cd4analysis/MyExampleV1.cd", true, false), + Arguments.of(validationDir, "cd4analysis/MyExampleV1.cd", "cd4analysis/MyExampleV2.cd", true, false) ); } @ParameterizedTest @MethodSource("emptyWitnesses") - public void testEmptyWitnesses(String baseDir, String srcPath, String tgtPath, boolean staDiff, boolean reduction ) { + public void testEmptyWitnesses(String baseDir, String srcPath, String tgtPath, boolean staDiff, boolean reduction) { dir = baseDir; parseModels(srcPath, tgtPath); - if(reduction){ + if (reduction) { ReductionTrafo trafo = new ReductionTrafo(); trafo.transform(src, tgt); } @@ -72,16 +82,38 @@ public void testEmptyWitnesses(String baseDir, String srcPath, String tgtPath, b public static Stream witnesses() { return Stream.of( //Arguments.of("syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", SIMPLE_CLOSED_WORLD, true), + //Arguments.of(validationDir, "cddiff/LibraryV5.cd", "cddiff/LibraryV4.cd", STA_CLOSED_WORLD, false), + //Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd", SIMPLE_CLOSED_WORLD, true), Arguments.of(cddiffDir, "syndiff/SyntaxDiff/AddedDeletedAssocs/CD31.cd", "syndiff/SyntaxDiff/AddedDeletedAssocs/CD32.cd", SIMPLE_CLOSED_WORLD, false), Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", SIMPLE_CLOSED_WORLD, true), + Arguments.of(cddiffDir, "syndiff/TypeDiff/DeletedAttribute/CD11.cd", "syndiff/TypeDiff/DeletedAttribute/CD12.cd", SIMPLE_CLOSED_WORLD, false), + Arguments.of(cddiffDir, "syndiff/TypeDiff/DeletedAttribute/CD11.cd", "syndiff/TypeDiff/DeletedAttribute/CD12.cd", SIMPLE_CLOSED_WORLD, true), + Arguments.of(cddiffDir, "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD31.cd", "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD32.cd", SIMPLE_CLOSED_WORLD, false), + Arguments.of(cddiffDir, "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD31.cd", "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD32.cd", SIMPLE_CLOSED_WORLD, true), + Arguments.of(cddiffDir, "syndiff/TypeDiff/RemovedAttributeNoDiff/CD21.cd", "syndiff/TypeDiff/RemovedAttributeNoDiff/CD22.cd", SIMPLE_CLOSED_WORLD, true), + Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MaCoCo_v1.cd", "syndiff/SyntaxDiff/MaCoCo_v2.cd", SIMPLE_CLOSED_WORLD, false), Arguments.of(cddiffDir, "syndiff/SyntaxDiff/SS1.cd", "syndiff/SyntaxDiff/SS2.cd", SIMPLE_CLOSED_WORLD, false), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin1.cd", SIMPLE_CLOSED_WORLD, false), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin1.cd", "DigitalTwins/DigitalTwin2.cd", SIMPLE_CLOSED_WORLD, true), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin3.cd", SIMPLE_CLOSED_WORLD, true), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", SIMPLE_CLOSED_WORLD, true), + Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin1.cd", SIMPLE_OPEN_WORLD, false), + Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin1.cd", "DigitalTwins/DigitalTwin2.cd", SIMPLE_OPEN_WORLD, true), + Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin3.cd", SIMPLE_OPEN_WORLD, true), + Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", SIMPLE_OPEN_WORLD, true), Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd", SIMPLE_CLOSED_WORLD, false), Arguments.of(cddiffDir, "Employees/Employees2.cd", "Employees/Employees1.cd", SIMPLE_CLOSED_WORLD, false), - Arguments.of(cddiffDir, "Employees/Employees7.cd", "Employees/Employees8.cd", STA_CLOSED_WORLD, true) + Arguments.of(cddiffDir, "Employees/Employees7.cd", "Employees/Employees8.cd", STA_CLOSED_WORLD, true), + Arguments.of(cddiffDir, "Employees/Employees7.cd", "Employees/Employees8.cd", STA_CLOSED_WORLD, false), + Arguments.of(cddiffDir, "Employees/Employees8.cd", "Employees/Employees7.cd", STA_CLOSED_WORLD, false), + Arguments.of(validationDir, "cddiff/LibraryV2.cd", "cddiff/LibraryV3.cd", STA_CLOSED_WORLD, true), + Arguments.of(validationDir, "cddiff/LibraryV4.cd", "cddiff/LibraryV5.cd", STA_CLOSED_WORLD, true), + Arguments.of(validationDir, "cddiff/LibraryV3.cd", "cddiff/LibraryV2.cd", STA_CLOSED_WORLD, false), + Arguments.of(validationDir, "cddiff/LibraryV2.cd", "cddiff/LibraryV3.cd", STA_CLOSED_WORLD, false), + Arguments.of(validationDir, "cddiff/LibraryV4.cd", "cddiff/LibraryV5.cd", STA_CLOSED_WORLD, false), + Arguments.of(validationDir, "cd4analysis/ManagementV1.cd", "cd4analysis/ManagementV2.cd", STA_CLOSED_WORLD, true), + Arguments.of(validationDir, "cd4analysis/MyCompanyV1.cd", "cd4analysis/MyCompanyV2.cd", STA_CLOSED_WORLD, true), + Arguments.of(validationDir, "cd4analysis/MyCompanyV2.cd", "cd4analysis/MyCompanyV1.cd", STA_CLOSED_WORLD, false) ); } @@ -91,7 +123,7 @@ public void testWitnesses(String baseDir, String srcPath, String tgtPath, CDSema dir = baseDir; parseModels(srcPath, tgtPath); - if(reduction){ + if (reduction) { ReductionTrafo trafo = new ReductionTrafo(); trafo.transform(src, tgt); } @@ -106,19 +138,23 @@ public void testWitnesses(String baseDir, String srcPath, String tgtPath, CDSema public static Stream witnessesReduction() { return Stream.of( - Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd"), - Arguments.of(validationDir, "Performance/5A.cd", "Performance/5B.cd"), - Arguments.of(validationDir, "Performance/10A.cd", "Performance/10B.cd"), - Arguments.of(validationDir, "Performance/15A.cd", "Performance/15B.cd"), - Arguments.of(validationDir, "Performance/20A.cd", "Performance/20B.cd"), - Arguments.of(validationDir, "Performance/25A.cd", "Performance/25B.cd"), - Arguments.of(validationDir, "cddiff/DEv2.cd", "cddiff/DEv1.cd"), - Arguments.of(validationDir, "cddiff/EAv2.cd", "cddiff/EAv1.cd"), - Arguments.of(validationDir, "cddiff/EMTv1.cd", "cddiff/EMTv2.cd"), - Arguments.of(validationDir, "cddiff/LibraryV2.cd", "cddiff/LibraryV1.cd"), - Arguments.of(validationDir, "cddiff/LibraryV4.cd", "cddiff/LibraryV3.cd"), - Arguments.of(validationDir, "cd4analysis/MyLifeV2.cd", "cd4analysis/MyLifeV1.cd"), - Arguments.of(validationDir, "cd4analysis/TeachingV2.cd", "cd4analysis/TeachingV1.cd") +// Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd"), + Arguments.of(validationDir, "Performance/5A.cd", "Performance/5B.cd"), + Arguments.of(validationDir, "Performance/10A.cd", "Performance/10B.cd"), + Arguments.of(validationDir, "Performance/15A.cd", "Performance/15B.cd"), + Arguments.of(validationDir, "Performance/20A.cd", "Performance/20B.cd"), + Arguments.of(validationDir, "Performance/25A.cd", "Performance/25B.cd"), + Arguments.of(validationDir, "cddiff/DEv2.cd", "cddiff/DEv1.cd"), + Arguments.of(validationDir, "cddiff/EAv2.cd", "cddiff/EAv1.cd"), + Arguments.of(validationDir, "cddiff/EMTv1.cd", "cddiff/EMTv2.cd"), + Arguments.of(validationDir, "cddiff/LibraryV2.cd", "cddiff/LibraryV1.cd"), + Arguments.of(validationDir, "cddiff/LibraryV4.cd", "cddiff/LibraryV3.cd"), + Arguments.of(validationDir, "cd4analysis/MyLifeV2.cd", "cd4analysis/MyLifeV1.cd"), + Arguments.of(validationDir, "cd4analysis/TeachingV2.cd", "cd4analysis/TeachingV1.cd"), + Arguments.of(cddiffDir, "Employees/Employees7.cd", "Employees/Employees8.cd"), + Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd"), + Arguments.of(cddiffDir, "Employees/Employees7.cd", "Employees/Employees8.cd"), + Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd") ); } diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/SynAssocDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SynAssocDiffTest.java index 57689be7c..caf450abe 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/SynAssocDiffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SynAssocDiffTest.java @@ -23,12 +23,14 @@ public void testAssoc1() { CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - assertEquals(1, synDiff.getChangedAssocs().size()); - assertEquals(1, synDiff.getAddedAssocs().size()); - assertEquals(1, synDiff.getDeletedAssocs().size()); - assertEquals(1, synDiff.getAddedClasses().size()); - assertEquals(3, synDiff.getMatchedClasses().size()); - assertEquals(1, synDiff.getMatchedAssocs().size()); + new AssertSynDiff(synDiff) + .assertAddedClasses(1) + .assertMatchedClasses(3) + .assertAddedAssocs(1) + .assertDeletedAssocs(1) + .assertChangedAssocs(1) + .assertMatchedAssocs(1) + .assertRemainingEmpty(); // Check that no other diffs exist Map expectedDiffTypes = new HashMap<>(); @@ -47,9 +49,11 @@ public void testAssoc2() { CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - assertEquals(1, synDiff.getChangedAssocs().size()); - assertEquals(1, synDiff.getMatchedAssocs().size()); - assertEquals(3, synDiff.getMatchedClasses().size()); + new AssertSynDiff(synDiff) + .assertMatchedClasses(3) + .assertChangedAssocs(1) + .assertMatchedAssocs(1) + .assertRemainingEmpty(); Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_CARDINALITY, 1L); @@ -64,10 +68,12 @@ public void testAssoc3() { CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - assertEquals(2, synDiff.getChangedTypes().size()); - assertEquals(3, synDiff.getChangedAssocs().size()); - assertEquals(3, synDiff.getMatchedAssocs().size()); - assertEquals(4, synDiff.getMatchedClasses().size()); + new AssertSynDiff(synDiff) + .assertMatchedClasses(4) + .assertChangedTypes(2) + .assertChangedAssocs(3) + .assertMatchedAssocs(3) + .assertRemainingEmpty(); Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_CARDINALITY, 3L); @@ -85,10 +91,11 @@ public void testAssoc4() { CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - assertEquals(4, synDiff.getAddedAssocs().size()); - assertEquals(4, synDiff.getDeletedAssocs().size()); - assertEquals(0, synDiff.getMatchedAssocs().size()); - assertEquals(4, synDiff.getMatchedClasses().size()); + new AssertSynDiff(synDiff) + .assertMatchedClasses(4) + .assertAddedAssocs(4) + .assertDeletedAssocs(4) + .assertRemainingEmpty(); Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.ADDED_ASSOCIATION, 1L); @@ -102,9 +109,11 @@ public void testAssoc5() { parseModels("Source5.cd", "Target5.cd"); CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - assertEquals(1, synDiff.getChangedAssocs().size()); - assertEquals(1, synDiff.getMatchedAssocs().size()); - assertEquals(2, synDiff.getMatchedClasses().size()); + new AssertSynDiff(synDiff) + .assertMatchedClasses(2) + .assertChangedAssocs(1) + .assertMatchedAssocs(1) + .assertRemainingEmpty(); Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_CARDINALITY, 1L); diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java index d7c53dcc2..a34cc4e05 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java @@ -1,55 +1,73 @@ /* (c) https://github.com/MontiCore/monticore */ package de.monticore.cddiff.syndiff; +import de.monticore.ast.ASTNode; import de.monticore.cd4code.CD4CodeMill; +import de.monticore.cdbasis._ast.ASTCDClass; import de.monticore.cdbasis._ast.ASTCDCompilationUnit; import de.monticore.cdconformance.CDConfParameter; import de.monticore.cdconformance.CDConformanceChecker; -import de.monticore.cddiff.CDDiffTestBasis; import de.monticore.cddiff.CDDiffUtil; import de.monticore.cddiff.alloycddiff.CDSemantics; import de.monticore.cddiff.syn2semdiff.Syn2SemDiff; import de.monticore.odbasis._ast.ASTODArtifact; import de.monticore.odvalidity.OD2CDMatcher; -import de.se_rwth.commons.logging.Log; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; -import java.util.function.Function; -import java.util.stream.Collectors; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -public class SyntaxDiffTest extends CDDiffTestBasis { +public class SyntaxDiffTest extends SynDiffTestBasis { - /*--------------------------------------------------------------------*/ - // Syntax Diff Tests + @BeforeAll + public static void init() { + dir = "src/test/resources/de/monticore/cddiff/"; + } + + @Test + public void testMember1() { + parseModels("syndiff/MemberDiff/Source1.cd", "syndiff/MemberDiff/Target1.cd"); + + ASTCDClass cNew = CDTestHelper.getClass("A", src.getCDDefinition()); + ASTCDClass cOld = CDTestHelper.getClass("A", tgt.getCDDefinition()); + + Assertions.assertNotNull(cNew); + Assertions.assertNotNull(cOld); + + ASTNode attributeNew = CDTestHelper.getAttribute(cNew, "a"); + ASTNode attributeOld = CDTestHelper.getAttribute(cOld, "a"); + + CDMemberDiff attrDiff = new CDMemberDiff(attributeNew, attributeOld); - public static final String dir = "src/test/resources/de/monticore/cddiff/syndiff/SyntaxDiff/"; - protected ASTCDCompilationUnit tgt; - protected ASTCDCompilationUnit src; + assertEquals(new HashSet<>(attrDiff.getBaseDiff()), Set.of(DiffTypes.CHANGED_ATTRIBUTE_TYPE, DiffTypes.CHANGED_ATTRIBUTE_MODIFIER)); + } @Test public void testDTs() { - ASTCDCompilationUnit compilationUnitNew = parseModel( - "src/test/resources/de/monticore/cddiff/DigitalTwins/DigitalTwin3.cd"); - ASTCDCompilationUnit compilationUnitOld = parseModel( - "src/test/resources/de/monticore/cddiff/DigitalTwins/DigitalTwin1.cd"); - - CDSyntaxDiff synDiff = new CDSyntaxDiff(compilationUnitNew, compilationUnitOld, List.of()); - assertEquals(4, synDiff.getAddedClasses().size()); - assertEquals(2, synDiff.getAddedAssocs().size()); - assertEquals(3, synDiff.getChangedAssocs().size()); - assertEquals(4, synDiff.getMatchedClasses().size()); - assertEquals(3, synDiff.getMatchedAssocs().size()); + parseModels("DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin1.cd"); + + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); + + new AssertSynDiff(synDiff) + .assertAddedClasses(4) + .assertMatchedClasses(4) + .assertAddedAssocs(2) + .assertChangedAssocs(3) + .assertMatchedAssocs(3) + .assertChangedTypes(2) + .assertRemainingEmpty(); Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.ADDED_CLASS, 1L); @@ -65,37 +83,29 @@ public void testDTs() { @Test public void testSyntaxDiff1() { - parseModels("Source1.cd", "Target1.cd"); + parseModels("syndiff/SyntaxDiff/Source1.cd", "syndiff/SyntaxDiff/Target1.cd"); CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - SyntaxDiffPrinter sb = new SyntaxDiffPrinter(synDiff); - Log.println(sb.printDiff()); - - // check added / deleted classes - assertEquals(2, synDiff.getAddedClasses().size()); - assertEquals(2, synDiff.getDeletedClasses().size()); - - // check added / deleted enums - assertEquals(1, synDiff.getAddedEnums().size()); - assertEquals(1, synDiff.getDeletedEnums().size()); - - // check changed types - assertEquals(4, synDiff.getChangedTypes().size()); - // check associations - assertEquals(2, synDiff.getChangedAssocs().size()); - assertEquals(2, synDiff.getAddedAssocs().size()); - assertEquals(2, synDiff.getDeletedAssocs().size()); - - // check no changes - assertTrue(synDiff.getAddedInterfaces().isEmpty()); - assertTrue(synDiff.getDeletedInterfaces().isEmpty()); + new AssertSynDiff(synDiff) + .assertAddedClasses(1) + .assertDeletedClasses(1) + .assertMatchedClasses(3) + .assertChangedTypes(5) + .assertAddedAssocs(2) + .assertDeletedAssocs(2) + .assertChangedAssocs(2) + .assertMatchedAssocs(2) + .assertAddedEnums(1) + .assertDeletedEnums(1) + .assertMatchedEnums(1) + .assertRemainingEmpty(); Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); expectedDiffTypes.put(DiffTypes.DELETED_ENUM, 1L); expectedDiffTypes.put(DiffTypes.DELETED_INHERITANCE, 1L); - expectedDiffTypes.put(DiffTypes.DELETED_ATTRIBUTE, 2L); + expectedDiffTypes.put(DiffTypes.DELETED_ATTRIBUTE, 3L); expectedDiffTypes.put(DiffTypes.DELETED_CLASS, 1L); expectedDiffTypes.put(DiffTypes.DELETED_CONSTANT, 1L); expectedDiffTypes.put(DiffTypes.ADDED_ASSOCIATION, 1L); @@ -105,9 +115,9 @@ public void testSyntaxDiff1() { expectedDiffTypes.put(DiffTypes.ADDED_CLASS, 1L); expectedDiffTypes.put(DiffTypes.ADDED_CONSTANT, 1L); expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_NAME, 1L); - expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_ROLE, 1L); expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_CARDINALITY, 2L); expectedDiffTypes.put(DiffTypes.CHANGED_ATTRIBUTE_TYPE, 1L); + expectedDiffTypes.put(DiffTypes.CHANGED_CLASS_NAME, 1L); expectedDiffTypes.put(DiffTypes.CHANGED_CLASS_MODIFIER, 1L); expectedDiffTypes.put(DiffTypes.INHERITED_ATTRIBUTE, 1L); @@ -116,27 +126,21 @@ public void testSyntaxDiff1() { @Test public void testSyntaxDiff2() { - parseModels("Source2.cd", "Target2.cd"); + parseModels("syndiff/SyntaxDiff/Source2.cd", "syndiff/SyntaxDiff/Target2.cd"); CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - SyntaxDiffPrinter sb = new SyntaxDiffPrinter(synDiff); - Log.println(sb.printDiff()); - - // check changes - assertEquals(2, synDiff.getAddedClasses().size()); - assertEquals(2, synDiff.getDeletedClasses().size()); - - assertEquals(1, synDiff.getAddedEnums().size()); - assertEquals(1, synDiff.getDeletedEnums().size()); - assertEquals(1, synDiff.getAddedAssocs().size()); - assertEquals(1, synDiff.getDeletedAssocs().size()); - - // check no changes - assertTrue(synDiff.getAddedInterfaces().isEmpty()); - assertTrue(synDiff.getDeletedInterfaces().isEmpty()); - assertTrue(synDiff.getChangedTypes().isEmpty()); - assertTrue(synDiff.getChangedAssocs().isEmpty()); + new AssertSynDiff(synDiff) + .assertAddedClasses(2) + .assertDeletedClasses(2) + .assertMatchedClasses(2) + .assertAddedAssocs(1) + .assertDeletedAssocs(1) + .assertMatchedAssocs(1) + .assertAddedEnums(1) + .assertDeletedEnums(1) + .assertMatchedEnums(1) + .assertRemainingEmpty(); Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.ADDED_CLASS, 1L); @@ -153,25 +157,21 @@ public void testSyntaxDiff2() { @Test public void testSyntaxDiff3() { - parseModels("TechStoreV2.cd", "TechStoreV1.cd"); + parseModels("syndiff/SyntaxDiff/TechStoreV2.cd", "syndiff/SyntaxDiff/TechStoreV1.cd"); CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - SyntaxDiffPrinter sb = new SyntaxDiffPrinter(synDiff); - Log.println(sb.printDiff()); - - assertEquals(2, synDiff.getDeletedClasses().size()); - assertEquals(3, synDiff.getChangedTypes().size()); - assertEquals(5, synDiff.getChangedAssocs().size()); - assertEquals(4, synDiff.getAddedAssocs().size()); - assertEquals(2, synDiff.getDeletedAssocs().size()); + new AssertSynDiff(synDiff) + .assertDeletedClasses(2) + .assertMatchedClasses(11) + .assertChangedTypes(3) + .assertAddedAssocs(4) + .assertDeletedAssocs(2) + .assertChangedAssocs(5) + .assertMatchedAssocs(6) + .assertMatchedEnums(1) + .assertRemainingEmpty(); - // check no changes - assertTrue(synDiff.getAddedClasses().isEmpty()); - assertTrue(synDiff.getAddedInterfaces().isEmpty()); - assertTrue(synDiff.getDeletedInterfaces().isEmpty()); - assertTrue(synDiff.getAddedEnums().isEmpty()); - assertTrue(synDiff.getDeletedEnums().isEmpty()); Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); @@ -194,24 +194,14 @@ public void testSyntaxDiff3() { @Test public void testSyntaxDiff4() { - parseModels("TechStoreV9.cd", "TechStoreV10.cd"); + parseModels("syndiff/SyntaxDiff/TechStoreV9.cd", "syndiff/SyntaxDiff/TechStoreV10.cd"); CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - SyntaxDiffPrinter sb = new SyntaxDiffPrinter(synDiff); - Log.println(sb.printDiff()); - - // check changes - assertEquals(1, synDiff.getDeletedAssocs().size()); - - // check no changes - assertTrue(synDiff.getAddedClasses().isEmpty()); - assertTrue(synDiff.getAddedInterfaces().isEmpty()); - assertTrue(synDiff.getDeletedInterfaces().isEmpty()); - assertTrue(synDiff.getAddedEnums().isEmpty()); - assertTrue(synDiff.getDeletedEnums().isEmpty()); - assertTrue(synDiff.getChangedTypes().isEmpty()); - assertTrue(synDiff.getChangedAssocs().isEmpty()); - assertTrue(synDiff.getAddedAssocs().isEmpty()); + + new AssertSynDiff(synDiff) + .assertMatchedClasses(2) + .assertDeletedAssocs(1) + .assertRemainingEmpty(); Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); @@ -221,24 +211,14 @@ public void testSyntaxDiff4() { @Test public void testSyntaxDiff5() { - parseModels("TechStoreV11.cd", "TechStoreV12.cd"); + parseModels("syndiff/SyntaxDiff/TechStoreV11.cd", "syndiff/SyntaxDiff/TechStoreV12.cd"); CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - SyntaxDiffPrinter sb = new SyntaxDiffPrinter(synDiff); - Log.println(sb.printDiff()); - - // check changes - assertEquals(3, synDiff.getChangedTypes().size()); - - // check no changes - assertTrue(synDiff.getAddedClasses().isEmpty()); - assertTrue(synDiff.getAddedInterfaces().isEmpty()); - assertTrue(synDiff.getDeletedInterfaces().isEmpty()); - assertTrue(synDiff.getAddedEnums().isEmpty()); - assertTrue(synDiff.getDeletedEnums().isEmpty()); - assertTrue(synDiff.getChangedAssocs().isEmpty()); - assertTrue(synDiff.getAddedAssocs().isEmpty()); - assertTrue(synDiff.getDeletedAssocs().isEmpty()); + + new AssertSynDiff(synDiff) + .assertChangedTypes(3) + .assertMatchedClasses(3) + .assertRemainingEmpty(); Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.ADDED_ATTRIBUTE, 1L); @@ -250,23 +230,18 @@ public void testSyntaxDiff5() { @Test public void testMaCoCo() { CDDiffUtil.setUseJavaTypes(true); - parseModels("MaCoCo_v1.cd", "MaCoCo_v2.cd"); + parseMaCoCo("syndiff/SyntaxDiff/MaCoCo_v1.cd", "syndiff/SyntaxDiff/MaCoCo_v2.cd"); CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - SyntaxDiffPrinter sb = new SyntaxDiffPrinter(synDiff); - Log.println(sb.printDiff()); - - assertEquals(1, synDiff.getAddedClasses().size()); - assertEquals(1, synDiff.getAddedEnums().size()); - assertEquals(1, synDiff.getAddedAssocs().size()); - assertTrue(synDiff.getDeletedClasses().isEmpty()); - assertTrue(synDiff.getAddedInterfaces().isEmpty()); - assertTrue(synDiff.getDeletedInterfaces().isEmpty()); - assertTrue(synDiff.getDeletedEnums().isEmpty()); - assertTrue(synDiff.getChangedTypes().isEmpty()); - assertTrue(synDiff.getChangedAssocs().isEmpty()); - assertTrue(synDiff.getDeletedAssocs().isEmpty()); + new AssertSynDiff(synDiff) + .assertAddedClasses(1) + .assertAddedEnums(1) + .assertAddedAssocs(1) + .assertMatchedAssocs(91) + .assertMatchedClasses(94) + .assertMatchedEnums(45) + .assertRemainingEmpty(); Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.ADDED_CLASS, 1L); @@ -293,19 +268,14 @@ public void testMaCoCo() { CDSemantics.SIMPLE_CLOSED_WORLD, src, tgt, od))); synDiff = new CDSyntaxDiff(tgt, src, List.of()); - sb = new SyntaxDiffPrinter(synDiff); - Log.println(sb.printDiff()); - assertEquals(1, synDiff.getDeletedClasses().size()); - assertEquals(1, synDiff.getDeletedEnums().size()); - assertEquals(1, synDiff.getDeletedAssocs().size()); - - assertTrue(synDiff.getAddedClasses().isEmpty()); - assertTrue(synDiff.getAddedInterfaces().isEmpty()); - assertTrue(synDiff.getDeletedInterfaces().isEmpty()); - assertTrue(synDiff.getAddedEnums().isEmpty()); - assertTrue(synDiff.getChangedTypes().isEmpty()); - assertTrue(synDiff.getChangedAssocs().isEmpty()); - assertTrue(synDiff.getAddedAssocs().isEmpty()); + new AssertSynDiff(synDiff) + .assertDeletedClasses(1) + .assertDeletedEnums(1) + .assertDeletedAssocs(1) + .assertMatchedAssocs(91) + .assertMatchedClasses(94) + .assertMatchedEnums(45) + .assertRemainingEmpty(); expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.DELETED_CLASS, 1L); @@ -329,33 +299,22 @@ public void testMaCoCo() { assertTrue(ods.isEmpty()); } - public void parseModels(String concrete, String ref) { + public void parseMaCoCo(String concrete, String ref) { try { Optional src = CD4CodeMill.parser().parseCDCompilationUnit(dir - + concrete); + + concrete); Optional tgt = CD4CodeMill.parser().parseCDCompilationUnit(dir + ref); if (src.isPresent() && tgt.isPresent()) { CDDiffUtil.refreshSymbolTable(src.get()); CDDiffUtil.refreshSymbolTable(tgt.get()); this.tgt = tgt.get(); this.src = src.get(); - } - else { - fail("Could not parse CDs."); + } else { + fail(String.format("Parsing src: '%s', tgt: '%s'.", src.isPresent() ? "success" : "failure", tgt.isPresent() ? "success" : "failure")); } - } - catch (IOException e) { + } catch (IOException e) { fail(e.getMessage()); } } - - private Map getDiffTypesCount(CDSyntaxDiff synDiff) { - return synDiff.getBaseDiff().stream().collect( - Collectors.groupingBy( - Function.identity(), - Collectors.counting() - ) - ); - } } diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/TypeDIffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/TypeDIffTest.java deleted file mode 100644 index 71a899bb4..000000000 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/TypeDIffTest.java +++ /dev/null @@ -1,241 +0,0 @@ -/* (c) https://github.com/MontiCore/monticore */ -package de.monticore.cddiff.syndiff; - -import de.monticore.cd4code.CD4CodeMill; -import de.monticore.cd4code._prettyprint.CD4CodeFullPrettyPrinter; -import de.monticore.cd4code._symboltable.CD4CodeSymbolTableCompleter; -import de.monticore.cdbasis._ast.ASTCDClass; -import de.monticore.cdbasis._ast.ASTCDCompilationUnit; -import de.monticore.cddiff.CDDiffTestBasis; -import de.monticore.cddiff.CDDiffUtil; -import de.monticore.cddiff.alloycddiff.CDSemantics; -import de.monticore.cddiff.syn2semdiff.Syn2SemDiff; -import de.monticore.od4report._prettyprint.OD4ReportFullPrettyPrinter; -import de.monticore.odbasis._ast.ASTODArtifact; -import de.monticore.odvalidity.OD2CDMatcher; -import de.monticore.prettyprint.IndentPrinter; -import de.se_rwth.commons.logging.Log; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import java.io.IOException; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.function.Function; -import java.util.stream.Collectors; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.fail; - -public class TypeDIffTest extends CDDiffTestBasis { - - @Test - public void testCD2() { - - ASTCDCompilationUnit compilationUnitNew = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/RemovedAttributeNoDiff/CD21.cd"); - ASTCDCompilationUnit compilationUnitOld = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/RemovedAttributeNoDiff/CD22.cd"); - - Syn2SemDiff syn2semdiff = new Syn2SemDiff(compilationUnitNew, compilationUnitOld); - List witnesses = syn2semdiff.generateODs(false); - - Assertions.assertTrue(witnesses.isEmpty()); - } - - @Test - public void testCD1() { - - ASTCDCompilationUnit compilationUnitNew = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/DeletedAttribute/CD11.cd"); - ASTCDCompilationUnit compilationUnitOld = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/DeletedAttribute/CD12.cd"); - - Syn2SemDiff syn2semdiff = new Syn2SemDiff(compilationUnitNew, compilationUnitOld); - List witnesses = syn2semdiff.generateODs(false); - - Assertions.assertFalse(witnesses.isEmpty()); - - for (ASTODArtifact od : witnesses) { - if (!new OD2CDMatcher().checkIfDiffWitness(CDSemantics.SIMPLE_CLOSED_WORLD, - compilationUnitNew, compilationUnitOld, od)) { - Log.println(new OD4ReportFullPrettyPrinter(new IndentPrinter()).prettyprint(od)); - fail(); - } - } - } - - @Test - public void testCD3() { - ASTCDCompilationUnit compilationUnitNew = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/RemovedAddedAttributeDiff/CD31.cd"); - ASTCDCompilationUnit compilationUnitOld = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/RemovedAddedAttributeDiff/CD32.cd"); - - Syn2SemDiff syn2semdiff = new Syn2SemDiff(compilationUnitNew, compilationUnitOld); - List witnesses = syn2semdiff.generateODs(false); - - Assertions.assertFalse(witnesses.isEmpty()); - - for (ASTODArtifact od : witnesses) { - if (!new OD2CDMatcher().checkIfDiffWitness(CDSemantics.SIMPLE_CLOSED_WORLD, - compilationUnitNew, compilationUnitOld, od)) { - Log.println(new OD4ReportFullPrettyPrinter(new IndentPrinter()).prettyprint(od)); - fail(); - } - } - } - - @Test - public void testCD7() { - - ASTCDCompilationUnit compilationUnitNew = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/ChangedAttribute/CD71.cd"); - ASTCDCompilationUnit compilationUnitOld = parseModel( - "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/ChangedAttribute/CD72.cd"); - - Syn2SemDiff syn2semdiff = new Syn2SemDiff(compilationUnitNew, compilationUnitOld); - List witnesses = syn2semdiff.generateODs(false); - - Assertions.assertFalse(witnesses.isEmpty()); - - for (ASTODArtifact od : witnesses) { - if (!new OD2CDMatcher().checkIfDiffWitness(CDSemantics.SIMPLE_CLOSED_WORLD, - compilationUnitNew, compilationUnitOld, od)) { - Log.println(new OD4ReportFullPrettyPrinter(new IndentPrinter()).prettyprint(od)); - fail(); - } - } - } - - /*--------------------------------------------------------------------*/ - // Syntax Diff Tests - - public static final String dir = "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/"; - protected ASTCDCompilationUnit tgt; - protected ASTCDCompilationUnit src; - - // Test for all kinds of changes in attributes - @Test - public void testType1() { - parseModels("Source1.cd", "Target1.cd"); - - CDDiffUtil.refreshSymbolTable(src); - CDDiffUtil.refreshSymbolTable(tgt); - - CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - - assertEquals(3, synDiff.getMatchedClasses().size()); - assertEquals(1, synDiff.getMatchedEnums().size()); - assertEquals(4, synDiff.getChangedTypes().size()); - assertEquals(1, synDiff.getAddedClasses().size()); - assertEquals(1, synDiff.getAddedEnums().size()); - assertEquals(1, synDiff.getDeletedClasses().size()); - assertEquals(1, synDiff.getDeletedEnums().size()); - assertEquals(1, synDiff.getAddedAssocs().size()); - assertEquals(2, synDiff.getDeletedAssocs().size()); - } - - // Tests for all kinds of changes in enum constants - @Test - public void testType2() { - parseModels("Source2.cd", "Target2.cd"); - CD4CodeFullPrettyPrinter pp = new CD4CodeFullPrettyPrinter(new IndentPrinter()); - ASTCDClass astcdClass11 = CDTestHelper.getClass("A", src.getCDDefinition()); - ASTCDClass astcdClass12 = CDTestHelper.getClass("A", tgt.getCDDefinition()); - ASTCDClass astcdClass21 = CDTestHelper.getClass("B", src.getCDDefinition()); - ASTCDClass astcdClass22 = CDTestHelper.getClass("B", tgt.getCDDefinition()); - CDDiffUtil.refreshSymbolTable(src); - CDDiffUtil.refreshSymbolTable(tgt); - - CDSyntaxDiff diff = new CDSyntaxDiff(src, tgt, List.of()); - CDTypeDiff typeDiff1 = new CDTypeDiff(astcdClass11, astcdClass12, tgt, src, diff.getHelper()); - CDTypeDiff typeDiff2 = new CDTypeDiff(astcdClass21, astcdClass22, tgt, src, diff.getHelper()); - - // System.out.println(diff.printOnlyAdded()); - - /*System.out.println(typeDiff1.printSrcCD()); - System.out.println(typeDiff2.printSrcCD()); - System.out.println("--------------------------------"); - System.out.println(typeDiff1.printTgtCD()); - System.out.println(typeDiff2.printTgtCD());*/ - } - - // Test for change of modifiers, extensions, and implementations - @Test - public void testType3() { - parseModels("Source3.cd", "Target3.cd"); - - ASTCDClass astcdClass11 = CDTestHelper.getClass("A", src.getCDDefinition()); - ASTCDClass astcdClass12 = CDTestHelper.getClass("A", tgt.getCDDefinition()); - ASTCDClass astcdClass21 = CDTestHelper.getClass("B", src.getCDDefinition()); - ASTCDClass astcdClass22 = CDTestHelper.getClass("B", tgt.getCDDefinition()); - ASTCDClass astcdClass31 = CDTestHelper.getClass("C", src.getCDDefinition()); - ASTCDClass astcdClass32 = CDTestHelper.getClass("C", tgt.getCDDefinition()); - - CDSyntaxDiff diff = new CDSyntaxDiff(src, tgt, List.of()); - - CDTypeDiff typeDiff1 = new CDTypeDiff(astcdClass11, astcdClass12, tgt, src, diff.getHelper()); - CDTypeDiff typeDiff2 = new CDTypeDiff(astcdClass21, astcdClass22, tgt, src, diff.getHelper()); - CDTypeDiff typeDiff3 = new CDTypeDiff(astcdClass31, astcdClass32, tgt, src, diff.getHelper()); - System.out.println(typeDiff1.printSrcCD()); - System.out.println(typeDiff2.printSrcCD()); - System.out.println(typeDiff3.printSrcCD()); - System.out.println("--------------------------------"); - System.out.println(typeDiff1.printTgtCD()); - System.out.println(typeDiff2.printTgtCD()); - System.out.println(typeDiff3.printTgtCD()); - System.out.println("--------------------------------"); - System.out.println(typeDiff1.getBaseDiff()); - System.out.println(typeDiff2.getBaseDiff()); - System.out.println(typeDiff3.getBaseDiff()); - } - - // Test for inherited attributes - @Test - public void testType4() { - parseModels("Source4.cd", "Target4.cd"); - - ASTCDClass astcdClass = CDTestHelper.getClass("A", src.getCDDefinition()); - ASTCDClass astcdClass1 = CDTestHelper.getClass("A", tgt.getCDDefinition()); - - CDSyntaxDiff diff = new CDSyntaxDiff(src, tgt, List.of()); - CDTypeDiff typeDiff = new CDTypeDiff(astcdClass, astcdClass1, tgt, src, diff.getHelper()); - System.out.println(typeDiff.printSrcCD()); - System.out.println(typeDiff.printTgtCD()); - } - - public void parseModels(String concrete, String ref) { - try { - Optional src = CD4CodeMill.parser().parseCDCompilationUnit(dir - + concrete); - Optional tgt = CD4CodeMill.parser().parseCDCompilationUnit(dir + ref); - if (src.isPresent() && tgt.isPresent()) { - CD4CodeMill.scopesGenitorDelegator().createFromAST(src.get()); - CD4CodeMill.scopesGenitorDelegator().createFromAST(tgt.get()); - src.get().accept(new CD4CodeSymbolTableCompleter(src.get()).getTraverser()); - tgt.get().accept(new CD4CodeSymbolTableCompleter(tgt.get()).getTraverser()); - this.tgt = tgt.get(); - this.src = src.get(); - } - else { - fail("Could not parse CDs."); - } - - } - catch (IOException e) { - fail(e.getMessage()); - } - } - - private Map getDiffTypesCount(CDSyntaxDiff synDiff) { - return synDiff.getBaseDiff().stream().collect( - Collectors.groupingBy( - Function.identity(), - Collectors.counting() - ) - ); - } - -} diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/TypeDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/TypeDiffTest.java new file mode 100644 index 000000000..e2d93d7a6 --- /dev/null +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/TypeDiffTest.java @@ -0,0 +1,127 @@ +/* (c) https://github.com/MontiCore/monticore */ +package de.monticore.cddiff.syndiff; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class TypeDiffTest extends SynDiffTestBasis { + + @BeforeAll + public static void init() { + dir = "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/"; + } + + // Test for all kinds of changes in attributes + @Test + public void testType1() { + parseModels("Source1.cd", "Target1.cd"); + + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); + + new AssertSynDiff(synDiff) + .assertMatchedClasses(3) + .assertMatchedEnums(1) + .assertChangedTypes(4) + .assertAddedClasses(1) + .assertDeletedClasses(1) + .assertAddedEnums(1) + .assertDeletedEnums(1) + .assertAddedAssocs(1) + .assertDeletedAssocs(2) + .assertRemainingEmpty(); + + Map expectedDiffTypes = new HashMap<>(); + expectedDiffTypes.put(DiffTypes.DELETED_ATTRIBUTE, 2L); + expectedDiffTypes.put(DiffTypes.INHERITED_ATTRIBUTE, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_ATTRIBUTE, 1L); + expectedDiffTypes.put(DiffTypes.CHANGED_ATTRIBUTE_TYPE, 1L); + expectedDiffTypes.put(DiffTypes.CHANGED_ATTRIBUTE_MODIFIER, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_CONSTANT, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_CONSTANT, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_CLASS, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_CLASS, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_ENUM, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_ENUM, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_ASSOCIATION, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_INHERITANCE, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_INHERITANCE, 1L); + + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); + } + + // Tests for all kinds of changes in enum constants + @Test + public void testType2() { + parseModels("Source2.cd", "Target2.cd"); + + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); + + new AssertSynDiff(synDiff) + .assertMatchedClasses(2) + .assertMatchedEnums(1) + .assertChangedTypes(2) + .assertAddedEnums(1) + .assertDeletedEnums(1) + .assertRemainingEmpty(); + + Map expectedDiffTypes = new HashMap<>(); + expectedDiffTypes.put(DiffTypes.DELETED_ATTRIBUTE, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_ATTRIBUTE, 1L); + expectedDiffTypes.put(DiffTypes.CHANGED_ATTRIBUTE_TYPE, 1L); + expectedDiffTypes.put(DiffTypes.CHANGED_TYPE_EXTENDS, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_ENUM, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_ENUM, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_INHERITANCE, 1L); + + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); + } + + // Test for change of modifiers, extensions, and implementations + @Test + public void testType3() { + parseModels("Source3.cd", "Target3.cd"); + + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); + + new AssertSynDiff(synDiff) + .assertMatchedClasses(5) + .assertChangedTypes(3) + .assertRemainingEmpty(); + + Map expectedDiffTypes = new HashMap<>(); + expectedDiffTypes.put(DiffTypes.CHANGED_CLASS_MODIFIER, 3L); + expectedDiffTypes.put(DiffTypes.CHANGED_TYPE_IMPLEMENTS, 2L); + expectedDiffTypes.put(DiffTypes.CHANGED_TYPE_EXTENDS, 1L); + expectedDiffTypes.put(DiffTypes.ADDED_INHERITANCE, 1L); + expectedDiffTypes.put(DiffTypes.DELETED_INHERITANCE, 1L); + + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); + } + + // Test for inherited attributes + @Test + public void testType4() { + parseModels("Source4.cd", "Target4.cd"); + + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); + + new AssertSynDiff(synDiff) + .assertMatchedClasses(3) + .assertChangedTypes(3) + .assertRemainingEmpty(); + + Map expectedDiffTypes = new HashMap<>(); + expectedDiffTypes.put(DiffTypes.DELETED_ATTRIBUTE, 2L); + expectedDiffTypes.put(DiffTypes.INHERITED_ATTRIBUTE, 1L); + + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); + } + +} diff --git a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/100/CD1.cd b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/100/CD1.cd new file mode 100644 index 000000000..831eab672 --- /dev/null +++ b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/100/CD1.cd @@ -0,0 +1,588 @@ + +import java.lang.*; + +classdiagram CD1 { + + enum G1 {e11, e12, e13;} + + abstract class A1 { + String s; + } + + class B1 extends A1 { + E1 e; + } + + class C1 { + B1 b1; + } + + class D1 extends A1 { + String s; + } + + class E1 { + Double d; + } + + association [1] A1 <-> E1 [1..*]; + association [1..*] B1 -> C1 [0..1]; + association [1] C1 <-> D1 [1..*]; + association [*] E1 <- C1 [0..1]; + association [1] E1 -> D1 [1..*]; + + + enum G2 {e11, e12, e13;} + + abstract class A2 { + String s; + } + + class B2 extends A2 { + E2 e; + } + + class C2 { + B2 b2; + } + + class D2 extends A2 { + String s; + } + + class E2 { + Double d; + } + + association [1] A2 <-> E2 [1..*]; + association [1..*] B2 -> C2 [0..1]; + association [1] C2 <-> D2 [1..*]; + association [*] E2 <- C2 [0..1]; + association [1] E2 -> D2 [1..*]; + + + enum G3 {e11, e12, e13;} + + abstract class A3 { + String s; + } + + class B3 extends A3 { + E3 e; + } + + class C3 { + B3 b3; + } + + class D3 extends A3 { + String s; + } + + class E3 { + Double d; + } + + association [1] A3 <-> E3 [1..*]; + association [1..*] B3 -> C3 [0..1]; + association [1] C3 <-> D3 [1..*]; + association [*] E3 <- C3 [0..1]; + association [1] E3 -> D3 [1..*]; + + + enum G4 {e11, e12, e13;} + + abstract class A4 { + String s; + } + + class B4 extends A4 { + E4 e; + } + + class C4 { + B4 b4; + } + + class D4 extends A4 { + String s; + } + + class E4 { + Double d; + } + + association [1] A4 <-> E4 [1..*]; + association [1..*] B4 -> C4 [0..1]; + association [1] C4 <-> D4 [1..*]; + association [*] E4 <- C4 [0..1]; + association [1] E4 -> D4 [1..*]; + + + enum G5 {e11, e12, e13;} + + abstract class A5 { + String s; + } + + class B5 extends A5 { + E5 e; + } + + class C5 { + B5 b5; + } + + class D5 extends A5 { + String s; + } + + class E5 { + Double d; + } + + association [1] A5 <-> E5 [1..*]; + association [1..*] B5 -> C5 [0..1]; + association [1] C5 <-> D5 [1..*]; + association [*] E5 <- C5 [0..1]; + association [1] E5 -> D5 [1..*]; + + + enum G6 {e11, e12, e13;} + + abstract class A6 { + String s; + } + + class B6 extends A6 { + E6 e; + } + + class C6 { + B6 b6; + } + + class D6 extends A6 { + String s; + } + + class E6 { + Double d; + } + + association [1] A6 <-> E6 [1..*]; + association [1..*] B6 -> C6 [0..1]; + association [1] C6 <-> D6 [1..*]; + association [*] E6 <- C6 [0..1]; + association [1] E6 -> D6 [1..*]; + + + enum G7 {e11, e12, e13;} + + abstract class A7 { + String s; + } + + class B7 extends A7 { + E7 e; + } + + class C7 { + B7 b7; + } + + class D7 extends A7 { + String s; + } + + class E7 { + Double d; + } + + association [1] A7 <-> E7 [1..*]; + association [1..*] B7 -> C7 [0..1]; + association [1] C7 <-> D7 [1..*]; + association [*] E7 <- C7 [0..1]; + association [1] E7 -> D7 [1..*]; + + + enum G8 {e11, e12, e13;} + + abstract class A8 { + String s; + } + + class B8 extends A8 { + E8 e; + } + + class C8 { + B8 b8; + } + + class D8 extends A8 { + String s; + } + + class E8 { + Double d; + } + + association [1] A8 <-> E8 [1..*]; + association [1..*] B8 -> C8 [0..1]; + association [1] C8 <-> D8 [1..*]; + association [*] E8 <- C8 [0..1]; + association [1] E8 -> D8 [1..*]; + + + enum G9 {e11, e12, e13;} + + abstract class A9 { + String s; + } + + class B9 extends A9 { + E9 e; + } + + class C9 { + B9 b9; + } + + class D9 extends A9 { + String s; + } + + class E9 { + Double d; + } + + association [1] A9 <-> E9 [1..*]; + association [1..*] B9 -> C9 [0..1]; + association [1] C9 <-> D9 [1..*]; + association [*] E9 <- C9 [0..1]; + association [1] E9 -> D9 [1..*]; + + + enum G10 {e11, e12, e13;} + + abstract class A10 { + String s; + } + + class B10 extends A10 { + E10 e; + } + + class C10 { + B10 b10; + } + + class D10 extends A10 { + String s; + } + + class E10 { + Double d; + } + + association [1] A10 <-> E10 [1..*]; + association [1..*] B10 -> C10 [0..1]; + association [1] C10 <-> D10 [1..*]; + association [*] E10 <- C10 [0..1]; + association [1] E10 -> D10 [1..*]; + + + enum G11 {e11, e12, e13;} + + abstract class A11 { + String s; + } + + class B11 extends A11 { + E11 e; + } + + class C11 { + B11 b11; + } + + class D11 extends A11 { + String s; + } + + class E11 { + Double d; + } + + association [1] A11 <-> E11 [1..*]; + association [1..*] B11 -> C11 [0..1]; + association [1] C11 <-> D11 [1..*]; + association [*] E11 <- C11 [0..1]; + association [1] E11 -> D11 [1..*]; + + + enum G12 {e11, e12, e13;} + + abstract class A12 { + String s; + } + + class B12 extends A12 { + E12 e; + } + + class C12 { + B12 b12; + } + + class D12 extends A12 { + String s; + } + + class E12 { + Double d; + } + + association [1] A12 <-> E12 [1..*]; + association [1..*] B12 -> C12 [0..1]; + association [1] C12 <-> D12 [1..*]; + association [*] E12 <- C12 [0..1]; + association [1] E12 -> D12 [1..*]; + + + enum G13 {e11, e12, e13;} + + abstract class A13 { + String s; + } + + class B13 extends A13 { + E13 e; + } + + class C13 { + B13 b13; + } + + class D13 extends A13 { + String s; + } + + class E13 { + Double d; + } + + association [1] A13 <-> E13 [1..*]; + association [1..*] B13 -> C13 [0..1]; + association [1] C13 <-> D13 [1..*]; + association [*] E13 <- C13 [0..1]; + association [1] E13 -> D13 [1..*]; + + + enum G14 {e11, e12, e13;} + + abstract class A14 { + String s; + } + + class B14 extends A14 { + E14 e; + } + + class C14 { + B14 b14; + } + + class D14 extends A14 { + String s; + } + + class E14 { + Double d; + } + + association [1] A14 <-> E14 [1..*]; + association [1..*] B14 -> C14 [0..1]; + association [1] C14 <-> D14 [1..*]; + association [*] E14 <- C14 [0..1]; + association [1] E14 -> D14 [1..*]; + + + enum G15 {e11, e12, e13;} + + abstract class A15 { + String s; + } + + class B15 extends A15 { + E15 e; + } + + class C15 { + B15 b15; + } + + class D15 extends A15 { + String s; + } + + class E15 { + Double d; + } + + association [1] A15 <-> E15 [1..*]; + association [1..*] B15 -> C15 [0..1]; + association [1] C15 <-> D15 [1..*]; + association [*] E15 <- C15 [0..1]; + association [1] E15 -> D15 [1..*]; + + + enum G16 {e11, e12, e13;} + + abstract class A16 { + String s; + } + + class B16 extends A16 { + E16 e; + } + + class C16 { + B16 b16; + } + + class D16 extends A16 { + String s; + } + + class E16 { + Double d; + } + + association [1] A16 <-> E16 [1..*]; + association [1..*] B16 -> C16 [0..1]; + association [1] C16 <-> D16 [1..*]; + association [*] E16 <- C16 [0..1]; + association [1] E16 -> D16 [1..*]; + + + enum G17 {e11, e12, e13;} + + abstract class A17 { + String s; + } + + class B17 extends A17 { + E17 e; + } + + class C17 { + B17 b17; + } + + class D17 extends A17 { + String s; + } + + class E17 { + Double d; + } + + association [1] A17 <-> E17 [1..*]; + association [1..*] B17 -> C17 [0..1]; + association [1] C17 <-> D17 [1..*]; + association [*] E17 <- C17 [0..1]; + association [1] E17 -> D17 [1..*]; + + + enum G18 {e11, e12, e13;} + + abstract class A18 { + String s; + } + + class B18 extends A18 { + E18 e; + } + + class C18 { + B18 b18; + } + + class D18 extends A18 { + String s; + } + + class E18 { + Double d; + } + + association [1] A18 <-> E18 [1..*]; + association [1..*] B18 -> C18 [0..1]; + association [1] C18 <-> D18 [1..*]; + association [*] E18 <- C18 [0..1]; + association [1] E18 -> D18 [1..*]; + + + enum G19 {e11, e12, e13;} + + abstract class A19 { + String s; + } + + class B19 extends A19 { + E19 e; + } + + class C19 { + B19 b19; + } + + class D19 extends A19 { + String s; + } + + class E19 { + Double d; + } + + association [1] A19 <-> E19 [1..*]; + association [1..*] B19 -> C19 [0..1]; + association [1] C19 <-> D19 [1..*]; + association [*] E19 <- C19 [0..1]; + association [1] E19 -> D19 [1..*]; + + + enum G20 {e11, e12, e13;} + + abstract class A20 { + String s; + } + + class B20 extends A20 { + E20 e; + } + + class C20 { + B20 b20; + } + + class D20 extends A20 { + String s; + } + + class E20 { + Double d; + } + + association [1] A20 <-> E20 [1..*]; + association [1..*] B20 -> C20 [0..1]; + association [1] C20 <-> D20 [1..*]; + association [*] E20 <- C20 [0..1]; + association [1] E20 -> D20 [1..*]; + + + + +} diff --git a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/100/CD2.cd b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/100/CD2.cd new file mode 100644 index 000000000..cee820b94 --- /dev/null +++ b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/100/CD2.cd @@ -0,0 +1,565 @@ + +import java.lang.*; + +classdiagram CD1 { + + enum G1 {F11, F12;} + + class B1 { + F1 e; + } + + class C1 { + B1 b1; + } + + class D1 extends C1 { + } + + class E1 { + Integer i; + } + + class F1 extends B1 { + Double d; + } + + association [1] F1 <-> E1 [1..*]; + association [*] B1 -> C1 [0..1]; + association [1] C1 <-> D1 [1]; + association [1..*] E1 <-> C1 [*]; + association [1] F1 <- D1 [1..*]; + + + enum G2 {F11, F12;} + + class B2 { + F2 e; + } + + class C2 { + B2 b2; + } + + class D2 extends C2 { + } + + class E2 { + Integer i; + } + + class F2 extends B2 { + Double d; + } + + association [1] F2 <-> E2 [1..*]; + association [*] B2 -> C2 [0..1]; + association [1] C2 <-> D2 [1]; + association [1..*] E2 <-> C2 [*]; + association [1] F2 <- D2 [1..*]; + + + enum G3 {F11, F12;} + + class B3 { + F3 e; + } + + class C3 { + B3 b3; + } + + class D3 extends C3 { + } + + class E3 { + Integer i; + } + + class F3 extends B3 { + Double d; + } + + association [1] F3 <-> E3 [1..*]; + association [*] B3 -> C3 [0..1]; + association [1] C3 <-> D3 [1]; + association [1..*] E3 <-> C3 [*]; + association [1] F3 <- D3 [1..*]; + + + enum G4 {F11, F12;} + + class B4 { + F4 e; + } + + class C4 { + B4 b4; + } + + class D4 extends C4 { + } + + class E4 { + Integer i; + } + + class F4 extends B4 { + Double d; + } + + association [1] F4 <-> E4 [1..*]; + association [*] B4 -> C4 [0..1]; + association [1] C4 <-> D4 [1]; + association [1..*] E4 <-> C4 [*]; + association [1] F4 <- D4 [1..*]; + + + enum G5 {F11, F12;} + + class B5 { + F5 e; + } + + class C5 { + B5 b5; + } + + class D5 extends C5 { + } + + class E5 { + Integer i; + } + + class F5 extends B5 { + Double d; + } + + association [1] F5 <-> E5 [1..*]; + association [*] B5 -> C5 [0..1]; + association [1] C5 <-> D5 [1]; + association [1..*] E5 <-> C5 [*]; + association [1] F5 <- D5 [1..*]; + + + enum G6 {F11, F12;} + + class B6 { + F6 e; + } + + class C6 { + B6 b6; + } + + class D6 extends C6 { + } + + class E6 { + Integer i; + } + + class F6 extends B6 { + Double d; + } + + association [1] F6 <-> E6 [1..*]; + association [*] B6 -> C6 [0..1]; + association [1] C6 <-> D6 [1]; + association [1..*] E6 <-> C6 [*]; + association [1] F6 <- D6 [1..*]; + + + enum G7 {F11, F12;} + + class B7 { + F7 e; + } + + class C7 { + B7 b7; + } + + class D7 extends C7 { + } + + class E7 { + Integer i; + } + + class F7 extends B7 { + Double d; + } + + association [1] F7 <-> E7 [1..*]; + association [*] B7 -> C7 [0..1]; + association [1] C7 <-> D7 [1]; + association [1..*] E7 <-> C7 [*]; + association [1] F7 <- D7 [1..*]; + + + enum G8 {F11, F12;} + + class B8 { + F8 e; + } + + class C8 { + B8 b8; + } + + class D8 extends C8 { + } + + class E8 { + Integer i; + } + + class F8 extends B8 { + Double d; + } + + association [1] F8 <-> E8 [1..*]; + association [*] B8 -> C8 [0..1]; + association [1] C8 <-> D8 [1]; + association [1..*] E8 <-> C8 [*]; + association [1] F8 <- D8 [1..*]; + + + enum G9 {F11, F12;} + + class B9 { + F9 e; + } + + class C9 { + B9 b9; + } + + class D9 extends C9 { + } + + class E9 { + Integer i; + } + + class F9 extends B9 { + Double d; + } + + association [1] F9 <-> E9 [1..*]; + association [*] B9 -> C9 [0..1]; + association [1] C9 <-> D9 [1]; + association [1..*] E9 <-> C9 [*]; + association [1] F9 <- D9 [1..*]; + + + enum G10 {F11, F12;} + + class B10 { + F10 e; + } + + class C10 { + B10 b10; + } + + class D10 extends C10 { + } + + class E10 { + Integer i; + } + + class F10 extends B10 { + Double d; + } + + association [1] F10 <-> E10 [1..*]; + association [*] B10 -> C10 [0..1]; + association [1] C10 <-> D10 [1]; + association [1..*] E10 <-> C10 [*]; + association [1] F10 <- D10 [1..*]; + + + enum G11 {F11, F12;} + + class B11 { + F11 e; + } + + class C11 { + B11 b11; + } + + class D11 extends C11 { + } + + class E11 { + Integer i; + } + + class F11 extends B11 { + Double d; + } + + association [1] F11 <-> E11 [1..*]; + association [*] B11 -> C11 [0..1]; + association [1] C11 <-> D11 [1]; + association [1..*] E11 <-> C11 [*]; + association [1] F11 <- D11 [1..*]; + + + enum G12 {F11, F12;} + + class B12 { + F12 e; + } + + class C12 { + B12 b12; + } + + class D12 extends C12 { + } + + class E12 { + Integer i; + } + + class F12 extends B12 { + Double d; + } + + association [1] F12 <-> E12 [1..*]; + association [*] B12 -> C12 [0..1]; + association [1] C12 <-> D12 [1]; + association [1..*] E12 <-> C12 [*]; + association [1] F12 <- D12 [1..*]; + + + enum G13 {F11, F12;} + + class B13 { + F13 e; + } + + class C13 { + B13 b13; + } + + class D13 extends C13 { + } + + class E13 { + Integer i; + } + + class F13 extends B13 { + Double d; + } + + association [1] F13 <-> E13 [1..*]; + association [*] B13 -> C13 [0..1]; + association [1] C13 <-> D13 [1]; + association [1..*] E13 <-> C13 [*]; + association [1] F13 <- D13 [1..*]; + + + enum G14 {F11, F12;} + + class B14 { + F14 e; + } + + class C14 { + B14 b14; + } + + class D14 extends C14 { + } + + class E14 { + Integer i; + } + + class F14 extends B14 { + Double d; + } + + association [1] F14 <-> E14 [1..*]; + association [*] B14 -> C14 [0..1]; + association [1] C14 <-> D14 [1]; + association [1..*] E14 <-> C14 [*]; + association [1] F14 <- D14 [1..*]; + + + enum G15 {F11, F12;} + + class B15 { + F15 e; + } + + class C15 { + B15 b15; + } + + class D15 extends C15 { + } + + class E15 { + Integer i; + } + + class F15 extends B15 { + Double d; + } + + association [1] F15 <-> E15 [1..*]; + association [*] B15 -> C15 [0..1]; + association [1] C15 <-> D15 [1]; + association [1..*] E15 <-> C15 [*]; + association [1] F15 <- D15 [1..*]; + + + enum G16 {F11, F12;} + + class B16 { + F16 e; + } + + class C16 { + B16 b16; + } + + class D16 extends C16 { + } + + class E16 { + Integer i; + } + + class F16 extends B16 { + Double d; + } + + association [1] F16 <-> E16 [1..*]; + association [*] B16 -> C16 [0..1]; + association [1] C16 <-> D16 [1]; + association [1..*] E16 <-> C16 [*]; + association [1] F16 <- D16 [1..*]; + + + enum G17 {F11, F12;} + + class B17 { + F17 e; + } + + class C17 { + B17 b17; + } + + class D17 extends C17 { + } + + class E17 { + Integer i; + } + + class F17 extends B17 { + Double d; + } + + association [1] F17 <-> E17 [1..*]; + association [*] B17 -> C17 [0..1]; + association [1] C17 <-> D17 [1]; + association [1..*] E17 <-> C17 [*]; + association [1] F17 <- D17 [1..*]; + + + enum G18 {F11, F12;} + + class B18 { + F18 e; + } + + class C18 { + B18 b18; + } + + class D18 extends C18 { + } + + class E18 { + Integer i; + } + + class F18 extends B18 { + Double d; + } + + association [1] F18 <-> E18 [1..*]; + association [*] B18 -> C18 [0..1]; + association [1] C18 <-> D18 [1]; + association [1..*] E18 <-> C18 [*]; + association [1] F18 <- D18 [1..*]; + + + enum G19 {F11, F12;} + + class B19 { + F19 e; + } + + class C19 { + B19 b19; + } + + class D19 extends C19 { + } + + class E19 { + Integer i; + } + + class F19 extends B19 { + Double d; + } + + association [1] F19 <-> E19 [1..*]; + association [*] B19 -> C19 [0..1]; + association [1] C19 <-> D19 [1]; + association [1..*] E19 <-> C19 [*]; + association [1] F19 <- D19 [1..*]; + + + enum G20 {F11, F12;} + + class B20 { + F20 e; + } + + class C20 { + B20 b20; + } + + class D20 extends C20 { + } + + class E20 { + Integer i; + } + + class F20 extends B20 { + Double d; + } + + association [1] F20 <-> E20 [1..*]; + association [*] B20 -> C20 [0..1]; + association [1] C20 <-> D20 [1]; + association [1..*] E20 <-> C20 [*]; + association [1] F20 <- D20 [1..*]; + +} diff --git a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/1000/CD1.cd b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/1000/CD1.cd new file mode 100644 index 000000000..1ef8be30e --- /dev/null +++ b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/1000/CD1.cd @@ -0,0 +1,5805 @@ + +import java.lang.*; + +classdiagram CD1 { + + enum G1 {e11, e12, e13;} + + abstract class A1 { + String s; + } + + class B1 extends A1 { + E1 e; + } + + class C1 { + B1 b1; + } + + class D1 extends A1 { + String s; + } + + class E1 { + Double d; + } + + association [1] A1 <-> E1 [1..*]; + association [1..*] B1 -> C1 [0..1]; + association [1] C1 <-> D1 [1..*]; + association [*] E1 <- C1 [0..1]; + association [1] E1 -> D1 [1..*]; + + + enum G2 {e11, e12, e13;} + + abstract class A2 { + String s; + } + + class B2 extends A2 { + E2 e; + } + + class C2 { + B2 b2; + } + + class D2 extends A2 { + String s; + } + + class E2 { + Double d; + } + + association [1] A2 <-> E2 [1..*]; + association [1..*] B2 -> C2 [0..1]; + association [1] C2 <-> D2 [1..*]; + association [*] E2 <- C2 [0..1]; + association [1] E2 -> D2 [1..*]; + + + enum G3 {e11, e12, e13;} + + abstract class A3 { + String s; + } + + class B3 extends A3 { + E3 e; + } + + class C3 { + B3 b3; + } + + class D3 extends A3 { + String s; + } + + class E3 { + Double d; + } + + association [1] A3 <-> E3 [1..*]; + association [1..*] B3 -> C3 [0..1]; + association [1] C3 <-> D3 [1..*]; + association [*] E3 <- C3 [0..1]; + association [1] E3 -> D3 [1..*]; + + + enum G4 {e11, e12, e13;} + + abstract class A4 { + String s; + } + + class B4 extends A4 { + E4 e; + } + + class C4 { + B4 b4; + } + + class D4 extends A4 { + String s; + } + + class E4 { + Double d; + } + + association [1] A4 <-> E4 [1..*]; + association [1..*] B4 -> C4 [0..1]; + association [1] C4 <-> D4 [1..*]; + association [*] E4 <- C4 [0..1]; + association [1] E4 -> D4 [1..*]; + + + enum G5 {e11, e12, e13;} + + abstract class A5 { + String s; + } + + class B5 extends A5 { + E5 e; + } + + class C5 { + B5 b5; + } + + class D5 extends A5 { + String s; + } + + class E5 { + Double d; + } + + association [1] A5 <-> E5 [1..*]; + association [1..*] B5 -> C5 [0..1]; + association [1] C5 <-> D5 [1..*]; + association [*] E5 <- C5 [0..1]; + association [1] E5 -> D5 [1..*]; + + + enum G6 {e11, e12, e13;} + + abstract class A6 { + String s; + } + + class B6 extends A6 { + E6 e; + } + + class C6 { + B6 b6; + } + + class D6 extends A6 { + String s; + } + + class E6 { + Double d; + } + + association [1] A6 <-> E6 [1..*]; + association [1..*] B6 -> C6 [0..1]; + association [1] C6 <-> D6 [1..*]; + association [*] E6 <- C6 [0..1]; + association [1] E6 -> D6 [1..*]; + + + enum G7 {e11, e12, e13;} + + abstract class A7 { + String s; + } + + class B7 extends A7 { + E7 e; + } + + class C7 { + B7 b7; + } + + class D7 extends A7 { + String s; + } + + class E7 { + Double d; + } + + association [1] A7 <-> E7 [1..*]; + association [1..*] B7 -> C7 [0..1]; + association [1] C7 <-> D7 [1..*]; + association [*] E7 <- C7 [0..1]; + association [1] E7 -> D7 [1..*]; + + + enum G8 {e11, e12, e13;} + + abstract class A8 { + String s; + } + + class B8 extends A8 { + E8 e; + } + + class C8 { + B8 b8; + } + + class D8 extends A8 { + String s; + } + + class E8 { + Double d; + } + + association [1] A8 <-> E8 [1..*]; + association [1..*] B8 -> C8 [0..1]; + association [1] C8 <-> D8 [1..*]; + association [*] E8 <- C8 [0..1]; + association [1] E8 -> D8 [1..*]; + + + enum G9 {e11, e12, e13;} + + abstract class A9 { + String s; + } + + class B9 extends A9 { + E9 e; + } + + class C9 { + B9 b9; + } + + class D9 extends A9 { + String s; + } + + class E9 { + Double d; + } + + association [1] A9 <-> E9 [1..*]; + association [1..*] B9 -> C9 [0..1]; + association [1] C9 <-> D9 [1..*]; + association [*] E9 <- C9 [0..1]; + association [1] E9 -> D9 [1..*]; + + + enum G10 {e11, e12, e13;} + + abstract class A10 { + String s; + } + + class B10 extends A10 { + E10 e; + } + + class C10 { + B10 b10; + } + + class D10 extends A10 { + String s; + } + + class E10 { + Double d; + } + + association [1] A10 <-> E10 [1..*]; + association [1..*] B10 -> C10 [0..1]; + association [1] C10 <-> D10 [1..*]; + association [*] E10 <- C10 [0..1]; + association [1] E10 -> D10 [1..*]; + + + enum G11 {e11, e12, e13;} + + abstract class A11 { + String s; + } + + class B11 extends A11 { + E11 e; + } + + class C11 { + B11 b11; + } + + class D11 extends A11 { + String s; + } + + class E11 { + Double d; + } + + association [1] A11 <-> E11 [1..*]; + association [1..*] B11 -> C11 [0..1]; + association [1] C11 <-> D11 [1..*]; + association [*] E11 <- C11 [0..1]; + association [1] E11 -> D11 [1..*]; + + + enum G12 {e11, e12, e13;} + + abstract class A12 { + String s; + } + + class B12 extends A12 { + E12 e; + } + + class C12 { + B12 b12; + } + + class D12 extends A12 { + String s; + } + + class E12 { + Double d; + } + + association [1] A12 <-> E12 [1..*]; + association [1..*] B12 -> C12 [0..1]; + association [1] C12 <-> D12 [1..*]; + association [*] E12 <- C12 [0..1]; + association [1] E12 -> D12 [1..*]; + + + enum G13 {e11, e12, e13;} + + abstract class A13 { + String s; + } + + class B13 extends A13 { + E13 e; + } + + class C13 { + B13 b13; + } + + class D13 extends A13 { + String s; + } + + class E13 { + Double d; + } + + association [1] A13 <-> E13 [1..*]; + association [1..*] B13 -> C13 [0..1]; + association [1] C13 <-> D13 [1..*]; + association [*] E13 <- C13 [0..1]; + association [1] E13 -> D13 [1..*]; + + + enum G14 {e11, e12, e13;} + + abstract class A14 { + String s; + } + + class B14 extends A14 { + E14 e; + } + + class C14 { + B14 b14; + } + + class D14 extends A14 { + String s; + } + + class E14 { + Double d; + } + + association [1] A14 <-> E14 [1..*]; + association [1..*] B14 -> C14 [0..1]; + association [1] C14 <-> D14 [1..*]; + association [*] E14 <- C14 [0..1]; + association [1] E14 -> D14 [1..*]; + + + enum G15 {e11, e12, e13;} + + abstract class A15 { + String s; + } + + class B15 extends A15 { + E15 e; + } + + class C15 { + B15 b15; + } + + class D15 extends A15 { + String s; + } + + class E15 { + Double d; + } + + association [1] A15 <-> E15 [1..*]; + association [1..*] B15 -> C15 [0..1]; + association [1] C15 <-> D15 [1..*]; + association [*] E15 <- C15 [0..1]; + association [1] E15 -> D15 [1..*]; + + + enum G16 {e11, e12, e13;} + + abstract class A16 { + String s; + } + + class B16 extends A16 { + E16 e; + } + + class C16 { + B16 b16; + } + + class D16 extends A16 { + String s; + } + + class E16 { + Double d; + } + + association [1] A16 <-> E16 [1..*]; + association [1..*] B16 -> C16 [0..1]; + association [1] C16 <-> D16 [1..*]; + association [*] E16 <- C16 [0..1]; + association [1] E16 -> D16 [1..*]; + + + enum G17 {e11, e12, e13;} + + abstract class A17 { + String s; + } + + class B17 extends A17 { + E17 e; + } + + class C17 { + B17 b17; + } + + class D17 extends A17 { + String s; + } + + class E17 { + Double d; + } + + association [1] A17 <-> E17 [1..*]; + association [1..*] B17 -> C17 [0..1]; + association [1] C17 <-> D17 [1..*]; + association [*] E17 <- C17 [0..1]; + association [1] E17 -> D17 [1..*]; + + + enum G18 {e11, e12, e13;} + + abstract class A18 { + String s; + } + + class B18 extends A18 { + E18 e; + } + + class C18 { + B18 b18; + } + + class D18 extends A18 { + String s; + } + + class E18 { + Double d; + } + + association [1] A18 <-> E18 [1..*]; + association [1..*] B18 -> C18 [0..1]; + association [1] C18 <-> D18 [1..*]; + association [*] E18 <- C18 [0..1]; + association [1] E18 -> D18 [1..*]; + + + enum G19 {e11, e12, e13;} + + abstract class A19 { + String s; + } + + class B19 extends A19 { + E19 e; + } + + class C19 { + B19 b19; + } + + class D19 extends A19 { + String s; + } + + class E19 { + Double d; + } + + association [1] A19 <-> E19 [1..*]; + association [1..*] B19 -> C19 [0..1]; + association [1] C19 <-> D19 [1..*]; + association [*] E19 <- C19 [0..1]; + association [1] E19 -> D19 [1..*]; + + + enum G20 {e11, e12, e13;} + + abstract class A20 { + String s; + } + + class B20 extends A20 { + E20 e; + } + + class C20 { + B20 b20; + } + + class D20 extends A20 { + String s; + } + + class E20 { + Double d; + } + + association [1] A20 <-> E20 [1..*]; + association [1..*] B20 -> C20 [0..1]; + association [1] C20 <-> D20 [1..*]; + association [*] E20 <- C20 [0..1]; + association [1] E20 -> D20 [1..*]; + + + enum G21 {e11, e12, e13;} + + abstract class A21 { + String s; + } + + class B21 extends A21 { + E21 e; + } + + class C21 { + B21 b21; + } + + class D21 extends A21 { + String s; + } + + class E21 { + Double d; + } + + association [1] A21 <-> E21 [1..*]; + association [1..*] B21 -> C21 [0..1]; + association [1] C21 <-> D21 [1..*]; + association [*] E21 <- C21 [0..1]; + association [1] E21 -> D21 [1..*]; + + + enum G22 {e11, e12, e13;} + + abstract class A22 { + String s; + } + + class B22 extends A22 { + E22 e; + } + + class C22 { + B22 b22; + } + + class D22 extends A22 { + String s; + } + + class E22 { + Double d; + } + + association [1] A22 <-> E22 [1..*]; + association [1..*] B22 -> C22 [0..1]; + association [1] C22 <-> D22 [1..*]; + association [*] E22 <- C22 [0..1]; + association [1] E22 -> D22 [1..*]; + + + enum G23 {e11, e12, e13;} + + abstract class A23 { + String s; + } + + class B23 extends A23 { + E23 e; + } + + class C23 { + B23 b23; + } + + class D23 extends A23 { + String s; + } + + class E23 { + Double d; + } + + association [1] A23 <-> E23 [1..*]; + association [1..*] B23 -> C23 [0..1]; + association [1] C23 <-> D23 [1..*]; + association [*] E23 <- C23 [0..1]; + association [1] E23 -> D23 [1..*]; + + + enum G24 {e11, e12, e13;} + + abstract class A24 { + String s; + } + + class B24 extends A24 { + E24 e; + } + + class C24 { + B24 b24; + } + + class D24 extends A24 { + String s; + } + + class E24 { + Double d; + } + + association [1] A24 <-> E24 [1..*]; + association [1..*] B24 -> C24 [0..1]; + association [1] C24 <-> D24 [1..*]; + association [*] E24 <- C24 [0..1]; + association [1] E24 -> D24 [1..*]; + + + enum G25 {e11, e12, e13;} + + abstract class A25 { + String s; + } + + class B25 extends A25 { + E25 e; + } + + class C25 { + B25 b25; + } + + class D25 extends A25 { + String s; + } + + class E25 { + Double d; + } + + association [1] A25 <-> E25 [1..*]; + association [1..*] B25 -> C25 [0..1]; + association [1] C25 <-> D25 [1..*]; + association [*] E25 <- C25 [0..1]; + association [1] E25 -> D25 [1..*]; + + + enum G26 {e11, e12, e13;} + + abstract class A26 { + String s; + } + + class B26 extends A26 { + E26 e; + } + + class C26 { + B26 b26; + } + + class D26 extends A26 { + String s; + } + + class E26 { + Double d; + } + + association [1] A26 <-> E26 [1..*]; + association [1..*] B26 -> C26 [0..1]; + association [1] C26 <-> D26 [1..*]; + association [*] E26 <- C26 [0..1]; + association [1] E26 -> D26 [1..*]; + + + enum G27 {e11, e12, e13;} + + abstract class A27 { + String s; + } + + class B27 extends A27 { + E27 e; + } + + class C27 { + B27 b27; + } + + class D27 extends A27 { + String s; + } + + class E27 { + Double d; + } + + association [1] A27 <-> E27 [1..*]; + association [1..*] B27 -> C27 [0..1]; + association [1] C27 <-> D27 [1..*]; + association [*] E27 <- C27 [0..1]; + association [1] E27 -> D27 [1..*]; + + + enum G28 {e11, e12, e13;} + + abstract class A28 { + String s; + } + + class B28 extends A28 { + E28 e; + } + + class C28 { + B28 b28; + } + + class D28 extends A28 { + String s; + } + + class E28 { + Double d; + } + + association [1] A28 <-> E28 [1..*]; + association [1..*] B28 -> C28 [0..1]; + association [1] C28 <-> D28 [1..*]; + association [*] E28 <- C28 [0..1]; + association [1] E28 -> D28 [1..*]; + + + enum G29 {e11, e12, e13;} + + abstract class A29 { + String s; + } + + class B29 extends A29 { + E29 e; + } + + class C29 { + B29 b29; + } + + class D29 extends A29 { + String s; + } + + class E29 { + Double d; + } + + association [1] A29 <-> E29 [1..*]; + association [1..*] B29 -> C29 [0..1]; + association [1] C29 <-> D29 [1..*]; + association [*] E29 <- C29 [0..1]; + association [1] E29 -> D29 [1..*]; + + + enum G30 {e11, e12, e13;} + + abstract class A30 { + String s; + } + + class B30 extends A30 { + E30 e; + } + + class C30 { + B30 b30; + } + + class D30 extends A30 { + String s; + } + + class E30 { + Double d; + } + + association [1] A30 <-> E30 [1..*]; + association [1..*] B30 -> C30 [0..1]; + association [1] C30 <-> D30 [1..*]; + association [*] E30 <- C30 [0..1]; + association [1] E30 -> D30 [1..*]; + + + enum G31 {e11, e12, e13;} + + abstract class A31 { + String s; + } + + class B31 extends A31 { + E31 e; + } + + class C31 { + B31 b31; + } + + class D31 extends A31 { + String s; + } + + class E31 { + Double d; + } + + association [1] A31 <-> E31 [1..*]; + association [1..*] B31 -> C31 [0..1]; + association [1] C31 <-> D31 [1..*]; + association [*] E31 <- C31 [0..1]; + association [1] E31 -> D31 [1..*]; + + + enum G32 {e11, e12, e13;} + + abstract class A32 { + String s; + } + + class B32 extends A32 { + E32 e; + } + + class C32 { + B32 b32; + } + + class D32 extends A32 { + String s; + } + + class E32 { + Double d; + } + + association [1] A32 <-> E32 [1..*]; + association [1..*] B32 -> C32 [0..1]; + association [1] C32 <-> D32 [1..*]; + association [*] E32 <- C32 [0..1]; + association [1] E32 -> D32 [1..*]; + + + enum G33 {e11, e12, e13;} + + abstract class A33 { + String s; + } + + class B33 extends A33 { + E33 e; + } + + class C33 { + B33 b33; + } + + class D33 extends A33 { + String s; + } + + class E33 { + Double d; + } + + association [1] A33 <-> E33 [1..*]; + association [1..*] B33 -> C33 [0..1]; + association [1] C33 <-> D33 [1..*]; + association [*] E33 <- C33 [0..1]; + association [1] E33 -> D33 [1..*]; + + + enum G34 {e11, e12, e13;} + + abstract class A34 { + String s; + } + + class B34 extends A34 { + E34 e; + } + + class C34 { + B34 b34; + } + + class D34 extends A34 { + String s; + } + + class E34 { + Double d; + } + + association [1] A34 <-> E34 [1..*]; + association [1..*] B34 -> C34 [0..1]; + association [1] C34 <-> D34 [1..*]; + association [*] E34 <- C34 [0..1]; + association [1] E34 -> D34 [1..*]; + + + enum G35 {e11, e12, e13;} + + abstract class A35 { + String s; + } + + class B35 extends A35 { + E35 e; + } + + class C35 { + B35 b35; + } + + class D35 extends A35 { + String s; + } + + class E35 { + Double d; + } + + association [1] A35 <-> E35 [1..*]; + association [1..*] B35 -> C35 [0..1]; + association [1] C35 <-> D35 [1..*]; + association [*] E35 <- C35 [0..1]; + association [1] E35 -> D35 [1..*]; + + + enum G36 {e11, e12, e13;} + + abstract class A36 { + String s; + } + + class B36 extends A36 { + E36 e; + } + + class C36 { + B36 b36; + } + + class D36 extends A36 { + String s; + } + + class E36 { + Double d; + } + + association [1] A36 <-> E36 [1..*]; + association [1..*] B36 -> C36 [0..1]; + association [1] C36 <-> D36 [1..*]; + association [*] E36 <- C36 [0..1]; + association [1] E36 -> D36 [1..*]; + + + enum G37 {e11, e12, e13;} + + abstract class A37 { + String s; + } + + class B37 extends A37 { + E37 e; + } + + class C37 { + B37 b37; + } + + class D37 extends A37 { + String s; + } + + class E37 { + Double d; + } + + association [1] A37 <-> E37 [1..*]; + association [1..*] B37 -> C37 [0..1]; + association [1] C37 <-> D37 [1..*]; + association [*] E37 <- C37 [0..1]; + association [1] E37 -> D37 [1..*]; + + + enum G38 {e11, e12, e13;} + + abstract class A38 { + String s; + } + + class B38 extends A38 { + E38 e; + } + + class C38 { + B38 b38; + } + + class D38 extends A38 { + String s; + } + + class E38 { + Double d; + } + + association [1] A38 <-> E38 [1..*]; + association [1..*] B38 -> C38 [0..1]; + association [1] C38 <-> D38 [1..*]; + association [*] E38 <- C38 [0..1]; + association [1] E38 -> D38 [1..*]; + + + enum G39 {e11, e12, e13;} + + abstract class A39 { + String s; + } + + class B39 extends A39 { + E39 e; + } + + class C39 { + B39 b39; + } + + class D39 extends A39 { + String s; + } + + class E39 { + Double d; + } + + association [1] A39 <-> E39 [1..*]; + association [1..*] B39 -> C39 [0..1]; + association [1] C39 <-> D39 [1..*]; + association [*] E39 <- C39 [0..1]; + association [1] E39 -> D39 [1..*]; + + + enum G40 {e11, e12, e13;} + + abstract class A40 { + String s; + } + + class B40 extends A40 { + E40 e; + } + + class C40 { + B40 b40; + } + + class D40 extends A40 { + String s; + } + + class E40 { + Double d; + } + + association [1] A40 <-> E40 [1..*]; + association [1..*] B40 -> C40 [0..1]; + association [1] C40 <-> D40 [1..*]; + association [*] E40 <- C40 [0..1]; + association [1] E40 -> D40 [1..*]; + + + enum G41 {e11, e12, e13;} + + abstract class A41 { + String s; + } + + class B41 extends A41 { + E41 e; + } + + class C41 { + B41 b41; + } + + class D41 extends A41 { + String s; + } + + class E41 { + Double d; + } + + association [1] A41 <-> E41 [1..*]; + association [1..*] B41 -> C41 [0..1]; + association [1] C41 <-> D41 [1..*]; + association [*] E41 <- C41 [0..1]; + association [1] E41 -> D41 [1..*]; + + + enum G42 {e11, e12, e13;} + + abstract class A42 { + String s; + } + + class B42 extends A42 { + E42 e; + } + + class C42 { + B42 b42; + } + + class D42 extends A42 { + String s; + } + + class E42 { + Double d; + } + + association [1] A42 <-> E42 [1..*]; + association [1..*] B42 -> C42 [0..1]; + association [1] C42 <-> D42 [1..*]; + association [*] E42 <- C42 [0..1]; + association [1] E42 -> D42 [1..*]; + + + enum G43 {e11, e12, e13;} + + abstract class A43 { + String s; + } + + class B43 extends A43 { + E43 e; + } + + class C43 { + B43 b43; + } + + class D43 extends A43 { + String s; + } + + class E43 { + Double d; + } + + association [1] A43 <-> E43 [1..*]; + association [1..*] B43 -> C43 [0..1]; + association [1] C43 <-> D43 [1..*]; + association [*] E43 <- C43 [0..1]; + association [1] E43 -> D43 [1..*]; + + + enum G44 {e11, e12, e13;} + + abstract class A44 { + String s; + } + + class B44 extends A44 { + E44 e; + } + + class C44 { + B44 b44; + } + + class D44 extends A44 { + String s; + } + + class E44 { + Double d; + } + + association [1] A44 <-> E44 [1..*]; + association [1..*] B44 -> C44 [0..1]; + association [1] C44 <-> D44 [1..*]; + association [*] E44 <- C44 [0..1]; + association [1] E44 -> D44 [1..*]; + + + enum G45 {e11, e12, e13;} + + abstract class A45 { + String s; + } + + class B45 extends A45 { + E45 e; + } + + class C45 { + B45 b45; + } + + class D45 extends A45 { + String s; + } + + class E45 { + Double d; + } + + association [1] A45 <-> E45 [1..*]; + association [1..*] B45 -> C45 [0..1]; + association [1] C45 <-> D45 [1..*]; + association [*] E45 <- C45 [0..1]; + association [1] E45 -> D45 [1..*]; + + + enum G46 {e11, e12, e13;} + + abstract class A46 { + String s; + } + + class B46 extends A46 { + E46 e; + } + + class C46 { + B46 b46; + } + + class D46 extends A46 { + String s; + } + + class E46 { + Double d; + } + + association [1] A46 <-> E46 [1..*]; + association [1..*] B46 -> C46 [0..1]; + association [1] C46 <-> D46 [1..*]; + association [*] E46 <- C46 [0..1]; + association [1] E46 -> D46 [1..*]; + + + enum G47 {e11, e12, e13;} + + abstract class A47 { + String s; + } + + class B47 extends A47 { + E47 e; + } + + class C47 { + B47 b47; + } + + class D47 extends A47 { + String s; + } + + class E47 { + Double d; + } + + association [1] A47 <-> E47 [1..*]; + association [1..*] B47 -> C47 [0..1]; + association [1] C47 <-> D47 [1..*]; + association [*] E47 <- C47 [0..1]; + association [1] E47 -> D47 [1..*]; + + + enum G48 {e11, e12, e13;} + + abstract class A48 { + String s; + } + + class B48 extends A48 { + E48 e; + } + + class C48 { + B48 b48; + } + + class D48 extends A48 { + String s; + } + + class E48 { + Double d; + } + + association [1] A48 <-> E48 [1..*]; + association [1..*] B48 -> C48 [0..1]; + association [1] C48 <-> D48 [1..*]; + association [*] E48 <- C48 [0..1]; + association [1] E48 -> D48 [1..*]; + + + enum G49 {e11, e12, e13;} + + abstract class A49 { + String s; + } + + class B49 extends A49 { + E49 e; + } + + class C49 { + B49 b49; + } + + class D49 extends A49 { + String s; + } + + class E49 { + Double d; + } + + association [1] A49 <-> E49 [1..*]; + association [1..*] B49 -> C49 [0..1]; + association [1] C49 <-> D49 [1..*]; + association [*] E49 <- C49 [0..1]; + association [1] E49 -> D49 [1..*]; + + + enum G50 {e11, e12, e13;} + + abstract class A50 { + String s; + } + + class B50 extends A50 { + E50 e; + } + + class C50 { + B50 b50; + } + + class D50 extends A50 { + String s; + } + + class E50 { + Double d; + } + + association [1] A50 <-> E50 [1..*]; + association [1..*] B50 -> C50 [0..1]; + association [1] C50 <-> D50 [1..*]; + association [*] E50 <- C50 [0..1]; + association [1] E50 -> D50 [1..*]; + + + enum G51 {e11, e12, e13;} + + abstract class A51 { + String s; + } + + class B51 extends A51 { + E51 e; + } + + class C51 { + B51 b51; + } + + class D51 extends A51 { + String s; + } + + class E51 { + Double d; + } + + association [1] A51 <-> E51 [1..*]; + association [1..*] B51 -> C51 [0..1]; + association [1] C51 <-> D51 [1..*]; + association [*] E51 <- C51 [0..1]; + association [1] E51 -> D51 [1..*]; + + + enum G52 {e11, e12, e13;} + + abstract class A52 { + String s; + } + + class B52 extends A52 { + E52 e; + } + + class C52 { + B52 b52; + } + + class D52 extends A52 { + String s; + } + + class E52 { + Double d; + } + + association [1] A52 <-> E52 [1..*]; + association [1..*] B52 -> C52 [0..1]; + association [1] C52 <-> D52 [1..*]; + association [*] E52 <- C52 [0..1]; + association [1] E52 -> D52 [1..*]; + + + enum G53 {e11, e12, e13;} + + abstract class A53 { + String s; + } + + class B53 extends A53 { + E53 e; + } + + class C53 { + B53 b53; + } + + class D53 extends A53 { + String s; + } + + class E53 { + Double d; + } + + association [1] A53 <-> E53 [1..*]; + association [1..*] B53 -> C53 [0..1]; + association [1] C53 <-> D53 [1..*]; + association [*] E53 <- C53 [0..1]; + association [1] E53 -> D53 [1..*]; + + + enum G54 {e11, e12, e13;} + + abstract class A54 { + String s; + } + + class B54 extends A54 { + E54 e; + } + + class C54 { + B54 b54; + } + + class D54 extends A54 { + String s; + } + + class E54 { + Double d; + } + + association [1] A54 <-> E54 [1..*]; + association [1..*] B54 -> C54 [0..1]; + association [1] C54 <-> D54 [1..*]; + association [*] E54 <- C54 [0..1]; + association [1] E54 -> D54 [1..*]; + + + enum G55 {e11, e12, e13;} + + abstract class A55 { + String s; + } + + class B55 extends A55 { + E55 e; + } + + class C55 { + B55 b55; + } + + class D55 extends A55 { + String s; + } + + class E55 { + Double d; + } + + association [1] A55 <-> E55 [1..*]; + association [1..*] B55 -> C55 [0..1]; + association [1] C55 <-> D55 [1..*]; + association [*] E55 <- C55 [0..1]; + association [1] E55 -> D55 [1..*]; + + + enum G56 {e11, e12, e13;} + + abstract class A56 { + String s; + } + + class B56 extends A56 { + E56 e; + } + + class C56 { + B56 b56; + } + + class D56 extends A56 { + String s; + } + + class E56 { + Double d; + } + + association [1] A56 <-> E56 [1..*]; + association [1..*] B56 -> C56 [0..1]; + association [1] C56 <-> D56 [1..*]; + association [*] E56 <- C56 [0..1]; + association [1] E56 -> D56 [1..*]; + + + enum G57 {e11, e12, e13;} + + abstract class A57 { + String s; + } + + class B57 extends A57 { + E57 e; + } + + class C57 { + B57 b57; + } + + class D57 extends A57 { + String s; + } + + class E57 { + Double d; + } + + association [1] A57 <-> E57 [1..*]; + association [1..*] B57 -> C57 [0..1]; + association [1] C57 <-> D57 [1..*]; + association [*] E57 <- C57 [0..1]; + association [1] E57 -> D57 [1..*]; + + + enum G58 {e11, e12, e13;} + + abstract class A58 { + String s; + } + + class B58 extends A58 { + E58 e; + } + + class C58 { + B58 b58; + } + + class D58 extends A58 { + String s; + } + + class E58 { + Double d; + } + + association [1] A58 <-> E58 [1..*]; + association [1..*] B58 -> C58 [0..1]; + association [1] C58 <-> D58 [1..*]; + association [*] E58 <- C58 [0..1]; + association [1] E58 -> D58 [1..*]; + + + enum G59 {e11, e12, e13;} + + abstract class A59 { + String s; + } + + class B59 extends A59 { + E59 e; + } + + class C59 { + B59 b59; + } + + class D59 extends A59 { + String s; + } + + class E59 { + Double d; + } + + association [1] A59 <-> E59 [1..*]; + association [1..*] B59 -> C59 [0..1]; + association [1] C59 <-> D59 [1..*]; + association [*] E59 <- C59 [0..1]; + association [1] E59 -> D59 [1..*]; + + + enum G60 {e11, e12, e13;} + + abstract class A60 { + String s; + } + + class B60 extends A60 { + E60 e; + } + + class C60 { + B60 b60; + } + + class D60 extends A60 { + String s; + } + + class E60 { + Double d; + } + + association [1] A60 <-> E60 [1..*]; + association [1..*] B60 -> C60 [0..1]; + association [1] C60 <-> D60 [1..*]; + association [*] E60 <- C60 [0..1]; + association [1] E60 -> D60 [1..*]; + + + enum G61 {e11, e12, e13;} + + abstract class A61 { + String s; + } + + class B61 extends A61 { + E61 e; + } + + class C61 { + B61 b61; + } + + class D61 extends A61 { + String s; + } + + class E61 { + Double d; + } + + association [1] A61 <-> E61 [1..*]; + association [1..*] B61 -> C61 [0..1]; + association [1] C61 <-> D61 [1..*]; + association [*] E61 <- C61 [0..1]; + association [1] E61 -> D61 [1..*]; + + + enum G62 {e11, e12, e13;} + + abstract class A62 { + String s; + } + + class B62 extends A62 { + E62 e; + } + + class C62 { + B62 b62; + } + + class D62 extends A62 { + String s; + } + + class E62 { + Double d; + } + + association [1] A62 <-> E62 [1..*]; + association [1..*] B62 -> C62 [0..1]; + association [1] C62 <-> D62 [1..*]; + association [*] E62 <- C62 [0..1]; + association [1] E62 -> D62 [1..*]; + + + enum G63 {e11, e12, e13;} + + abstract class A63 { + String s; + } + + class B63 extends A63 { + E63 e; + } + + class C63 { + B63 b63; + } + + class D63 extends A63 { + String s; + } + + class E63 { + Double d; + } + + association [1] A63 <-> E63 [1..*]; + association [1..*] B63 -> C63 [0..1]; + association [1] C63 <-> D63 [1..*]; + association [*] E63 <- C63 [0..1]; + association [1] E63 -> D63 [1..*]; + + + enum G64 {e11, e12, e13;} + + abstract class A64 { + String s; + } + + class B64 extends A64 { + E64 e; + } + + class C64 { + B64 b64; + } + + class D64 extends A64 { + String s; + } + + class E64 { + Double d; + } + + association [1] A64 <-> E64 [1..*]; + association [1..*] B64 -> C64 [0..1]; + association [1] C64 <-> D64 [1..*]; + association [*] E64 <- C64 [0..1]; + association [1] E64 -> D64 [1..*]; + + + enum G65 {e11, e12, e13;} + + abstract class A65 { + String s; + } + + class B65 extends A65 { + E65 e; + } + + class C65 { + B65 b65; + } + + class D65 extends A65 { + String s; + } + + class E65 { + Double d; + } + + association [1] A65 <-> E65 [1..*]; + association [1..*] B65 -> C65 [0..1]; + association [1] C65 <-> D65 [1..*]; + association [*] E65 <- C65 [0..1]; + association [1] E65 -> D65 [1..*]; + + + enum G66 {e11, e12, e13;} + + abstract class A66 { + String s; + } + + class B66 extends A66 { + E66 e; + } + + class C66 { + B66 b66; + } + + class D66 extends A66 { + String s; + } + + class E66 { + Double d; + } + + association [1] A66 <-> E66 [1..*]; + association [1..*] B66 -> C66 [0..1]; + association [1] C66 <-> D66 [1..*]; + association [*] E66 <- C66 [0..1]; + association [1] E66 -> D66 [1..*]; + + + enum G67 {e11, e12, e13;} + + abstract class A67 { + String s; + } + + class B67 extends A67 { + E67 e; + } + + class C67 { + B67 b67; + } + + class D67 extends A67 { + String s; + } + + class E67 { + Double d; + } + + association [1] A67 <-> E67 [1..*]; + association [1..*] B67 -> C67 [0..1]; + association [1] C67 <-> D67 [1..*]; + association [*] E67 <- C67 [0..1]; + association [1] E67 -> D67 [1..*]; + + + enum G68 {e11, e12, e13;} + + abstract class A68 { + String s; + } + + class B68 extends A68 { + E68 e; + } + + class C68 { + B68 b68; + } + + class D68 extends A68 { + String s; + } + + class E68 { + Double d; + } + + association [1] A68 <-> E68 [1..*]; + association [1..*] B68 -> C68 [0..1]; + association [1] C68 <-> D68 [1..*]; + association [*] E68 <- C68 [0..1]; + association [1] E68 -> D68 [1..*]; + + + enum G69 {e11, e12, e13;} + + abstract class A69 { + String s; + } + + class B69 extends A69 { + E69 e; + } + + class C69 { + B69 b69; + } + + class D69 extends A69 { + String s; + } + + class E69 { + Double d; + } + + association [1] A69 <-> E69 [1..*]; + association [1..*] B69 -> C69 [0..1]; + association [1] C69 <-> D69 [1..*]; + association [*] E69 <- C69 [0..1]; + association [1] E69 -> D69 [1..*]; + + + enum G70 {e11, e12, e13;} + + abstract class A70 { + String s; + } + + class B70 extends A70 { + E70 e; + } + + class C70 { + B70 b70; + } + + class D70 extends A70 { + String s; + } + + class E70 { + Double d; + } + + association [1] A70 <-> E70 [1..*]; + association [1..*] B70 -> C70 [0..1]; + association [1] C70 <-> D70 [1..*]; + association [*] E70 <- C70 [0..1]; + association [1] E70 -> D70 [1..*]; + + + enum G71 {e11, e12, e13;} + + abstract class A71 { + String s; + } + + class B71 extends A71 { + E71 e; + } + + class C71 { + B71 b71; + } + + class D71 extends A71 { + String s; + } + + class E71 { + Double d; + } + + association [1] A71 <-> E71 [1..*]; + association [1..*] B71 -> C71 [0..1]; + association [1] C71 <-> D71 [1..*]; + association [*] E71 <- C71 [0..1]; + association [1] E71 -> D71 [1..*]; + + + enum G72 {e11, e12, e13;} + + abstract class A72 { + String s; + } + + class B72 extends A72 { + E72 e; + } + + class C72 { + B72 b72; + } + + class D72 extends A72 { + String s; + } + + class E72 { + Double d; + } + + association [1] A72 <-> E72 [1..*]; + association [1..*] B72 -> C72 [0..1]; + association [1] C72 <-> D72 [1..*]; + association [*] E72 <- C72 [0..1]; + association [1] E72 -> D72 [1..*]; + + + enum G73 {e11, e12, e13;} + + abstract class A73 { + String s; + } + + class B73 extends A73 { + E73 e; + } + + class C73 { + B73 b73; + } + + class D73 extends A73 { + String s; + } + + class E73 { + Double d; + } + + association [1] A73 <-> E73 [1..*]; + association [1..*] B73 -> C73 [0..1]; + association [1] C73 <-> D73 [1..*]; + association [*] E73 <- C73 [0..1]; + association [1] E73 -> D73 [1..*]; + + + enum G74 {e11, e12, e13;} + + abstract class A74 { + String s; + } + + class B74 extends A74 { + E74 e; + } + + class C74 { + B74 b74; + } + + class D74 extends A74 { + String s; + } + + class E74 { + Double d; + } + + association [1] A74 <-> E74 [1..*]; + association [1..*] B74 -> C74 [0..1]; + association [1] C74 <-> D74 [1..*]; + association [*] E74 <- C74 [0..1]; + association [1] E74 -> D74 [1..*]; + + + enum G75 {e11, e12, e13;} + + abstract class A75 { + String s; + } + + class B75 extends A75 { + E75 e; + } + + class C75 { + B75 b75; + } + + class D75 extends A75 { + String s; + } + + class E75 { + Double d; + } + + association [1] A75 <-> E75 [1..*]; + association [1..*] B75 -> C75 [0..1]; + association [1] C75 <-> D75 [1..*]; + association [*] E75 <- C75 [0..1]; + association [1] E75 -> D75 [1..*]; + + + enum G76 {e11, e12, e13;} + + abstract class A76 { + String s; + } + + class B76 extends A76 { + E76 e; + } + + class C76 { + B76 b76; + } + + class D76 extends A76 { + String s; + } + + class E76 { + Double d; + } + + association [1] A76 <-> E76 [1..*]; + association [1..*] B76 -> C76 [0..1]; + association [1] C76 <-> D76 [1..*]; + association [*] E76 <- C76 [0..1]; + association [1] E76 -> D76 [1..*]; + + + enum G77 {e11, e12, e13;} + + abstract class A77 { + String s; + } + + class B77 extends A77 { + E77 e; + } + + class C77 { + B77 b77; + } + + class D77 extends A77 { + String s; + } + + class E77 { + Double d; + } + + association [1] A77 <-> E77 [1..*]; + association [1..*] B77 -> C77 [0..1]; + association [1] C77 <-> D77 [1..*]; + association [*] E77 <- C77 [0..1]; + association [1] E77 -> D77 [1..*]; + + + enum G78 {e11, e12, e13;} + + abstract class A78 { + String s; + } + + class B78 extends A78 { + E78 e; + } + + class C78 { + B78 b78; + } + + class D78 extends A78 { + String s; + } + + class E78 { + Double d; + } + + association [1] A78 <-> E78 [1..*]; + association [1..*] B78 -> C78 [0..1]; + association [1] C78 <-> D78 [1..*]; + association [*] E78 <- C78 [0..1]; + association [1] E78 -> D78 [1..*]; + + + enum G79 {e11, e12, e13;} + + abstract class A79 { + String s; + } + + class B79 extends A79 { + E79 e; + } + + class C79 { + B79 b79; + } + + class D79 extends A79 { + String s; + } + + class E79 { + Double d; + } + + association [1] A79 <-> E79 [1..*]; + association [1..*] B79 -> C79 [0..1]; + association [1] C79 <-> D79 [1..*]; + association [*] E79 <- C79 [0..1]; + association [1] E79 -> D79 [1..*]; + + + enum G80 {e11, e12, e13;} + + abstract class A80 { + String s; + } + + class B80 extends A80 { + E80 e; + } + + class C80 { + B80 b80; + } + + class D80 extends A80 { + String s; + } + + class E80 { + Double d; + } + + association [1] A80 <-> E80 [1..*]; + association [1..*] B80 -> C80 [0..1]; + association [1] C80 <-> D80 [1..*]; + association [*] E80 <- C80 [0..1]; + association [1] E80 -> D80 [1..*]; + + + enum G81 {e11, e12, e13;} + + abstract class A81 { + String s; + } + + class B81 extends A81 { + E81 e; + } + + class C81 { + B81 b81; + } + + class D81 extends A81 { + String s; + } + + class E81 { + Double d; + } + + association [1] A81 <-> E81 [1..*]; + association [1..*] B81 -> C81 [0..1]; + association [1] C81 <-> D81 [1..*]; + association [*] E81 <- C81 [0..1]; + association [1] E81 -> D81 [1..*]; + + + enum G82 {e11, e12, e13;} + + abstract class A82 { + String s; + } + + class B82 extends A82 { + E82 e; + } + + class C82 { + B82 b82; + } + + class D82 extends A82 { + String s; + } + + class E82 { + Double d; + } + + association [1] A82 <-> E82 [1..*]; + association [1..*] B82 -> C82 [0..1]; + association [1] C82 <-> D82 [1..*]; + association [*] E82 <- C82 [0..1]; + association [1] E82 -> D82 [1..*]; + + + enum G83 {e11, e12, e13;} + + abstract class A83 { + String s; + } + + class B83 extends A83 { + E83 e; + } + + class C83 { + B83 b83; + } + + class D83 extends A83 { + String s; + } + + class E83 { + Double d; + } + + association [1] A83 <-> E83 [1..*]; + association [1..*] B83 -> C83 [0..1]; + association [1] C83 <-> D83 [1..*]; + association [*] E83 <- C83 [0..1]; + association [1] E83 -> D83 [1..*]; + + + enum G84 {e11, e12, e13;} + + abstract class A84 { + String s; + } + + class B84 extends A84 { + E84 e; + } + + class C84 { + B84 b84; + } + + class D84 extends A84 { + String s; + } + + class E84 { + Double d; + } + + association [1] A84 <-> E84 [1..*]; + association [1..*] B84 -> C84 [0..1]; + association [1] C84 <-> D84 [1..*]; + association [*] E84 <- C84 [0..1]; + association [1] E84 -> D84 [1..*]; + + + enum G85 {e11, e12, e13;} + + abstract class A85 { + String s; + } + + class B85 extends A85 { + E85 e; + } + + class C85 { + B85 b85; + } + + class D85 extends A85 { + String s; + } + + class E85 { + Double d; + } + + association [1] A85 <-> E85 [1..*]; + association [1..*] B85 -> C85 [0..1]; + association [1] C85 <-> D85 [1..*]; + association [*] E85 <- C85 [0..1]; + association [1] E85 -> D85 [1..*]; + + + enum G86 {e11, e12, e13;} + + abstract class A86 { + String s; + } + + class B86 extends A86 { + E86 e; + } + + class C86 { + B86 b86; + } + + class D86 extends A86 { + String s; + } + + class E86 { + Double d; + } + + association [1] A86 <-> E86 [1..*]; + association [1..*] B86 -> C86 [0..1]; + association [1] C86 <-> D86 [1..*]; + association [*] E86 <- C86 [0..1]; + association [1] E86 -> D86 [1..*]; + + + enum G87 {e11, e12, e13;} + + abstract class A87 { + String s; + } + + class B87 extends A87 { + E87 e; + } + + class C87 { + B87 b87; + } + + class D87 extends A87 { + String s; + } + + class E87 { + Double d; + } + + association [1] A87 <-> E87 [1..*]; + association [1..*] B87 -> C87 [0..1]; + association [1] C87 <-> D87 [1..*]; + association [*] E87 <- C87 [0..1]; + association [1] E87 -> D87 [1..*]; + + + enum G88 {e11, e12, e13;} + + abstract class A88 { + String s; + } + + class B88 extends A88 { + E88 e; + } + + class C88 { + B88 b88; + } + + class D88 extends A88 { + String s; + } + + class E88 { + Double d; + } + + association [1] A88 <-> E88 [1..*]; + association [1..*] B88 -> C88 [0..1]; + association [1] C88 <-> D88 [1..*]; + association [*] E88 <- C88 [0..1]; + association [1] E88 -> D88 [1..*]; + + + enum G89 {e11, e12, e13;} + + abstract class A89 { + String s; + } + + class B89 extends A89 { + E89 e; + } + + class C89 { + B89 b89; + } + + class D89 extends A89 { + String s; + } + + class E89 { + Double d; + } + + association [1] A89 <-> E89 [1..*]; + association [1..*] B89 -> C89 [0..1]; + association [1] C89 <-> D89 [1..*]; + association [*] E89 <- C89 [0..1]; + association [1] E89 -> D89 [1..*]; + + + enum G90 {e11, e12, e13;} + + abstract class A90 { + String s; + } + + class B90 extends A90 { + E90 e; + } + + class C90 { + B90 b90; + } + + class D90 extends A90 { + String s; + } + + class E90 { + Double d; + } + + association [1] A90 <-> E90 [1..*]; + association [1..*] B90 -> C90 [0..1]; + association [1] C90 <-> D90 [1..*]; + association [*] E90 <- C90 [0..1]; + association [1] E90 -> D90 [1..*]; + + + enum G91 {e11, e12, e13;} + + abstract class A91 { + String s; + } + + class B91 extends A91 { + E91 e; + } + + class C91 { + B91 b91; + } + + class D91 extends A91 { + String s; + } + + class E91 { + Double d; + } + + association [1] A91 <-> E91 [1..*]; + association [1..*] B91 -> C91 [0..1]; + association [1] C91 <-> D91 [1..*]; + association [*] E91 <- C91 [0..1]; + association [1] E91 -> D91 [1..*]; + + + enum G92 {e11, e12, e13;} + + abstract class A92 { + String s; + } + + class B92 extends A92 { + E92 e; + } + + class C92 { + B92 b92; + } + + class D92 extends A92 { + String s; + } + + class E92 { + Double d; + } + + association [1] A92 <-> E92 [1..*]; + association [1..*] B92 -> C92 [0..1]; + association [1] C92 <-> D92 [1..*]; + association [*] E92 <- C92 [0..1]; + association [1] E92 -> D92 [1..*]; + + + enum G93 {e11, e12, e13;} + + abstract class A93 { + String s; + } + + class B93 extends A93 { + E93 e; + } + + class C93 { + B93 b93; + } + + class D93 extends A93 { + String s; + } + + class E93 { + Double d; + } + + association [1] A93 <-> E93 [1..*]; + association [1..*] B93 -> C93 [0..1]; + association [1] C93 <-> D93 [1..*]; + association [*] E93 <- C93 [0..1]; + association [1] E93 -> D93 [1..*]; + + + enum G94 {e11, e12, e13;} + + abstract class A94 { + String s; + } + + class B94 extends A94 { + E94 e; + } + + class C94 { + B94 b94; + } + + class D94 extends A94 { + String s; + } + + class E94 { + Double d; + } + + association [1] A94 <-> E94 [1..*]; + association [1..*] B94 -> C94 [0..1]; + association [1] C94 <-> D94 [1..*]; + association [*] E94 <- C94 [0..1]; + association [1] E94 -> D94 [1..*]; + + + enum G95 {e11, e12, e13;} + + abstract class A95 { + String s; + } + + class B95 extends A95 { + E95 e; + } + + class C95 { + B95 b95; + } + + class D95 extends A95 { + String s; + } + + class E95 { + Double d; + } + + association [1] A95 <-> E95 [1..*]; + association [1..*] B95 -> C95 [0..1]; + association [1] C95 <-> D95 [1..*]; + association [*] E95 <- C95 [0..1]; + association [1] E95 -> D95 [1..*]; + + + enum G96 {e11, e12, e13;} + + abstract class A96 { + String s; + } + + class B96 extends A96 { + E96 e; + } + + class C96 { + B96 b96; + } + + class D96 extends A96 { + String s; + } + + class E96 { + Double d; + } + + association [1] A96 <-> E96 [1..*]; + association [1..*] B96 -> C96 [0..1]; + association [1] C96 <-> D96 [1..*]; + association [*] E96 <- C96 [0..1]; + association [1] E96 -> D96 [1..*]; + + + enum G97 {e11, e12, e13;} + + abstract class A97 { + String s; + } + + class B97 extends A97 { + E97 e; + } + + class C97 { + B97 b97; + } + + class D97 extends A97 { + String s; + } + + class E97 { + Double d; + } + + association [1] A97 <-> E97 [1..*]; + association [1..*] B97 -> C97 [0..1]; + association [1] C97 <-> D97 [1..*]; + association [*] E97 <- C97 [0..1]; + association [1] E97 -> D97 [1..*]; + + + enum G98 {e11, e12, e13;} + + abstract class A98 { + String s; + } + + class B98 extends A98 { + E98 e; + } + + class C98 { + B98 b98; + } + + class D98 extends A98 { + String s; + } + + class E98 { + Double d; + } + + association [1] A98 <-> E98 [1..*]; + association [1..*] B98 -> C98 [0..1]; + association [1] C98 <-> D98 [1..*]; + association [*] E98 <- C98 [0..1]; + association [1] E98 -> D98 [1..*]; + + + enum G99 {e11, e12, e13;} + + abstract class A99 { + String s; + } + + class B99 extends A99 { + E99 e; + } + + class C99 { + B99 b99; + } + + class D99 extends A99 { + String s; + } + + class E99 { + Double d; + } + + association [1] A99 <-> E99 [1..*]; + association [1..*] B99 -> C99 [0..1]; + association [1] C99 <-> D99 [1..*]; + association [*] E99 <- C99 [0..1]; + association [1] E99 -> D99 [1..*]; + + + enum G100 {e11, e12, e13;} + + abstract class A100 { + String s; + } + + class B100 extends A100 { + E100 e; + } + + class C100 { + B100 b100; + } + + class D100 extends A100 { + String s; + } + + class E100 { + Double d; + } + + association [1] A100 <-> E100 [1..*]; + association [1..*] B100 -> C100 [0..1]; + association [1] C100 <-> D100 [1..*]; + association [*] E100 <- C100 [0..1]; + association [1] E100 -> D100 [1..*]; + + + enum G101 {e11, e12, e13;} + + abstract class A101 { + String s; + } + + class B101 extends A101 { + E101 e; + } + + class C101 { + B101 b101; + } + + class D101 extends A101 { + String s; + } + + class E101 { + Double d; + } + + association [1] A101 <-> E101 [1..*]; + association [1..*] B101 -> C101 [0..1]; + association [1] C101 <-> D101 [1..*]; + association [*] E101 <- C101 [0..1]; + association [1] E101 -> D101 [1..*]; + + + enum G102 {e11, e12, e13;} + + abstract class A102 { + String s; + } + + class B102 extends A102 { + E102 e; + } + + class C102 { + B102 b102; + } + + class D102 extends A102 { + String s; + } + + class E102 { + Double d; + } + + association [1] A102 <-> E102 [1..*]; + association [1..*] B102 -> C102 [0..1]; + association [1] C102 <-> D102 [1..*]; + association [*] E102 <- C102 [0..1]; + association [1] E102 -> D102 [1..*]; + + + enum G103 {e11, e12, e13;} + + abstract class A103 { + String s; + } + + class B103 extends A103 { + E103 e; + } + + class C103 { + B103 b103; + } + + class D103 extends A103 { + String s; + } + + class E103 { + Double d; + } + + association [1] A103 <-> E103 [1..*]; + association [1..*] B103 -> C103 [0..1]; + association [1] C103 <-> D103 [1..*]; + association [*] E103 <- C103 [0..1]; + association [1] E103 -> D103 [1..*]; + + + enum G104 {e11, e12, e13;} + + abstract class A104 { + String s; + } + + class B104 extends A104 { + E104 e; + } + + class C104 { + B104 b104; + } + + class D104 extends A104 { + String s; + } + + class E104 { + Double d; + } + + association [1] A104 <-> E104 [1..*]; + association [1..*] B104 -> C104 [0..1]; + association [1] C104 <-> D104 [1..*]; + association [*] E104 <- C104 [0..1]; + association [1] E104 -> D104 [1..*]; + + + enum G105 {e11, e12, e13;} + + abstract class A105 { + String s; + } + + class B105 extends A105 { + E105 e; + } + + class C105 { + B105 b105; + } + + class D105 extends A105 { + String s; + } + + class E105 { + Double d; + } + + association [1] A105 <-> E105 [1..*]; + association [1..*] B105 -> C105 [0..1]; + association [1] C105 <-> D105 [1..*]; + association [*] E105 <- C105 [0..1]; + association [1] E105 -> D105 [1..*]; + + + enum G106 {e11, e12, e13;} + + abstract class A106 { + String s; + } + + class B106 extends A106 { + E106 e; + } + + class C106 { + B106 b106; + } + + class D106 extends A106 { + String s; + } + + class E106 { + Double d; + } + + association [1] A106 <-> E106 [1..*]; + association [1..*] B106 -> C106 [0..1]; + association [1] C106 <-> D106 [1..*]; + association [*] E106 <- C106 [0..1]; + association [1] E106 -> D106 [1..*]; + + + enum G107 {e11, e12, e13;} + + abstract class A107 { + String s; + } + + class B107 extends A107 { + E107 e; + } + + class C107 { + B107 b107; + } + + class D107 extends A107 { + String s; + } + + class E107 { + Double d; + } + + association [1] A107 <-> E107 [1..*]; + association [1..*] B107 -> C107 [0..1]; + association [1] C107 <-> D107 [1..*]; + association [*] E107 <- C107 [0..1]; + association [1] E107 -> D107 [1..*]; + + + enum G108 {e11, e12, e13;} + + abstract class A108 { + String s; + } + + class B108 extends A108 { + E108 e; + } + + class C108 { + B108 b108; + } + + class D108 extends A108 { + String s; + } + + class E108 { + Double d; + } + + association [1] A108 <-> E108 [1..*]; + association [1..*] B108 -> C108 [0..1]; + association [1] C108 <-> D108 [1..*]; + association [*] E108 <- C108 [0..1]; + association [1] E108 -> D108 [1..*]; + + + enum G109 {e11, e12, e13;} + + abstract class A109 { + String s; + } + + class B109 extends A109 { + E109 e; + } + + class C109 { + B109 b109; + } + + class D109 extends A109 { + String s; + } + + class E109 { + Double d; + } + + association [1] A109 <-> E109 [1..*]; + association [1..*] B109 -> C109 [0..1]; + association [1] C109 <-> D109 [1..*]; + association [*] E109 <- C109 [0..1]; + association [1] E109 -> D109 [1..*]; + + + enum G110 {e11, e12, e13;} + + abstract class A110 { + String s; + } + + class B110 extends A110 { + E110 e; + } + + class C110 { + B110 b110; + } + + class D110 extends A110 { + String s; + } + + class E110 { + Double d; + } + + association [1] A110 <-> E110 [1..*]; + association [1..*] B110 -> C110 [0..1]; + association [1] C110 <-> D110 [1..*]; + association [*] E110 <- C110 [0..1]; + association [1] E110 -> D110 [1..*]; + + + enum G111 {e11, e12, e13;} + + abstract class A111 { + String s; + } + + class B111 extends A111 { + E111 e; + } + + class C111 { + B111 b111; + } + + class D111 extends A111 { + String s; + } + + class E111 { + Double d; + } + + association [1] A111 <-> E111 [1..*]; + association [1..*] B111 -> C111 [0..1]; + association [1] C111 <-> D111 [1..*]; + association [*] E111 <- C111 [0..1]; + association [1] E111 -> D111 [1..*]; + + + enum G112 {e11, e12, e13;} + + abstract class A112 { + String s; + } + + class B112 extends A112 { + E112 e; + } + + class C112 { + B112 b112; + } + + class D112 extends A112 { + String s; + } + + class E112 { + Double d; + } + + association [1] A112 <-> E112 [1..*]; + association [1..*] B112 -> C112 [0..1]; + association [1] C112 <-> D112 [1..*]; + association [*] E112 <- C112 [0..1]; + association [1] E112 -> D112 [1..*]; + + + enum G113 {e11, e12, e13;} + + abstract class A113 { + String s; + } + + class B113 extends A113 { + E113 e; + } + + class C113 { + B113 b113; + } + + class D113 extends A113 { + String s; + } + + class E113 { + Double d; + } + + association [1] A113 <-> E113 [1..*]; + association [1..*] B113 -> C113 [0..1]; + association [1] C113 <-> D113 [1..*]; + association [*] E113 <- C113 [0..1]; + association [1] E113 -> D113 [1..*]; + + + enum G114 {e11, e12, e13;} + + abstract class A114 { + String s; + } + + class B114 extends A114 { + E114 e; + } + + class C114 { + B114 b114; + } + + class D114 extends A114 { + String s; + } + + class E114 { + Double d; + } + + association [1] A114 <-> E114 [1..*]; + association [1..*] B114 -> C114 [0..1]; + association [1] C114 <-> D114 [1..*]; + association [*] E114 <- C114 [0..1]; + association [1] E114 -> D114 [1..*]; + + + enum G115 {e11, e12, e13;} + + abstract class A115 { + String s; + } + + class B115 extends A115 { + E115 e; + } + + class C115 { + B115 b115; + } + + class D115 extends A115 { + String s; + } + + class E115 { + Double d; + } + + association [1] A115 <-> E115 [1..*]; + association [1..*] B115 -> C115 [0..1]; + association [1] C115 <-> D115 [1..*]; + association [*] E115 <- C115 [0..1]; + association [1] E115 -> D115 [1..*]; + + + enum G116 {e11, e12, e13;} + + abstract class A116 { + String s; + } + + class B116 extends A116 { + E116 e; + } + + class C116 { + B116 b116; + } + + class D116 extends A116 { + String s; + } + + class E116 { + Double d; + } + + association [1] A116 <-> E116 [1..*]; + association [1..*] B116 -> C116 [0..1]; + association [1] C116 <-> D116 [1..*]; + association [*] E116 <- C116 [0..1]; + association [1] E116 -> D116 [1..*]; + + + enum G117 {e11, e12, e13;} + + abstract class A117 { + String s; + } + + class B117 extends A117 { + E117 e; + } + + class C117 { + B117 b117; + } + + class D117 extends A117 { + String s; + } + + class E117 { + Double d; + } + + association [1] A117 <-> E117 [1..*]; + association [1..*] B117 -> C117 [0..1]; + association [1] C117 <-> D117 [1..*]; + association [*] E117 <- C117 [0..1]; + association [1] E117 -> D117 [1..*]; + + + enum G118 {e11, e12, e13;} + + abstract class A118 { + String s; + } + + class B118 extends A118 { + E118 e; + } + + class C118 { + B118 b118; + } + + class D118 extends A118 { + String s; + } + + class E118 { + Double d; + } + + association [1] A118 <-> E118 [1..*]; + association [1..*] B118 -> C118 [0..1]; + association [1] C118 <-> D118 [1..*]; + association [*] E118 <- C118 [0..1]; + association [1] E118 -> D118 [1..*]; + + + enum G119 {e11, e12, e13;} + + abstract class A119 { + String s; + } + + class B119 extends A119 { + E119 e; + } + + class C119 { + B119 b119; + } + + class D119 extends A119 { + String s; + } + + class E119 { + Double d; + } + + association [1] A119 <-> E119 [1..*]; + association [1..*] B119 -> C119 [0..1]; + association [1] C119 <-> D119 [1..*]; + association [*] E119 <- C119 [0..1]; + association [1] E119 -> D119 [1..*]; + + + enum G120 {e11, e12, e13;} + + abstract class A120 { + String s; + } + + class B120 extends A120 { + E120 e; + } + + class C120 { + B120 b120; + } + + class D120 extends A120 { + String s; + } + + class E120 { + Double d; + } + + association [1] A120 <-> E120 [1..*]; + association [1..*] B120 -> C120 [0..1]; + association [1] C120 <-> D120 [1..*]; + association [*] E120 <- C120 [0..1]; + association [1] E120 -> D120 [1..*]; + + + enum G121 {e11, e12, e13;} + + abstract class A121 { + String s; + } + + class B121 extends A121 { + E121 e; + } + + class C121 { + B121 b121; + } + + class D121 extends A121 { + String s; + } + + class E121 { + Double d; + } + + association [1] A121 <-> E121 [1..*]; + association [1..*] B121 -> C121 [0..1]; + association [1] C121 <-> D121 [1..*]; + association [*] E121 <- C121 [0..1]; + association [1] E121 -> D121 [1..*]; + + + enum G122 {e11, e12, e13;} + + abstract class A122 { + String s; + } + + class B122 extends A122 { + E122 e; + } + + class C122 { + B122 b122; + } + + class D122 extends A122 { + String s; + } + + class E122 { + Double d; + } + + association [1] A122 <-> E122 [1..*]; + association [1..*] B122 -> C122 [0..1]; + association [1] C122 <-> D122 [1..*]; + association [*] E122 <- C122 [0..1]; + association [1] E122 -> D122 [1..*]; + + + enum G123 {e11, e12, e13;} + + abstract class A123 { + String s; + } + + class B123 extends A123 { + E123 e; + } + + class C123 { + B123 b123; + } + + class D123 extends A123 { + String s; + } + + class E123 { + Double d; + } + + association [1] A123 <-> E123 [1..*]; + association [1..*] B123 -> C123 [0..1]; + association [1] C123 <-> D123 [1..*]; + association [*] E123 <- C123 [0..1]; + association [1] E123 -> D123 [1..*]; + + + enum G124 {e11, e12, e13;} + + abstract class A124 { + String s; + } + + class B124 extends A124 { + E124 e; + } + + class C124 { + B124 b124; + } + + class D124 extends A124 { + String s; + } + + class E124 { + Double d; + } + + association [1] A124 <-> E124 [1..*]; + association [1..*] B124 -> C124 [0..1]; + association [1] C124 <-> D124 [1..*]; + association [*] E124 <- C124 [0..1]; + association [1] E124 -> D124 [1..*]; + + + enum G125 {e11, e12, e13;} + + abstract class A125 { + String s; + } + + class B125 extends A125 { + E125 e; + } + + class C125 { + B125 b125; + } + + class D125 extends A125 { + String s; + } + + class E125 { + Double d; + } + + association [1] A125 <-> E125 [1..*]; + association [1..*] B125 -> C125 [0..1]; + association [1] C125 <-> D125 [1..*]; + association [*] E125 <- C125 [0..1]; + association [1] E125 -> D125 [1..*]; + + + enum G126 {e11, e12, e13;} + + abstract class A126 { + String s; + } + + class B126 extends A126 { + E126 e; + } + + class C126 { + B126 b126; + } + + class D126 extends A126 { + String s; + } + + class E126 { + Double d; + } + + association [1] A126 <-> E126 [1..*]; + association [1..*] B126 -> C126 [0..1]; + association [1] C126 <-> D126 [1..*]; + association [*] E126 <- C126 [0..1]; + association [1] E126 -> D126 [1..*]; + + + enum G127 {e11, e12, e13;} + + abstract class A127 { + String s; + } + + class B127 extends A127 { + E127 e; + } + + class C127 { + B127 b127; + } + + class D127 extends A127 { + String s; + } + + class E127 { + Double d; + } + + association [1] A127 <-> E127 [1..*]; + association [1..*] B127 -> C127 [0..1]; + association [1] C127 <-> D127 [1..*]; + association [*] E127 <- C127 [0..1]; + association [1] E127 -> D127 [1..*]; + + + enum G128 {e11, e12, e13;} + + abstract class A128 { + String s; + } + + class B128 extends A128 { + E128 e; + } + + class C128 { + B128 b128; + } + + class D128 extends A128 { + String s; + } + + class E128 { + Double d; + } + + association [1] A128 <-> E128 [1..*]; + association [1..*] B128 -> C128 [0..1]; + association [1] C128 <-> D128 [1..*]; + association [*] E128 <- C128 [0..1]; + association [1] E128 -> D128 [1..*]; + + + enum G129 {e11, e12, e13;} + + abstract class A129 { + String s; + } + + class B129 extends A129 { + E129 e; + } + + class C129 { + B129 b129; + } + + class D129 extends A129 { + String s; + } + + class E129 { + Double d; + } + + association [1] A129 <-> E129 [1..*]; + association [1..*] B129 -> C129 [0..1]; + association [1] C129 <-> D129 [1..*]; + association [*] E129 <- C129 [0..1]; + association [1] E129 -> D129 [1..*]; + + + enum G130 {e11, e12, e13;} + + abstract class A130 { + String s; + } + + class B130 extends A130 { + E130 e; + } + + class C130 { + B130 b130; + } + + class D130 extends A130 { + String s; + } + + class E130 { + Double d; + } + + association [1] A130 <-> E130 [1..*]; + association [1..*] B130 -> C130 [0..1]; + association [1] C130 <-> D130 [1..*]; + association [*] E130 <- C130 [0..1]; + association [1] E130 -> D130 [1..*]; + + + enum G131 {e11, e12, e13;} + + abstract class A131 { + String s; + } + + class B131 extends A131 { + E131 e; + } + + class C131 { + B131 b131; + } + + class D131 extends A131 { + String s; + } + + class E131 { + Double d; + } + + association [1] A131 <-> E131 [1..*]; + association [1..*] B131 -> C131 [0..1]; + association [1] C131 <-> D131 [1..*]; + association [*] E131 <- C131 [0..1]; + association [1] E131 -> D131 [1..*]; + + + enum G132 {e11, e12, e13;} + + abstract class A132 { + String s; + } + + class B132 extends A132 { + E132 e; + } + + class C132 { + B132 b132; + } + + class D132 extends A132 { + String s; + } + + class E132 { + Double d; + } + + association [1] A132 <-> E132 [1..*]; + association [1..*] B132 -> C132 [0..1]; + association [1] C132 <-> D132 [1..*]; + association [*] E132 <- C132 [0..1]; + association [1] E132 -> D132 [1..*]; + + + enum G133 {e11, e12, e13;} + + abstract class A133 { + String s; + } + + class B133 extends A133 { + E133 e; + } + + class C133 { + B133 b133; + } + + class D133 extends A133 { + String s; + } + + class E133 { + Double d; + } + + association [1] A133 <-> E133 [1..*]; + association [1..*] B133 -> C133 [0..1]; + association [1] C133 <-> D133 [1..*]; + association [*] E133 <- C133 [0..1]; + association [1] E133 -> D133 [1..*]; + + + enum G134 {e11, e12, e13;} + + abstract class A134 { + String s; + } + + class B134 extends A134 { + E134 e; + } + + class C134 { + B134 b134; + } + + class D134 extends A134 { + String s; + } + + class E134 { + Double d; + } + + association [1] A134 <-> E134 [1..*]; + association [1..*] B134 -> C134 [0..1]; + association [1] C134 <-> D134 [1..*]; + association [*] E134 <- C134 [0..1]; + association [1] E134 -> D134 [1..*]; + + + enum G135 {e11, e12, e13;} + + abstract class A135 { + String s; + } + + class B135 extends A135 { + E135 e; + } + + class C135 { + B135 b135; + } + + class D135 extends A135 { + String s; + } + + class E135 { + Double d; + } + + association [1] A135 <-> E135 [1..*]; + association [1..*] B135 -> C135 [0..1]; + association [1] C135 <-> D135 [1..*]; + association [*] E135 <- C135 [0..1]; + association [1] E135 -> D135 [1..*]; + + + enum G136 {e11, e12, e13;} + + abstract class A136 { + String s; + } + + class B136 extends A136 { + E136 e; + } + + class C136 { + B136 b136; + } + + class D136 extends A136 { + String s; + } + + class E136 { + Double d; + } + + association [1] A136 <-> E136 [1..*]; + association [1..*] B136 -> C136 [0..1]; + association [1] C136 <-> D136 [1..*]; + association [*] E136 <- C136 [0..1]; + association [1] E136 -> D136 [1..*]; + + + enum G137 {e11, e12, e13;} + + abstract class A137 { + String s; + } + + class B137 extends A137 { + E137 e; + } + + class C137 { + B137 b137; + } + + class D137 extends A137 { + String s; + } + + class E137 { + Double d; + } + + association [1] A137 <-> E137 [1..*]; + association [1..*] B137 -> C137 [0..1]; + association [1] C137 <-> D137 [1..*]; + association [*] E137 <- C137 [0..1]; + association [1] E137 -> D137 [1..*]; + + + enum G138 {e11, e12, e13;} + + abstract class A138 { + String s; + } + + class B138 extends A138 { + E138 e; + } + + class C138 { + B138 b138; + } + + class D138 extends A138 { + String s; + } + + class E138 { + Double d; + } + + association [1] A138 <-> E138 [1..*]; + association [1..*] B138 -> C138 [0..1]; + association [1] C138 <-> D138 [1..*]; + association [*] E138 <- C138 [0..1]; + association [1] E138 -> D138 [1..*]; + + + enum G139 {e11, e12, e13;} + + abstract class A139 { + String s; + } + + class B139 extends A139 { + E139 e; + } + + class C139 { + B139 b139; + } + + class D139 extends A139 { + String s; + } + + class E139 { + Double d; + } + + association [1] A139 <-> E139 [1..*]; + association [1..*] B139 -> C139 [0..1]; + association [1] C139 <-> D139 [1..*]; + association [*] E139 <- C139 [0..1]; + association [1] E139 -> D139 [1..*]; + + + enum G140 {e11, e12, e13;} + + abstract class A140 { + String s; + } + + class B140 extends A140 { + E140 e; + } + + class C140 { + B140 b140; + } + + class D140 extends A140 { + String s; + } + + class E140 { + Double d; + } + + association [1] A140 <-> E140 [1..*]; + association [1..*] B140 -> C140 [0..1]; + association [1] C140 <-> D140 [1..*]; + association [*] E140 <- C140 [0..1]; + association [1] E140 -> D140 [1..*]; + + + enum G141 {e11, e12, e13;} + + abstract class A141 { + String s; + } + + class B141 extends A141 { + E141 e; + } + + class C141 { + B141 b141; + } + + class D141 extends A141 { + String s; + } + + class E141 { + Double d; + } + + association [1] A141 <-> E141 [1..*]; + association [1..*] B141 -> C141 [0..1]; + association [1] C141 <-> D141 [1..*]; + association [*] E141 <- C141 [0..1]; + association [1] E141 -> D141 [1..*]; + + + enum G142 {e11, e12, e13;} + + abstract class A142 { + String s; + } + + class B142 extends A142 { + E142 e; + } + + class C142 { + B142 b142; + } + + class D142 extends A142 { + String s; + } + + class E142 { + Double d; + } + + association [1] A142 <-> E142 [1..*]; + association [1..*] B142 -> C142 [0..1]; + association [1] C142 <-> D142 [1..*]; + association [*] E142 <- C142 [0..1]; + association [1] E142 -> D142 [1..*]; + + + enum G143 {e11, e12, e13;} + + abstract class A143 { + String s; + } + + class B143 extends A143 { + E143 e; + } + + class C143 { + B143 b143; + } + + class D143 extends A143 { + String s; + } + + class E143 { + Double d; + } + + association [1] A143 <-> E143 [1..*]; + association [1..*] B143 -> C143 [0..1]; + association [1] C143 <-> D143 [1..*]; + association [*] E143 <- C143 [0..1]; + association [1] E143 -> D143 [1..*]; + + + enum G144 {e11, e12, e13;} + + abstract class A144 { + String s; + } + + class B144 extends A144 { + E144 e; + } + + class C144 { + B144 b144; + } + + class D144 extends A144 { + String s; + } + + class E144 { + Double d; + } + + association [1] A144 <-> E144 [1..*]; + association [1..*] B144 -> C144 [0..1]; + association [1] C144 <-> D144 [1..*]; + association [*] E144 <- C144 [0..1]; + association [1] E144 -> D144 [1..*]; + + + enum G145 {e11, e12, e13;} + + abstract class A145 { + String s; + } + + class B145 extends A145 { + E145 e; + } + + class C145 { + B145 b145; + } + + class D145 extends A145 { + String s; + } + + class E145 { + Double d; + } + + association [1] A145 <-> E145 [1..*]; + association [1..*] B145 -> C145 [0..1]; + association [1] C145 <-> D145 [1..*]; + association [*] E145 <- C145 [0..1]; + association [1] E145 -> D145 [1..*]; + + + enum G146 {e11, e12, e13;} + + abstract class A146 { + String s; + } + + class B146 extends A146 { + E146 e; + } + + class C146 { + B146 b146; + } + + class D146 extends A146 { + String s; + } + + class E146 { + Double d; + } + + association [1] A146 <-> E146 [1..*]; + association [1..*] B146 -> C146 [0..1]; + association [1] C146 <-> D146 [1..*]; + association [*] E146 <- C146 [0..1]; + association [1] E146 -> D146 [1..*]; + + + enum G147 {e11, e12, e13;} + + abstract class A147 { + String s; + } + + class B147 extends A147 { + E147 e; + } + + class C147 { + B147 b147; + } + + class D147 extends A147 { + String s; + } + + class E147 { + Double d; + } + + association [1] A147 <-> E147 [1..*]; + association [1..*] B147 -> C147 [0..1]; + association [1] C147 <-> D147 [1..*]; + association [*] E147 <- C147 [0..1]; + association [1] E147 -> D147 [1..*]; + + + enum G148 {e11, e12, e13;} + + abstract class A148 { + String s; + } + + class B148 extends A148 { + E148 e; + } + + class C148 { + B148 b148; + } + + class D148 extends A148 { + String s; + } + + class E148 { + Double d; + } + + association [1] A148 <-> E148 [1..*]; + association [1..*] B148 -> C148 [0..1]; + association [1] C148 <-> D148 [1..*]; + association [*] E148 <- C148 [0..1]; + association [1] E148 -> D148 [1..*]; + + + enum G149 {e11, e12, e13;} + + abstract class A149 { + String s; + } + + class B149 extends A149 { + E149 e; + } + + class C149 { + B149 b149; + } + + class D149 extends A149 { + String s; + } + + class E149 { + Double d; + } + + association [1] A149 <-> E149 [1..*]; + association [1..*] B149 -> C149 [0..1]; + association [1] C149 <-> D149 [1..*]; + association [*] E149 <- C149 [0..1]; + association [1] E149 -> D149 [1..*]; + + + enum G150 {e11, e12, e13;} + + abstract class A150 { + String s; + } + + class B150 extends A150 { + E150 e; + } + + class C150 { + B150 b150; + } + + class D150 extends A150 { + String s; + } + + class E150 { + Double d; + } + + association [1] A150 <-> E150 [1..*]; + association [1..*] B150 -> C150 [0..1]; + association [1] C150 <-> D150 [1..*]; + association [*] E150 <- C150 [0..1]; + association [1] E150 -> D150 [1..*]; + + + enum G151 {e11, e12, e13;} + + abstract class A151 { + String s; + } + + class B151 extends A151 { + E151 e; + } + + class C151 { + B151 b151; + } + + class D151 extends A151 { + String s; + } + + class E151 { + Double d; + } + + association [1] A151 <-> E151 [1..*]; + association [1..*] B151 -> C151 [0..1]; + association [1] C151 <-> D151 [1..*]; + association [*] E151 <- C151 [0..1]; + association [1] E151 -> D151 [1..*]; + + + enum G152 {e11, e12, e13;} + + abstract class A152 { + String s; + } + + class B152 extends A152 { + E152 e; + } + + class C152 { + B152 b152; + } + + class D152 extends A152 { + String s; + } + + class E152 { + Double d; + } + + association [1] A152 <-> E152 [1..*]; + association [1..*] B152 -> C152 [0..1]; + association [1] C152 <-> D152 [1..*]; + association [*] E152 <- C152 [0..1]; + association [1] E152 -> D152 [1..*]; + + + enum G153 {e11, e12, e13;} + + abstract class A153 { + String s; + } + + class B153 extends A153 { + E153 e; + } + + class C153 { + B153 b153; + } + + class D153 extends A153 { + String s; + } + + class E153 { + Double d; + } + + association [1] A153 <-> E153 [1..*]; + association [1..*] B153 -> C153 [0..1]; + association [1] C153 <-> D153 [1..*]; + association [*] E153 <- C153 [0..1]; + association [1] E153 -> D153 [1..*]; + + + enum G154 {e11, e12, e13;} + + abstract class A154 { + String s; + } + + class B154 extends A154 { + E154 e; + } + + class C154 { + B154 b154; + } + + class D154 extends A154 { + String s; + } + + class E154 { + Double d; + } + + association [1] A154 <-> E154 [1..*]; + association [1..*] B154 -> C154 [0..1]; + association [1] C154 <-> D154 [1..*]; + association [*] E154 <- C154 [0..1]; + association [1] E154 -> D154 [1..*]; + + + enum G155 {e11, e12, e13;} + + abstract class A155 { + String s; + } + + class B155 extends A155 { + E155 e; + } + + class C155 { + B155 b155; + } + + class D155 extends A155 { + String s; + } + + class E155 { + Double d; + } + + association [1] A155 <-> E155 [1..*]; + association [1..*] B155 -> C155 [0..1]; + association [1] C155 <-> D155 [1..*]; + association [*] E155 <- C155 [0..1]; + association [1] E155 -> D155 [1..*]; + + + enum G156 {e11, e12, e13;} + + abstract class A156 { + String s; + } + + class B156 extends A156 { + E156 e; + } + + class C156 { + B156 b156; + } + + class D156 extends A156 { + String s; + } + + class E156 { + Double d; + } + + association [1] A156 <-> E156 [1..*]; + association [1..*] B156 -> C156 [0..1]; + association [1] C156 <-> D156 [1..*]; + association [*] E156 <- C156 [0..1]; + association [1] E156 -> D156 [1..*]; + + + enum G157 {e11, e12, e13;} + + abstract class A157 { + String s; + } + + class B157 extends A157 { + E157 e; + } + + class C157 { + B157 b157; + } + + class D157 extends A157 { + String s; + } + + class E157 { + Double d; + } + + association [1] A157 <-> E157 [1..*]; + association [1..*] B157 -> C157 [0..1]; + association [1] C157 <-> D157 [1..*]; + association [*] E157 <- C157 [0..1]; + association [1] E157 -> D157 [1..*]; + + + enum G158 {e11, e12, e13;} + + abstract class A158 { + String s; + } + + class B158 extends A158 { + E158 e; + } + + class C158 { + B158 b158; + } + + class D158 extends A158 { + String s; + } + + class E158 { + Double d; + } + + association [1] A158 <-> E158 [1..*]; + association [1..*] B158 -> C158 [0..1]; + association [1] C158 <-> D158 [1..*]; + association [*] E158 <- C158 [0..1]; + association [1] E158 -> D158 [1..*]; + + + enum G159 {e11, e12, e13;} + + abstract class A159 { + String s; + } + + class B159 extends A159 { + E159 e; + } + + class C159 { + B159 b159; + } + + class D159 extends A159 { + String s; + } + + class E159 { + Double d; + } + + association [1] A159 <-> E159 [1..*]; + association [1..*] B159 -> C159 [0..1]; + association [1] C159 <-> D159 [1..*]; + association [*] E159 <- C159 [0..1]; + association [1] E159 -> D159 [1..*]; + + + enum G160 {e11, e12, e13;} + + abstract class A160 { + String s; + } + + class B160 extends A160 { + E160 e; + } + + class C160 { + B160 b160; + } + + class D160 extends A160 { + String s; + } + + class E160 { + Double d; + } + + association [1] A160 <-> E160 [1..*]; + association [1..*] B160 -> C160 [0..1]; + association [1] C160 <-> D160 [1..*]; + association [*] E160 <- C160 [0..1]; + association [1] E160 -> D160 [1..*]; + + + enum G161 {e11, e12, e13;} + + abstract class A161 { + String s; + } + + class B161 extends A161 { + E161 e; + } + + class C161 { + B161 b161; + } + + class D161 extends A161 { + String s; + } + + class E161 { + Double d; + } + + association [1] A161 <-> E161 [1..*]; + association [1..*] B161 -> C161 [0..1]; + association [1] C161 <-> D161 [1..*]; + association [*] E161 <- C161 [0..1]; + association [1] E161 -> D161 [1..*]; + + + enum G162 {e11, e12, e13;} + + abstract class A162 { + String s; + } + + class B162 extends A162 { + E162 e; + } + + class C162 { + B162 b162; + } + + class D162 extends A162 { + String s; + } + + class E162 { + Double d; + } + + association [1] A162 <-> E162 [1..*]; + association [1..*] B162 -> C162 [0..1]; + association [1] C162 <-> D162 [1..*]; + association [*] E162 <- C162 [0..1]; + association [1] E162 -> D162 [1..*]; + + + enum G163 {e11, e12, e13;} + + abstract class A163 { + String s; + } + + class B163 extends A163 { + E163 e; + } + + class C163 { + B163 b163; + } + + class D163 extends A163 { + String s; + } + + class E163 { + Double d; + } + + association [1] A163 <-> E163 [1..*]; + association [1..*] B163 -> C163 [0..1]; + association [1] C163 <-> D163 [1..*]; + association [*] E163 <- C163 [0..1]; + association [1] E163 -> D163 [1..*]; + + + enum G164 {e11, e12, e13;} + + abstract class A164 { + String s; + } + + class B164 extends A164 { + E164 e; + } + + class C164 { + B164 b164; + } + + class D164 extends A164 { + String s; + } + + class E164 { + Double d; + } + + association [1] A164 <-> E164 [1..*]; + association [1..*] B164 -> C164 [0..1]; + association [1] C164 <-> D164 [1..*]; + association [*] E164 <- C164 [0..1]; + association [1] E164 -> D164 [1..*]; + + + enum G165 {e11, e12, e13;} + + abstract class A165 { + String s; + } + + class B165 extends A165 { + E165 e; + } + + class C165 { + B165 b165; + } + + class D165 extends A165 { + String s; + } + + class E165 { + Double d; + } + + association [1] A165 <-> E165 [1..*]; + association [1..*] B165 -> C165 [0..1]; + association [1] C165 <-> D165 [1..*]; + association [*] E165 <- C165 [0..1]; + association [1] E165 -> D165 [1..*]; + + + enum G166 {e11, e12, e13;} + + abstract class A166 { + String s; + } + + class B166 extends A166 { + E166 e; + } + + class C166 { + B166 b166; + } + + class D166 extends A166 { + String s; + } + + class E166 { + Double d; + } + + association [1] A166 <-> E166 [1..*]; + association [1..*] B166 -> C166 [0..1]; + association [1] C166 <-> D166 [1..*]; + association [*] E166 <- C166 [0..1]; + association [1] E166 -> D166 [1..*]; + + + enum G167 {e11, e12, e13;} + + abstract class A167 { + String s; + } + + class B167 extends A167 { + E167 e; + } + + class C167 { + B167 b167; + } + + class D167 extends A167 { + String s; + } + + class E167 { + Double d; + } + + association [1] A167 <-> E167 [1..*]; + association [1..*] B167 -> C167 [0..1]; + association [1] C167 <-> D167 [1..*]; + association [*] E167 <- C167 [0..1]; + association [1] E167 -> D167 [1..*]; + + + enum G168 {e11, e12, e13;} + + abstract class A168 { + String s; + } + + class B168 extends A168 { + E168 e; + } + + class C168 { + B168 b168; + } + + class D168 extends A168 { + String s; + } + + class E168 { + Double d; + } + + association [1] A168 <-> E168 [1..*]; + association [1..*] B168 -> C168 [0..1]; + association [1] C168 <-> D168 [1..*]; + association [*] E168 <- C168 [0..1]; + association [1] E168 -> D168 [1..*]; + + + enum G169 {e11, e12, e13;} + + abstract class A169 { + String s; + } + + class B169 extends A169 { + E169 e; + } + + class C169 { + B169 b169; + } + + class D169 extends A169 { + String s; + } + + class E169 { + Double d; + } + + association [1] A169 <-> E169 [1..*]; + association [1..*] B169 -> C169 [0..1]; + association [1] C169 <-> D169 [1..*]; + association [*] E169 <- C169 [0..1]; + association [1] E169 -> D169 [1..*]; + + + enum G170 {e11, e12, e13;} + + abstract class A170 { + String s; + } + + class B170 extends A170 { + E170 e; + } + + class C170 { + B170 b170; + } + + class D170 extends A170 { + String s; + } + + class E170 { + Double d; + } + + association [1] A170 <-> E170 [1..*]; + association [1..*] B170 -> C170 [0..1]; + association [1] C170 <-> D170 [1..*]; + association [*] E170 <- C170 [0..1]; + association [1] E170 -> D170 [1..*]; + + + enum G171 {e11, e12, e13;} + + abstract class A171 { + String s; + } + + class B171 extends A171 { + E171 e; + } + + class C171 { + B171 b171; + } + + class D171 extends A171 { + String s; + } + + class E171 { + Double d; + } + + association [1] A171 <-> E171 [1..*]; + association [1..*] B171 -> C171 [0..1]; + association [1] C171 <-> D171 [1..*]; + association [*] E171 <- C171 [0..1]; + association [1] E171 -> D171 [1..*]; + + + enum G172 {e11, e12, e13;} + + abstract class A172 { + String s; + } + + class B172 extends A172 { + E172 e; + } + + class C172 { + B172 b172; + } + + class D172 extends A172 { + String s; + } + + class E172 { + Double d; + } + + association [1] A172 <-> E172 [1..*]; + association [1..*] B172 -> C172 [0..1]; + association [1] C172 <-> D172 [1..*]; + association [*] E172 <- C172 [0..1]; + association [1] E172 -> D172 [1..*]; + + + enum G173 {e11, e12, e13;} + + abstract class A173 { + String s; + } + + class B173 extends A173 { + E173 e; + } + + class C173 { + B173 b173; + } + + class D173 extends A173 { + String s; + } + + class E173 { + Double d; + } + + association [1] A173 <-> E173 [1..*]; + association [1..*] B173 -> C173 [0..1]; + association [1] C173 <-> D173 [1..*]; + association [*] E173 <- C173 [0..1]; + association [1] E173 -> D173 [1..*]; + + + enum G174 {e11, e12, e13;} + + abstract class A174 { + String s; + } + + class B174 extends A174 { + E174 e; + } + + class C174 { + B174 b174; + } + + class D174 extends A174 { + String s; + } + + class E174 { + Double d; + } + + association [1] A174 <-> E174 [1..*]; + association [1..*] B174 -> C174 [0..1]; + association [1] C174 <-> D174 [1..*]; + association [*] E174 <- C174 [0..1]; + association [1] E174 -> D174 [1..*]; + + + enum G175 {e11, e12, e13;} + + abstract class A175 { + String s; + } + + class B175 extends A175 { + E175 e; + } + + class C175 { + B175 b175; + } + + class D175 extends A175 { + String s; + } + + class E175 { + Double d; + } + + association [1] A175 <-> E175 [1..*]; + association [1..*] B175 -> C175 [0..1]; + association [1] C175 <-> D175 [1..*]; + association [*] E175 <- C175 [0..1]; + association [1] E175 -> D175 [1..*]; + + + enum G176 {e11, e12, e13;} + + abstract class A176 { + String s; + } + + class B176 extends A176 { + E176 e; + } + + class C176 { + B176 b176; + } + + class D176 extends A176 { + String s; + } + + class E176 { + Double d; + } + + association [1] A176 <-> E176 [1..*]; + association [1..*] B176 -> C176 [0..1]; + association [1] C176 <-> D176 [1..*]; + association [*] E176 <- C176 [0..1]; + association [1] E176 -> D176 [1..*]; + + + enum G177 {e11, e12, e13;} + + abstract class A177 { + String s; + } + + class B177 extends A177 { + E177 e; + } + + class C177 { + B177 b177; + } + + class D177 extends A177 { + String s; + } + + class E177 { + Double d; + } + + association [1] A177 <-> E177 [1..*]; + association [1..*] B177 -> C177 [0..1]; + association [1] C177 <-> D177 [1..*]; + association [*] E177 <- C177 [0..1]; + association [1] E177 -> D177 [1..*]; + + + enum G178 {e11, e12, e13;} + + abstract class A178 { + String s; + } + + class B178 extends A178 { + E178 e; + } + + class C178 { + B178 b178; + } + + class D178 extends A178 { + String s; + } + + class E178 { + Double d; + } + + association [1] A178 <-> E178 [1..*]; + association [1..*] B178 -> C178 [0..1]; + association [1] C178 <-> D178 [1..*]; + association [*] E178 <- C178 [0..1]; + association [1] E178 -> D178 [1..*]; + + + enum G179 {e11, e12, e13;} + + abstract class A179 { + String s; + } + + class B179 extends A179 { + E179 e; + } + + class C179 { + B179 b179; + } + + class D179 extends A179 { + String s; + } + + class E179 { + Double d; + } + + association [1] A179 <-> E179 [1..*]; + association [1..*] B179 -> C179 [0..1]; + association [1] C179 <-> D179 [1..*]; + association [*] E179 <- C179 [0..1]; + association [1] E179 -> D179 [1..*]; + + + enum G180 {e11, e12, e13;} + + abstract class A180 { + String s; + } + + class B180 extends A180 { + E180 e; + } + + class C180 { + B180 b180; + } + + class D180 extends A180 { + String s; + } + + class E180 { + Double d; + } + + association [1] A180 <-> E180 [1..*]; + association [1..*] B180 -> C180 [0..1]; + association [1] C180 <-> D180 [1..*]; + association [*] E180 <- C180 [0..1]; + association [1] E180 -> D180 [1..*]; + + + enum G181 {e11, e12, e13;} + + abstract class A181 { + String s; + } + + class B181 extends A181 { + E181 e; + } + + class C181 { + B181 b181; + } + + class D181 extends A181 { + String s; + } + + class E181 { + Double d; + } + + association [1] A181 <-> E181 [1..*]; + association [1..*] B181 -> C181 [0..1]; + association [1] C181 <-> D181 [1..*]; + association [*] E181 <- C181 [0..1]; + association [1] E181 -> D181 [1..*]; + + + enum G182 {e11, e12, e13;} + + abstract class A182 { + String s; + } + + class B182 extends A182 { + E182 e; + } + + class C182 { + B182 b182; + } + + class D182 extends A182 { + String s; + } + + class E182 { + Double d; + } + + association [1] A182 <-> E182 [1..*]; + association [1..*] B182 -> C182 [0..1]; + association [1] C182 <-> D182 [1..*]; + association [*] E182 <- C182 [0..1]; + association [1] E182 -> D182 [1..*]; + + + enum G183 {e11, e12, e13;} + + abstract class A183 { + String s; + } + + class B183 extends A183 { + E183 e; + } + + class C183 { + B183 b183; + } + + class D183 extends A183 { + String s; + } + + class E183 { + Double d; + } + + association [1] A183 <-> E183 [1..*]; + association [1..*] B183 -> C183 [0..1]; + association [1] C183 <-> D183 [1..*]; + association [*] E183 <- C183 [0..1]; + association [1] E183 -> D183 [1..*]; + + + enum G184 {e11, e12, e13;} + + abstract class A184 { + String s; + } + + class B184 extends A184 { + E184 e; + } + + class C184 { + B184 b184; + } + + class D184 extends A184 { + String s; + } + + class E184 { + Double d; + } + + association [1] A184 <-> E184 [1..*]; + association [1..*] B184 -> C184 [0..1]; + association [1] C184 <-> D184 [1..*]; + association [*] E184 <- C184 [0..1]; + association [1] E184 -> D184 [1..*]; + + + enum G185 {e11, e12, e13;} + + abstract class A185 { + String s; + } + + class B185 extends A185 { + E185 e; + } + + class C185 { + B185 b185; + } + + class D185 extends A185 { + String s; + } + + class E185 { + Double d; + } + + association [1] A185 <-> E185 [1..*]; + association [1..*] B185 -> C185 [0..1]; + association [1] C185 <-> D185 [1..*]; + association [*] E185 <- C185 [0..1]; + association [1] E185 -> D185 [1..*]; + + + enum G186 {e11, e12, e13;} + + abstract class A186 { + String s; + } + + class B186 extends A186 { + E186 e; + } + + class C186 { + B186 b186; + } + + class D186 extends A186 { + String s; + } + + class E186 { + Double d; + } + + association [1] A186 <-> E186 [1..*]; + association [1..*] B186 -> C186 [0..1]; + association [1] C186 <-> D186 [1..*]; + association [*] E186 <- C186 [0..1]; + association [1] E186 -> D186 [1..*]; + + + enum G187 {e11, e12, e13;} + + abstract class A187 { + String s; + } + + class B187 extends A187 { + E187 e; + } + + class C187 { + B187 b187; + } + + class D187 extends A187 { + String s; + } + + class E187 { + Double d; + } + + association [1] A187 <-> E187 [1..*]; + association [1..*] B187 -> C187 [0..1]; + association [1] C187 <-> D187 [1..*]; + association [*] E187 <- C187 [0..1]; + association [1] E187 -> D187 [1..*]; + + + enum G188 {e11, e12, e13;} + + abstract class A188 { + String s; + } + + class B188 extends A188 { + E188 e; + } + + class C188 { + B188 b188; + } + + class D188 extends A188 { + String s; + } + + class E188 { + Double d; + } + + association [1] A188 <-> E188 [1..*]; + association [1..*] B188 -> C188 [0..1]; + association [1] C188 <-> D188 [1..*]; + association [*] E188 <- C188 [0..1]; + association [1] E188 -> D188 [1..*]; + + + enum G189 {e11, e12, e13;} + + abstract class A189 { + String s; + } + + class B189 extends A189 { + E189 e; + } + + class C189 { + B189 b189; + } + + class D189 extends A189 { + String s; + } + + class E189 { + Double d; + } + + association [1] A189 <-> E189 [1..*]; + association [1..*] B189 -> C189 [0..1]; + association [1] C189 <-> D189 [1..*]; + association [*] E189 <- C189 [0..1]; + association [1] E189 -> D189 [1..*]; + + + enum G190 {e11, e12, e13;} + + abstract class A190 { + String s; + } + + class B190 extends A190 { + E190 e; + } + + class C190 { + B190 b190; + } + + class D190 extends A190 { + String s; + } + + class E190 { + Double d; + } + + association [1] A190 <-> E190 [1..*]; + association [1..*] B190 -> C190 [0..1]; + association [1] C190 <-> D190 [1..*]; + association [*] E190 <- C190 [0..1]; + association [1] E190 -> D190 [1..*]; + + + enum G191 {e11, e12, e13;} + + abstract class A191 { + String s; + } + + class B191 extends A191 { + E191 e; + } + + class C191 { + B191 b191; + } + + class D191 extends A191 { + String s; + } + + class E191 { + Double d; + } + + association [1] A191 <-> E191 [1..*]; + association [1..*] B191 -> C191 [0..1]; + association [1] C191 <-> D191 [1..*]; + association [*] E191 <- C191 [0..1]; + association [1] E191 -> D191 [1..*]; + + + enum G192 {e11, e12, e13;} + + abstract class A192 { + String s; + } + + class B192 extends A192 { + E192 e; + } + + class C192 { + B192 b192; + } + + class D192 extends A192 { + String s; + } + + class E192 { + Double d; + } + + association [1] A192 <-> E192 [1..*]; + association [1..*] B192 -> C192 [0..1]; + association [1] C192 <-> D192 [1..*]; + association [*] E192 <- C192 [0..1]; + association [1] E192 -> D192 [1..*]; + + + enum G193 {e11, e12, e13;} + + abstract class A193 { + String s; + } + + class B193 extends A193 { + E193 e; + } + + class C193 { + B193 b193; + } + + class D193 extends A193 { + String s; + } + + class E193 { + Double d; + } + + association [1] A193 <-> E193 [1..*]; + association [1..*] B193 -> C193 [0..1]; + association [1] C193 <-> D193 [1..*]; + association [*] E193 <- C193 [0..1]; + association [1] E193 -> D193 [1..*]; + + + enum G194 {e11, e12, e13;} + + abstract class A194 { + String s; + } + + class B194 extends A194 { + E194 e; + } + + class C194 { + B194 b194; + } + + class D194 extends A194 { + String s; + } + + class E194 { + Double d; + } + + association [1] A194 <-> E194 [1..*]; + association [1..*] B194 -> C194 [0..1]; + association [1] C194 <-> D194 [1..*]; + association [*] E194 <- C194 [0..1]; + association [1] E194 -> D194 [1..*]; + + + enum G195 {e11, e12, e13;} + + abstract class A195 { + String s; + } + + class B195 extends A195 { + E195 e; + } + + class C195 { + B195 b195; + } + + class D195 extends A195 { + String s; + } + + class E195 { + Double d; + } + + association [1] A195 <-> E195 [1..*]; + association [1..*] B195 -> C195 [0..1]; + association [1] C195 <-> D195 [1..*]; + association [*] E195 <- C195 [0..1]; + association [1] E195 -> D195 [1..*]; + + + enum G196 {e11, e12, e13;} + + abstract class A196 { + String s; + } + + class B196 extends A196 { + E196 e; + } + + class C196 { + B196 b196; + } + + class D196 extends A196 { + String s; + } + + class E196 { + Double d; + } + + association [1] A196 <-> E196 [1..*]; + association [1..*] B196 -> C196 [0..1]; + association [1] C196 <-> D196 [1..*]; + association [*] E196 <- C196 [0..1]; + association [1] E196 -> D196 [1..*]; + + + enum G197 {e11, e12, e13;} + + abstract class A197 { + String s; + } + + class B197 extends A197 { + E197 e; + } + + class C197 { + B197 b197; + } + + class D197 extends A197 { + String s; + } + + class E197 { + Double d; + } + + association [1] A197 <-> E197 [1..*]; + association [1..*] B197 -> C197 [0..1]; + association [1] C197 <-> D197 [1..*]; + association [*] E197 <- C197 [0..1]; + association [1] E197 -> D197 [1..*]; + + + enum G198 {e11, e12, e13;} + + abstract class A198 { + String s; + } + + class B198 extends A198 { + E198 e; + } + + class C198 { + B198 b198; + } + + class D198 extends A198 { + String s; + } + + class E198 { + Double d; + } + + association [1] A198 <-> E198 [1..*]; + association [1..*] B198 -> C198 [0..1]; + association [1] C198 <-> D198 [1..*]; + association [*] E198 <- C198 [0..1]; + association [1] E198 -> D198 [1..*]; + + + enum G199 {e11, e12, e13;} + + abstract class A199 { + String s; + } + + class B199 extends A199 { + E199 e; + } + + class C199 { + B199 b199; + } + + class D199 extends A199 { + String s; + } + + class E199 { + Double d; + } + + association [1] A199 <-> E199 [1..*]; + association [1..*] B199 -> C199 [0..1]; + association [1] C199 <-> D199 [1..*]; + association [*] E199 <- C199 [0..1]; + association [1] E199 -> D199 [1..*]; + + + enum G200 {e11, e12, e13;} + + abstract class A200 { + String s; + } + + class B200 extends A200 { + E200 e; + } + + class C200 { + B200 b200; + } + + class D200 extends A200 { + String s; + } + + class E200 { + Double d; + } + + association [1] A200 <-> E200 [1..*]; + association [1..*] B200 -> C200 [0..1]; + association [1] C200 <-> D200 [1..*]; + association [*] E200 <- C200 [0..1]; + association [1] E200 -> D200 [1..*]; + +} diff --git a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/1000/CD2.cd b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/1000/CD2.cd new file mode 100644 index 000000000..cf0f568d7 --- /dev/null +++ b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/1000/CD2.cd @@ -0,0 +1,5605 @@ +import java.lang.*; + +classdiagram CD2 { + + enum G1 {F11, F12;} + + class B1 { + F1 e; + } + + class C1 { + B1 b1; + } + + class D1 extends C1 { + } + + class E1 { + Integer i; + } + + class F1 extends B1 { + Double d; + } + + association [1] F1 <-> E1 [1..*]; + association [*] B1 -> C1 [0..1]; + association [1] C1 <-> D1 [1]; + association [1..*] E1 <-> C1 [*]; + association [1] F1 <- D1 [1..*]; + + + enum G2 {F11, F12;} + + class B2 { + F2 e; + } + + class C2 { + B2 b2; + } + + class D2 extends C2 { + } + + class E2 { + Integer i; + } + + class F2 extends B2 { + Double d; + } + + association [1] F2 <-> E2 [1..*]; + association [*] B2 -> C2 [0..1]; + association [1] C2 <-> D2 [1]; + association [1..*] E2 <-> C2 [*]; + association [1] F2 <- D2 [1..*]; + + + enum G3 {F11, F12;} + + class B3 { + F3 e; + } + + class C3 { + B3 b3; + } + + class D3 extends C3 { + } + + class E3 { + Integer i; + } + + class F3 extends B3 { + Double d; + } + + association [1] F3 <-> E3 [1..*]; + association [*] B3 -> C3 [0..1]; + association [1] C3 <-> D3 [1]; + association [1..*] E3 <-> C3 [*]; + association [1] F3 <- D3 [1..*]; + + + enum G4 {F11, F12;} + + class B4 { + F4 e; + } + + class C4 { + B4 b4; + } + + class D4 extends C4 { + } + + class E4 { + Integer i; + } + + class F4 extends B4 { + Double d; + } + + association [1] F4 <-> E4 [1..*]; + association [*] B4 -> C4 [0..1]; + association [1] C4 <-> D4 [1]; + association [1..*] E4 <-> C4 [*]; + association [1] F4 <- D4 [1..*]; + + + enum G5 {F11, F12;} + + class B5 { + F5 e; + } + + class C5 { + B5 b5; + } + + class D5 extends C5 { + } + + class E5 { + Integer i; + } + + class F5 extends B5 { + Double d; + } + + association [1] F5 <-> E5 [1..*]; + association [*] B5 -> C5 [0..1]; + association [1] C5 <-> D5 [1]; + association [1..*] E5 <-> C5 [*]; + association [1] F5 <- D5 [1..*]; + + + enum G6 {F11, F12;} + + class B6 { + F6 e; + } + + class C6 { + B6 b6; + } + + class D6 extends C6 { + } + + class E6 { + Integer i; + } + + class F6 extends B6 { + Double d; + } + + association [1] F6 <-> E6 [1..*]; + association [*] B6 -> C6 [0..1]; + association [1] C6 <-> D6 [1]; + association [1..*] E6 <-> C6 [*]; + association [1] F6 <- D6 [1..*]; + + + enum G7 {F11, F12;} + + class B7 { + F7 e; + } + + class C7 { + B7 b7; + } + + class D7 extends C7 { + } + + class E7 { + Integer i; + } + + class F7 extends B7 { + Double d; + } + + association [1] F7 <-> E7 [1..*]; + association [*] B7 -> C7 [0..1]; + association [1] C7 <-> D7 [1]; + association [1..*] E7 <-> C7 [*]; + association [1] F7 <- D7 [1..*]; + + + enum G8 {F11, F12;} + + class B8 { + F8 e; + } + + class C8 { + B8 b8; + } + + class D8 extends C8 { + } + + class E8 { + Integer i; + } + + class F8 extends B8 { + Double d; + } + + association [1] F8 <-> E8 [1..*]; + association [*] B8 -> C8 [0..1]; + association [1] C8 <-> D8 [1]; + association [1..*] E8 <-> C8 [*]; + association [1] F8 <- D8 [1..*]; + + + enum G9 {F11, F12;} + + class B9 { + F9 e; + } + + class C9 { + B9 b9; + } + + class D9 extends C9 { + } + + class E9 { + Integer i; + } + + class F9 extends B9 { + Double d; + } + + association [1] F9 <-> E9 [1..*]; + association [*] B9 -> C9 [0..1]; + association [1] C9 <-> D9 [1]; + association [1..*] E9 <-> C9 [*]; + association [1] F9 <- D9 [1..*]; + + + enum G10 {F11, F12;} + + class B10 { + F10 e; + } + + class C10 { + B10 b10; + } + + class D10 extends C10 { + } + + class E10 { + Integer i; + } + + class F10 extends B10 { + Double d; + } + + association [1] F10 <-> E10 [1..*]; + association [*] B10 -> C10 [0..1]; + association [1] C10 <-> D10 [1]; + association [1..*] E10 <-> C10 [*]; + association [1] F10 <- D10 [1..*]; + + + enum G11 {F11, F12;} + + class B11 { + F11 e; + } + + class C11 { + B11 b11; + } + + class D11 extends C11 { + } + + class E11 { + Integer i; + } + + class F11 extends B11 { + Double d; + } + + association [1] F11 <-> E11 [1..*]; + association [*] B11 -> C11 [0..1]; + association [1] C11 <-> D11 [1]; + association [1..*] E11 <-> C11 [*]; + association [1] F11 <- D11 [1..*]; + + + enum G12 {F11, F12;} + + class B12 { + F12 e; + } + + class C12 { + B12 b12; + } + + class D12 extends C12 { + } + + class E12 { + Integer i; + } + + class F12 extends B12 { + Double d; + } + + association [1] F12 <-> E12 [1..*]; + association [*] B12 -> C12 [0..1]; + association [1] C12 <-> D12 [1]; + association [1..*] E12 <-> C12 [*]; + association [1] F12 <- D12 [1..*]; + + + enum G13 {F11, F12;} + + class B13 { + F13 e; + } + + class C13 { + B13 b13; + } + + class D13 extends C13 { + } + + class E13 { + Integer i; + } + + class F13 extends B13 { + Double d; + } + + association [1] F13 <-> E13 [1..*]; + association [*] B13 -> C13 [0..1]; + association [1] C13 <-> D13 [1]; + association [1..*] E13 <-> C13 [*]; + association [1] F13 <- D13 [1..*]; + + + enum G14 {F11, F12;} + + class B14 { + F14 e; + } + + class C14 { + B14 b14; + } + + class D14 extends C14 { + } + + class E14 { + Integer i; + } + + class F14 extends B14 { + Double d; + } + + association [1] F14 <-> E14 [1..*]; + association [*] B14 -> C14 [0..1]; + association [1] C14 <-> D14 [1]; + association [1..*] E14 <-> C14 [*]; + association [1] F14 <- D14 [1..*]; + + + enum G15 {F11, F12;} + + class B15 { + F15 e; + } + + class C15 { + B15 b15; + } + + class D15 extends C15 { + } + + class E15 { + Integer i; + } + + class F15 extends B15 { + Double d; + } + + association [1] F15 <-> E15 [1..*]; + association [*] B15 -> C15 [0..1]; + association [1] C15 <-> D15 [1]; + association [1..*] E15 <-> C15 [*]; + association [1] F15 <- D15 [1..*]; + + + enum G16 {F11, F12;} + + class B16 { + F16 e; + } + + class C16 { + B16 b16; + } + + class D16 extends C16 { + } + + class E16 { + Integer i; + } + + class F16 extends B16 { + Double d; + } + + association [1] F16 <-> E16 [1..*]; + association [*] B16 -> C16 [0..1]; + association [1] C16 <-> D16 [1]; + association [1..*] E16 <-> C16 [*]; + association [1] F16 <- D16 [1..*]; + + + enum G17 {F11, F12;} + + class B17 { + F17 e; + } + + class C17 { + B17 b17; + } + + class D17 extends C17 { + } + + class E17 { + Integer i; + } + + class F17 extends B17 { + Double d; + } + + association [1] F17 <-> E17 [1..*]; + association [*] B17 -> C17 [0..1]; + association [1] C17 <-> D17 [1]; + association [1..*] E17 <-> C17 [*]; + association [1] F17 <- D17 [1..*]; + + + enum G18 {F11, F12;} + + class B18 { + F18 e; + } + + class C18 { + B18 b18; + } + + class D18 extends C18 { + } + + class E18 { + Integer i; + } + + class F18 extends B18 { + Double d; + } + + association [1] F18 <-> E18 [1..*]; + association [*] B18 -> C18 [0..1]; + association [1] C18 <-> D18 [1]; + association [1..*] E18 <-> C18 [*]; + association [1] F18 <- D18 [1..*]; + + + enum G19 {F11, F12;} + + class B19 { + F19 e; + } + + class C19 { + B19 b19; + } + + class D19 extends C19 { + } + + class E19 { + Integer i; + } + + class F19 extends B19 { + Double d; + } + + association [1] F19 <-> E19 [1..*]; + association [*] B19 -> C19 [0..1]; + association [1] C19 <-> D19 [1]; + association [1..*] E19 <-> C19 [*]; + association [1] F19 <- D19 [1..*]; + + + enum G20 {F11, F12;} + + class B20 { + F20 e; + } + + class C20 { + B20 b20; + } + + class D20 extends C20 { + } + + class E20 { + Integer i; + } + + class F20 extends B20 { + Double d; + } + + association [1] F20 <-> E20 [1..*]; + association [*] B20 -> C20 [0..1]; + association [1] C20 <-> D20 [1]; + association [1..*] E20 <-> C20 [*]; + association [1] F20 <- D20 [1..*]; + + + enum G21 {F11, F12;} + + class B21 { + F21 e; + } + + class C21 { + B21 b21; + } + + class D21 extends C21 { + } + + class E21 { + Integer i; + } + + class F21 extends B21 { + Double d; + } + + association [1] F21 <-> E21 [1..*]; + association [*] B21 -> C21 [0..1]; + association [1] C21 <-> D21 [1]; + association [1..*] E21 <-> C21 [*]; + association [1] F21 <- D21 [1..*]; + + + enum G22 {F11, F12;} + + class B22 { + F22 e; + } + + class C22 { + B22 b22; + } + + class D22 extends C22 { + } + + class E22 { + Integer i; + } + + class F22 extends B22 { + Double d; + } + + association [1] F22 <-> E22 [1..*]; + association [*] B22 -> C22 [0..1]; + association [1] C22 <-> D22 [1]; + association [1..*] E22 <-> C22 [*]; + association [1] F22 <- D22 [1..*]; + + + enum G23 {F11, F12;} + + class B23 { + F23 e; + } + + class C23 { + B23 b23; + } + + class D23 extends C23 { + } + + class E23 { + Integer i; + } + + class F23 extends B23 { + Double d; + } + + association [1] F23 <-> E23 [1..*]; + association [*] B23 -> C23 [0..1]; + association [1] C23 <-> D23 [1]; + association [1..*] E23 <-> C23 [*]; + association [1] F23 <- D23 [1..*]; + + + enum G24 {F11, F12;} + + class B24 { + F24 e; + } + + class C24 { + B24 b24; + } + + class D24 extends C24 { + } + + class E24 { + Integer i; + } + + class F24 extends B24 { + Double d; + } + + association [1] F24 <-> E24 [1..*]; + association [*] B24 -> C24 [0..1]; + association [1] C24 <-> D24 [1]; + association [1..*] E24 <-> C24 [*]; + association [1] F24 <- D24 [1..*]; + + + enum G25 {F11, F12;} + + class B25 { + F25 e; + } + + class C25 { + B25 b25; + } + + class D25 extends C25 { + } + + class E25 { + Integer i; + } + + class F25 extends B25 { + Double d; + } + + association [1] F25 <-> E25 [1..*]; + association [*] B25 -> C25 [0..1]; + association [1] C25 <-> D25 [1]; + association [1..*] E25 <-> C25 [*]; + association [1] F25 <- D25 [1..*]; + + + enum G26 {F11, F12;} + + class B26 { + F26 e; + } + + class C26 { + B26 b26; + } + + class D26 extends C26 { + } + + class E26 { + Integer i; + } + + class F26 extends B26 { + Double d; + } + + association [1] F26 <-> E26 [1..*]; + association [*] B26 -> C26 [0..1]; + association [1] C26 <-> D26 [1]; + association [1..*] E26 <-> C26 [*]; + association [1] F26 <- D26 [1..*]; + + + enum G27 {F11, F12;} + + class B27 { + F27 e; + } + + class C27 { + B27 b27; + } + + class D27 extends C27 { + } + + class E27 { + Integer i; + } + + class F27 extends B27 { + Double d; + } + + association [1] F27 <-> E27 [1..*]; + association [*] B27 -> C27 [0..1]; + association [1] C27 <-> D27 [1]; + association [1..*] E27 <-> C27 [*]; + association [1] F27 <- D27 [1..*]; + + + enum G28 {F11, F12;} + + class B28 { + F28 e; + } + + class C28 { + B28 b28; + } + + class D28 extends C28 { + } + + class E28 { + Integer i; + } + + class F28 extends B28 { + Double d; + } + + association [1] F28 <-> E28 [1..*]; + association [*] B28 -> C28 [0..1]; + association [1] C28 <-> D28 [1]; + association [1..*] E28 <-> C28 [*]; + association [1] F28 <- D28 [1..*]; + + + enum G29 {F11, F12;} + + class B29 { + F29 e; + } + + class C29 { + B29 b29; + } + + class D29 extends C29 { + } + + class E29 { + Integer i; + } + + class F29 extends B29 { + Double d; + } + + association [1] F29 <-> E29 [1..*]; + association [*] B29 -> C29 [0..1]; + association [1] C29 <-> D29 [1]; + association [1..*] E29 <-> C29 [*]; + association [1] F29 <- D29 [1..*]; + + + enum G30 {F11, F12;} + + class B30 { + F30 e; + } + + class C30 { + B30 b30; + } + + class D30 extends C30 { + } + + class E30 { + Integer i; + } + + class F30 extends B30 { + Double d; + } + + association [1] F30 <-> E30 [1..*]; + association [*] B30 -> C30 [0..1]; + association [1] C30 <-> D30 [1]; + association [1..*] E30 <-> C30 [*]; + association [1] F30 <- D30 [1..*]; + + + enum G31 {F11, F12;} + + class B31 { + F31 e; + } + + class C31 { + B31 b31; + } + + class D31 extends C31 { + } + + class E31 { + Integer i; + } + + class F31 extends B31 { + Double d; + } + + association [1] F31 <-> E31 [1..*]; + association [*] B31 -> C31 [0..1]; + association [1] C31 <-> D31 [1]; + association [1..*] E31 <-> C31 [*]; + association [1] F31 <- D31 [1..*]; + + + enum G32 {F11, F12;} + + class B32 { + F32 e; + } + + class C32 { + B32 b32; + } + + class D32 extends C32 { + } + + class E32 { + Integer i; + } + + class F32 extends B32 { + Double d; + } + + association [1] F32 <-> E32 [1..*]; + association [*] B32 -> C32 [0..1]; + association [1] C32 <-> D32 [1]; + association [1..*] E32 <-> C32 [*]; + association [1] F32 <- D32 [1..*]; + + + enum G33 {F11, F12;} + + class B33 { + F33 e; + } + + class C33 { + B33 b33; + } + + class D33 extends C33 { + } + + class E33 { + Integer i; + } + + class F33 extends B33 { + Double d; + } + + association [1] F33 <-> E33 [1..*]; + association [*] B33 -> C33 [0..1]; + association [1] C33 <-> D33 [1]; + association [1..*] E33 <-> C33 [*]; + association [1] F33 <- D33 [1..*]; + + + enum G34 {F11, F12;} + + class B34 { + F34 e; + } + + class C34 { + B34 b34; + } + + class D34 extends C34 { + } + + class E34 { + Integer i; + } + + class F34 extends B34 { + Double d; + } + + association [1] F34 <-> E34 [1..*]; + association [*] B34 -> C34 [0..1]; + association [1] C34 <-> D34 [1]; + association [1..*] E34 <-> C34 [*]; + association [1] F34 <- D34 [1..*]; + + + enum G35 {F11, F12;} + + class B35 { + F35 e; + } + + class C35 { + B35 b35; + } + + class D35 extends C35 { + } + + class E35 { + Integer i; + } + + class F35 extends B35 { + Double d; + } + + association [1] F35 <-> E35 [1..*]; + association [*] B35 -> C35 [0..1]; + association [1] C35 <-> D35 [1]; + association [1..*] E35 <-> C35 [*]; + association [1] F35 <- D35 [1..*]; + + + enum G36 {F11, F12;} + + class B36 { + F36 e; + } + + class C36 { + B36 b36; + } + + class D36 extends C36 { + } + + class E36 { + Integer i; + } + + class F36 extends B36 { + Double d; + } + + association [1] F36 <-> E36 [1..*]; + association [*] B36 -> C36 [0..1]; + association [1] C36 <-> D36 [1]; + association [1..*] E36 <-> C36 [*]; + association [1] F36 <- D36 [1..*]; + + + enum G37 {F11, F12;} + + class B37 { + F37 e; + } + + class C37 { + B37 b37; + } + + class D37 extends C37 { + } + + class E37 { + Integer i; + } + + class F37 extends B37 { + Double d; + } + + association [1] F37 <-> E37 [1..*]; + association [*] B37 -> C37 [0..1]; + association [1] C37 <-> D37 [1]; + association [1..*] E37 <-> C37 [*]; + association [1] F37 <- D37 [1..*]; + + + enum G38 {F11, F12;} + + class B38 { + F38 e; + } + + class C38 { + B38 b38; + } + + class D38 extends C38 { + } + + class E38 { + Integer i; + } + + class F38 extends B38 { + Double d; + } + + association [1] F38 <-> E38 [1..*]; + association [*] B38 -> C38 [0..1]; + association [1] C38 <-> D38 [1]; + association [1..*] E38 <-> C38 [*]; + association [1] F38 <- D38 [1..*]; + + + enum G39 {F11, F12;} + + class B39 { + F39 e; + } + + class C39 { + B39 b39; + } + + class D39 extends C39 { + } + + class E39 { + Integer i; + } + + class F39 extends B39 { + Double d; + } + + association [1] F39 <-> E39 [1..*]; + association [*] B39 -> C39 [0..1]; + association [1] C39 <-> D39 [1]; + association [1..*] E39 <-> C39 [*]; + association [1] F39 <- D39 [1..*]; + + + enum G40 {F11, F12;} + + class B40 { + F40 e; + } + + class C40 { + B40 b40; + } + + class D40 extends C40 { + } + + class E40 { + Integer i; + } + + class F40 extends B40 { + Double d; + } + + association [1] F40 <-> E40 [1..*]; + association [*] B40 -> C40 [0..1]; + association [1] C40 <-> D40 [1]; + association [1..*] E40 <-> C40 [*]; + association [1] F40 <- D40 [1..*]; + + + enum G41 {F11, F12;} + + class B41 { + F41 e; + } + + class C41 { + B41 b41; + } + + class D41 extends C41 { + } + + class E41 { + Integer i; + } + + class F41 extends B41 { + Double d; + } + + association [1] F41 <-> E41 [1..*]; + association [*] B41 -> C41 [0..1]; + association [1] C41 <-> D41 [1]; + association [1..*] E41 <-> C41 [*]; + association [1] F41 <- D41 [1..*]; + + + enum G42 {F11, F12;} + + class B42 { + F42 e; + } + + class C42 { + B42 b42; + } + + class D42 extends C42 { + } + + class E42 { + Integer i; + } + + class F42 extends B42 { + Double d; + } + + association [1] F42 <-> E42 [1..*]; + association [*] B42 -> C42 [0..1]; + association [1] C42 <-> D42 [1]; + association [1..*] E42 <-> C42 [*]; + association [1] F42 <- D42 [1..*]; + + + enum G43 {F11, F12;} + + class B43 { + F43 e; + } + + class C43 { + B43 b43; + } + + class D43 extends C43 { + } + + class E43 { + Integer i; + } + + class F43 extends B43 { + Double d; + } + + association [1] F43 <-> E43 [1..*]; + association [*] B43 -> C43 [0..1]; + association [1] C43 <-> D43 [1]; + association [1..*] E43 <-> C43 [*]; + association [1] F43 <- D43 [1..*]; + + + enum G44 {F11, F12;} + + class B44 { + F44 e; + } + + class C44 { + B44 b44; + } + + class D44 extends C44 { + } + + class E44 { + Integer i; + } + + class F44 extends B44 { + Double d; + } + + association [1] F44 <-> E44 [1..*]; + association [*] B44 -> C44 [0..1]; + association [1] C44 <-> D44 [1]; + association [1..*] E44 <-> C44 [*]; + association [1] F44 <- D44 [1..*]; + + + enum G45 {F11, F12;} + + class B45 { + F45 e; + } + + class C45 { + B45 b45; + } + + class D45 extends C45 { + } + + class E45 { + Integer i; + } + + class F45 extends B45 { + Double d; + } + + association [1] F45 <-> E45 [1..*]; + association [*] B45 -> C45 [0..1]; + association [1] C45 <-> D45 [1]; + association [1..*] E45 <-> C45 [*]; + association [1] F45 <- D45 [1..*]; + + + enum G46 {F11, F12;} + + class B46 { + F46 e; + } + + class C46 { + B46 b46; + } + + class D46 extends C46 { + } + + class E46 { + Integer i; + } + + class F46 extends B46 { + Double d; + } + + association [1] F46 <-> E46 [1..*]; + association [*] B46 -> C46 [0..1]; + association [1] C46 <-> D46 [1]; + association [1..*] E46 <-> C46 [*]; + association [1] F46 <- D46 [1..*]; + + + enum G47 {F11, F12;} + + class B47 { + F47 e; + } + + class C47 { + B47 b47; + } + + class D47 extends C47 { + } + + class E47 { + Integer i; + } + + class F47 extends B47 { + Double d; + } + + association [1] F47 <-> E47 [1..*]; + association [*] B47 -> C47 [0..1]; + association [1] C47 <-> D47 [1]; + association [1..*] E47 <-> C47 [*]; + association [1] F47 <- D47 [1..*]; + + + enum G48 {F11, F12;} + + class B48 { + F48 e; + } + + class C48 { + B48 b48; + } + + class D48 extends C48 { + } + + class E48 { + Integer i; + } + + class F48 extends B48 { + Double d; + } + + association [1] F48 <-> E48 [1..*]; + association [*] B48 -> C48 [0..1]; + association [1] C48 <-> D48 [1]; + association [1..*] E48 <-> C48 [*]; + association [1] F48 <- D48 [1..*]; + + + enum G49 {F11, F12;} + + class B49 { + F49 e; + } + + class C49 { + B49 b49; + } + + class D49 extends C49 { + } + + class E49 { + Integer i; + } + + class F49 extends B49 { + Double d; + } + + association [1] F49 <-> E49 [1..*]; + association [*] B49 -> C49 [0..1]; + association [1] C49 <-> D49 [1]; + association [1..*] E49 <-> C49 [*]; + association [1] F49 <- D49 [1..*]; + + + enum G50 {F11, F12;} + + class B50 { + F50 e; + } + + class C50 { + B50 b50; + } + + class D50 extends C50 { + } + + class E50 { + Integer i; + } + + class F50 extends B50 { + Double d; + } + + association [1] F50 <-> E50 [1..*]; + association [*] B50 -> C50 [0..1]; + association [1] C50 <-> D50 [1]; + association [1..*] E50 <-> C50 [*]; + association [1] F50 <- D50 [1..*]; + + + enum G51 {F11, F12;} + + class B51 { + F51 e; + } + + class C51 { + B51 b51; + } + + class D51 extends C51 { + } + + class E51 { + Integer i; + } + + class F51 extends B51 { + Double d; + } + + association [1] F51 <-> E51 [1..*]; + association [*] B51 -> C51 [0..1]; + association [1] C51 <-> D51 [1]; + association [1..*] E51 <-> C51 [*]; + association [1] F51 <- D51 [1..*]; + + + enum G52 {F11, F12;} + + class B52 { + F52 e; + } + + class C52 { + B52 b52; + } + + class D52 extends C52 { + } + + class E52 { + Integer i; + } + + class F52 extends B52 { + Double d; + } + + association [1] F52 <-> E52 [1..*]; + association [*] B52 -> C52 [0..1]; + association [1] C52 <-> D52 [1]; + association [1..*] E52 <-> C52 [*]; + association [1] F52 <- D52 [1..*]; + + + enum G53 {F11, F12;} + + class B53 { + F53 e; + } + + class C53 { + B53 b53; + } + + class D53 extends C53 { + } + + class E53 { + Integer i; + } + + class F53 extends B53 { + Double d; + } + + association [1] F53 <-> E53 [1..*]; + association [*] B53 -> C53 [0..1]; + association [1] C53 <-> D53 [1]; + association [1..*] E53 <-> C53 [*]; + association [1] F53 <- D53 [1..*]; + + + enum G54 {F11, F12;} + + class B54 { + F54 e; + } + + class C54 { + B54 b54; + } + + class D54 extends C54 { + } + + class E54 { + Integer i; + } + + class F54 extends B54 { + Double d; + } + + association [1] F54 <-> E54 [1..*]; + association [*] B54 -> C54 [0..1]; + association [1] C54 <-> D54 [1]; + association [1..*] E54 <-> C54 [*]; + association [1] F54 <- D54 [1..*]; + + + enum G55 {F11, F12;} + + class B55 { + F55 e; + } + + class C55 { + B55 b55; + } + + class D55 extends C55 { + } + + class E55 { + Integer i; + } + + class F55 extends B55 { + Double d; + } + + association [1] F55 <-> E55 [1..*]; + association [*] B55 -> C55 [0..1]; + association [1] C55 <-> D55 [1]; + association [1..*] E55 <-> C55 [*]; + association [1] F55 <- D55 [1..*]; + + + enum G56 {F11, F12;} + + class B56 { + F56 e; + } + + class C56 { + B56 b56; + } + + class D56 extends C56 { + } + + class E56 { + Integer i; + } + + class F56 extends B56 { + Double d; + } + + association [1] F56 <-> E56 [1..*]; + association [*] B56 -> C56 [0..1]; + association [1] C56 <-> D56 [1]; + association [1..*] E56 <-> C56 [*]; + association [1] F56 <- D56 [1..*]; + + + enum G57 {F11, F12;} + + class B57 { + F57 e; + } + + class C57 { + B57 b57; + } + + class D57 extends C57 { + } + + class E57 { + Integer i; + } + + class F57 extends B57 { + Double d; + } + + association [1] F57 <-> E57 [1..*]; + association [*] B57 -> C57 [0..1]; + association [1] C57 <-> D57 [1]; + association [1..*] E57 <-> C57 [*]; + association [1] F57 <- D57 [1..*]; + + + enum G58 {F11, F12;} + + class B58 { + F58 e; + } + + class C58 { + B58 b58; + } + + class D58 extends C58 { + } + + class E58 { + Integer i; + } + + class F58 extends B58 { + Double d; + } + + association [1] F58 <-> E58 [1..*]; + association [*] B58 -> C58 [0..1]; + association [1] C58 <-> D58 [1]; + association [1..*] E58 <-> C58 [*]; + association [1] F58 <- D58 [1..*]; + + + enum G59 {F11, F12;} + + class B59 { + F59 e; + } + + class C59 { + B59 b59; + } + + class D59 extends C59 { + } + + class E59 { + Integer i; + } + + class F59 extends B59 { + Double d; + } + + association [1] F59 <-> E59 [1..*]; + association [*] B59 -> C59 [0..1]; + association [1] C59 <-> D59 [1]; + association [1..*] E59 <-> C59 [*]; + association [1] F59 <- D59 [1..*]; + + + enum G60 {F11, F12;} + + class B60 { + F60 e; + } + + class C60 { + B60 b60; + } + + class D60 extends C60 { + } + + class E60 { + Integer i; + } + + class F60 extends B60 { + Double d; + } + + association [1] F60 <-> E60 [1..*]; + association [*] B60 -> C60 [0..1]; + association [1] C60 <-> D60 [1]; + association [1..*] E60 <-> C60 [*]; + association [1] F60 <- D60 [1..*]; + + + enum G61 {F11, F12;} + + class B61 { + F61 e; + } + + class C61 { + B61 b61; + } + + class D61 extends C61 { + } + + class E61 { + Integer i; + } + + class F61 extends B61 { + Double d; + } + + association [1] F61 <-> E61 [1..*]; + association [*] B61 -> C61 [0..1]; + association [1] C61 <-> D61 [1]; + association [1..*] E61 <-> C61 [*]; + association [1] F61 <- D61 [1..*]; + + + enum G62 {F11, F12;} + + class B62 { + F62 e; + } + + class C62 { + B62 b62; + } + + class D62 extends C62 { + } + + class E62 { + Integer i; + } + + class F62 extends B62 { + Double d; + } + + association [1] F62 <-> E62 [1..*]; + association [*] B62 -> C62 [0..1]; + association [1] C62 <-> D62 [1]; + association [1..*] E62 <-> C62 [*]; + association [1] F62 <- D62 [1..*]; + + + enum G63 {F11, F12;} + + class B63 { + F63 e; + } + + class C63 { + B63 b63; + } + + class D63 extends C63 { + } + + class E63 { + Integer i; + } + + class F63 extends B63 { + Double d; + } + + association [1] F63 <-> E63 [1..*]; + association [*] B63 -> C63 [0..1]; + association [1] C63 <-> D63 [1]; + association [1..*] E63 <-> C63 [*]; + association [1] F63 <- D63 [1..*]; + + + enum G64 {F11, F12;} + + class B64 { + F64 e; + } + + class C64 { + B64 b64; + } + + class D64 extends C64 { + } + + class E64 { + Integer i; + } + + class F64 extends B64 { + Double d; + } + + association [1] F64 <-> E64 [1..*]; + association [*] B64 -> C64 [0..1]; + association [1] C64 <-> D64 [1]; + association [1..*] E64 <-> C64 [*]; + association [1] F64 <- D64 [1..*]; + + + enum G65 {F11, F12;} + + class B65 { + F65 e; + } + + class C65 { + B65 b65; + } + + class D65 extends C65 { + } + + class E65 { + Integer i; + } + + class F65 extends B65 { + Double d; + } + + association [1] F65 <-> E65 [1..*]; + association [*] B65 -> C65 [0..1]; + association [1] C65 <-> D65 [1]; + association [1..*] E65 <-> C65 [*]; + association [1] F65 <- D65 [1..*]; + + + enum G66 {F11, F12;} + + class B66 { + F66 e; + } + + class C66 { + B66 b66; + } + + class D66 extends C66 { + } + + class E66 { + Integer i; + } + + class F66 extends B66 { + Double d; + } + + association [1] F66 <-> E66 [1..*]; + association [*] B66 -> C66 [0..1]; + association [1] C66 <-> D66 [1]; + association [1..*] E66 <-> C66 [*]; + association [1] F66 <- D66 [1..*]; + + + enum G67 {F11, F12;} + + class B67 { + F67 e; + } + + class C67 { + B67 b67; + } + + class D67 extends C67 { + } + + class E67 { + Integer i; + } + + class F67 extends B67 { + Double d; + } + + association [1] F67 <-> E67 [1..*]; + association [*] B67 -> C67 [0..1]; + association [1] C67 <-> D67 [1]; + association [1..*] E67 <-> C67 [*]; + association [1] F67 <- D67 [1..*]; + + + enum G68 {F11, F12;} + + class B68 { + F68 e; + } + + class C68 { + B68 b68; + } + + class D68 extends C68 { + } + + class E68 { + Integer i; + } + + class F68 extends B68 { + Double d; + } + + association [1] F68 <-> E68 [1..*]; + association [*] B68 -> C68 [0..1]; + association [1] C68 <-> D68 [1]; + association [1..*] E68 <-> C68 [*]; + association [1] F68 <- D68 [1..*]; + + + enum G69 {F11, F12;} + + class B69 { + F69 e; + } + + class C69 { + B69 b69; + } + + class D69 extends C69 { + } + + class E69 { + Integer i; + } + + class F69 extends B69 { + Double d; + } + + association [1] F69 <-> E69 [1..*]; + association [*] B69 -> C69 [0..1]; + association [1] C69 <-> D69 [1]; + association [1..*] E69 <-> C69 [*]; + association [1] F69 <- D69 [1..*]; + + + enum G70 {F11, F12;} + + class B70 { + F70 e; + } + + class C70 { + B70 b70; + } + + class D70 extends C70 { + } + + class E70 { + Integer i; + } + + class F70 extends B70 { + Double d; + } + + association [1] F70 <-> E70 [1..*]; + association [*] B70 -> C70 [0..1]; + association [1] C70 <-> D70 [1]; + association [1..*] E70 <-> C70 [*]; + association [1] F70 <- D70 [1..*]; + + + enum G71 {F11, F12;} + + class B71 { + F71 e; + } + + class C71 { + B71 b71; + } + + class D71 extends C71 { + } + + class E71 { + Integer i; + } + + class F71 extends B71 { + Double d; + } + + association [1] F71 <-> E71 [1..*]; + association [*] B71 -> C71 [0..1]; + association [1] C71 <-> D71 [1]; + association [1..*] E71 <-> C71 [*]; + association [1] F71 <- D71 [1..*]; + + + enum G72 {F11, F12;} + + class B72 { + F72 e; + } + + class C72 { + B72 b72; + } + + class D72 extends C72 { + } + + class E72 { + Integer i; + } + + class F72 extends B72 { + Double d; + } + + association [1] F72 <-> E72 [1..*]; + association [*] B72 -> C72 [0..1]; + association [1] C72 <-> D72 [1]; + association [1..*] E72 <-> C72 [*]; + association [1] F72 <- D72 [1..*]; + + + enum G73 {F11, F12;} + + class B73 { + F73 e; + } + + class C73 { + B73 b73; + } + + class D73 extends C73 { + } + + class E73 { + Integer i; + } + + class F73 extends B73 { + Double d; + } + + association [1] F73 <-> E73 [1..*]; + association [*] B73 -> C73 [0..1]; + association [1] C73 <-> D73 [1]; + association [1..*] E73 <-> C73 [*]; + association [1] F73 <- D73 [1..*]; + + + enum G74 {F11, F12;} + + class B74 { + F74 e; + } + + class C74 { + B74 b74; + } + + class D74 extends C74 { + } + + class E74 { + Integer i; + } + + class F74 extends B74 { + Double d; + } + + association [1] F74 <-> E74 [1..*]; + association [*] B74 -> C74 [0..1]; + association [1] C74 <-> D74 [1]; + association [1..*] E74 <-> C74 [*]; + association [1] F74 <- D74 [1..*]; + + + enum G75 {F11, F12;} + + class B75 { + F75 e; + } + + class C75 { + B75 b75; + } + + class D75 extends C75 { + } + + class E75 { + Integer i; + } + + class F75 extends B75 { + Double d; + } + + association [1] F75 <-> E75 [1..*]; + association [*] B75 -> C75 [0..1]; + association [1] C75 <-> D75 [1]; + association [1..*] E75 <-> C75 [*]; + association [1] F75 <- D75 [1..*]; + + + enum G76 {F11, F12;} + + class B76 { + F76 e; + } + + class C76 { + B76 b76; + } + + class D76 extends C76 { + } + + class E76 { + Integer i; + } + + class F76 extends B76 { + Double d; + } + + association [1] F76 <-> E76 [1..*]; + association [*] B76 -> C76 [0..1]; + association [1] C76 <-> D76 [1]; + association [1..*] E76 <-> C76 [*]; + association [1] F76 <- D76 [1..*]; + + + enum G77 {F11, F12;} + + class B77 { + F77 e; + } + + class C77 { + B77 b77; + } + + class D77 extends C77 { + } + + class E77 { + Integer i; + } + + class F77 extends B77 { + Double d; + } + + association [1] F77 <-> E77 [1..*]; + association [*] B77 -> C77 [0..1]; + association [1] C77 <-> D77 [1]; + association [1..*] E77 <-> C77 [*]; + association [1] F77 <- D77 [1..*]; + + + enum G78 {F11, F12;} + + class B78 { + F78 e; + } + + class C78 { + B78 b78; + } + + class D78 extends C78 { + } + + class E78 { + Integer i; + } + + class F78 extends B78 { + Double d; + } + + association [1] F78 <-> E78 [1..*]; + association [*] B78 -> C78 [0..1]; + association [1] C78 <-> D78 [1]; + association [1..*] E78 <-> C78 [*]; + association [1] F78 <- D78 [1..*]; + + + enum G79 {F11, F12;} + + class B79 { + F79 e; + } + + class C79 { + B79 b79; + } + + class D79 extends C79 { + } + + class E79 { + Integer i; + } + + class F79 extends B79 { + Double d; + } + + association [1] F79 <-> E79 [1..*]; + association [*] B79 -> C79 [0..1]; + association [1] C79 <-> D79 [1]; + association [1..*] E79 <-> C79 [*]; + association [1] F79 <- D79 [1..*]; + + + enum G80 {F11, F12;} + + class B80 { + F80 e; + } + + class C80 { + B80 b80; + } + + class D80 extends C80 { + } + + class E80 { + Integer i; + } + + class F80 extends B80 { + Double d; + } + + association [1] F80 <-> E80 [1..*]; + association [*] B80 -> C80 [0..1]; + association [1] C80 <-> D80 [1]; + association [1..*] E80 <-> C80 [*]; + association [1] F80 <- D80 [1..*]; + + + enum G81 {F11, F12;} + + class B81 { + F81 e; + } + + class C81 { + B81 b81; + } + + class D81 extends C81 { + } + + class E81 { + Integer i; + } + + class F81 extends B81 { + Double d; + } + + association [1] F81 <-> E81 [1..*]; + association [*] B81 -> C81 [0..1]; + association [1] C81 <-> D81 [1]; + association [1..*] E81 <-> C81 [*]; + association [1] F81 <- D81 [1..*]; + + + enum G82 {F11, F12;} + + class B82 { + F82 e; + } + + class C82 { + B82 b82; + } + + class D82 extends C82 { + } + + class E82 { + Integer i; + } + + class F82 extends B82 { + Double d; + } + + association [1] F82 <-> E82 [1..*]; + association [*] B82 -> C82 [0..1]; + association [1] C82 <-> D82 [1]; + association [1..*] E82 <-> C82 [*]; + association [1] F82 <- D82 [1..*]; + + + enum G83 {F11, F12;} + + class B83 { + F83 e; + } + + class C83 { + B83 b83; + } + + class D83 extends C83 { + } + + class E83 { + Integer i; + } + + class F83 extends B83 { + Double d; + } + + association [1] F83 <-> E83 [1..*]; + association [*] B83 -> C83 [0..1]; + association [1] C83 <-> D83 [1]; + association [1..*] E83 <-> C83 [*]; + association [1] F83 <- D83 [1..*]; + + + enum G84 {F11, F12;} + + class B84 { + F84 e; + } + + class C84 { + B84 b84; + } + + class D84 extends C84 { + } + + class E84 { + Integer i; + } + + class F84 extends B84 { + Double d; + } + + association [1] F84 <-> E84 [1..*]; + association [*] B84 -> C84 [0..1]; + association [1] C84 <-> D84 [1]; + association [1..*] E84 <-> C84 [*]; + association [1] F84 <- D84 [1..*]; + + + enum G85 {F11, F12;} + + class B85 { + F85 e; + } + + class C85 { + B85 b85; + } + + class D85 extends C85 { + } + + class E85 { + Integer i; + } + + class F85 extends B85 { + Double d; + } + + association [1] F85 <-> E85 [1..*]; + association [*] B85 -> C85 [0..1]; + association [1] C85 <-> D85 [1]; + association [1..*] E85 <-> C85 [*]; + association [1] F85 <- D85 [1..*]; + + + enum G86 {F11, F12;} + + class B86 { + F86 e; + } + + class C86 { + B86 b86; + } + + class D86 extends C86 { + } + + class E86 { + Integer i; + } + + class F86 extends B86 { + Double d; + } + + association [1] F86 <-> E86 [1..*]; + association [*] B86 -> C86 [0..1]; + association [1] C86 <-> D86 [1]; + association [1..*] E86 <-> C86 [*]; + association [1] F86 <- D86 [1..*]; + + + enum G87 {F11, F12;} + + class B87 { + F87 e; + } + + class C87 { + B87 b87; + } + + class D87 extends C87 { + } + + class E87 { + Integer i; + } + + class F87 extends B87 { + Double d; + } + + association [1] F87 <-> E87 [1..*]; + association [*] B87 -> C87 [0..1]; + association [1] C87 <-> D87 [1]; + association [1..*] E87 <-> C87 [*]; + association [1] F87 <- D87 [1..*]; + + + enum G88 {F11, F12;} + + class B88 { + F88 e; + } + + class C88 { + B88 b88; + } + + class D88 extends C88 { + } + + class E88 { + Integer i; + } + + class F88 extends B88 { + Double d; + } + + association [1] F88 <-> E88 [1..*]; + association [*] B88 -> C88 [0..1]; + association [1] C88 <-> D88 [1]; + association [1..*] E88 <-> C88 [*]; + association [1] F88 <- D88 [1..*]; + + + enum G89 {F11, F12;} + + class B89 { + F89 e; + } + + class C89 { + B89 b89; + } + + class D89 extends C89 { + } + + class E89 { + Integer i; + } + + class F89 extends B89 { + Double d; + } + + association [1] F89 <-> E89 [1..*]; + association [*] B89 -> C89 [0..1]; + association [1] C89 <-> D89 [1]; + association [1..*] E89 <-> C89 [*]; + association [1] F89 <- D89 [1..*]; + + + enum G90 {F11, F12;} + + class B90 { + F90 e; + } + + class C90 { + B90 b90; + } + + class D90 extends C90 { + } + + class E90 { + Integer i; + } + + class F90 extends B90 { + Double d; + } + + association [1] F90 <-> E90 [1..*]; + association [*] B90 -> C90 [0..1]; + association [1] C90 <-> D90 [1]; + association [1..*] E90 <-> C90 [*]; + association [1] F90 <- D90 [1..*]; + + + enum G91 {F11, F12;} + + class B91 { + F91 e; + } + + class C91 { + B91 b91; + } + + class D91 extends C91 { + } + + class E91 { + Integer i; + } + + class F91 extends B91 { + Double d; + } + + association [1] F91 <-> E91 [1..*]; + association [*] B91 -> C91 [0..1]; + association [1] C91 <-> D91 [1]; + association [1..*] E91 <-> C91 [*]; + association [1] F91 <- D91 [1..*]; + + + enum G92 {F11, F12;} + + class B92 { + F92 e; + } + + class C92 { + B92 b92; + } + + class D92 extends C92 { + } + + class E92 { + Integer i; + } + + class F92 extends B92 { + Double d; + } + + association [1] F92 <-> E92 [1..*]; + association [*] B92 -> C92 [0..1]; + association [1] C92 <-> D92 [1]; + association [1..*] E92 <-> C92 [*]; + association [1] F92 <- D92 [1..*]; + + + enum G93 {F11, F12;} + + class B93 { + F93 e; + } + + class C93 { + B93 b93; + } + + class D93 extends C93 { + } + + class E93 { + Integer i; + } + + class F93 extends B93 { + Double d; + } + + association [1] F93 <-> E93 [1..*]; + association [*] B93 -> C93 [0..1]; + association [1] C93 <-> D93 [1]; + association [1..*] E93 <-> C93 [*]; + association [1] F93 <- D93 [1..*]; + + + enum G94 {F11, F12;} + + class B94 { + F94 e; + } + + class C94 { + B94 b94; + } + + class D94 extends C94 { + } + + class E94 { + Integer i; + } + + class F94 extends B94 { + Double d; + } + + association [1] F94 <-> E94 [1..*]; + association [*] B94 -> C94 [0..1]; + association [1] C94 <-> D94 [1]; + association [1..*] E94 <-> C94 [*]; + association [1] F94 <- D94 [1..*]; + + + enum G95 {F11, F12;} + + class B95 { + F95 e; + } + + class C95 { + B95 b95; + } + + class D95 extends C95 { + } + + class E95 { + Integer i; + } + + class F95 extends B95 { + Double d; + } + + association [1] F95 <-> E95 [1..*]; + association [*] B95 -> C95 [0..1]; + association [1] C95 <-> D95 [1]; + association [1..*] E95 <-> C95 [*]; + association [1] F95 <- D95 [1..*]; + + + enum G96 {F11, F12;} + + class B96 { + F96 e; + } + + class C96 { + B96 b96; + } + + class D96 extends C96 { + } + + class E96 { + Integer i; + } + + class F96 extends B96 { + Double d; + } + + association [1] F96 <-> E96 [1..*]; + association [*] B96 -> C96 [0..1]; + association [1] C96 <-> D96 [1]; + association [1..*] E96 <-> C96 [*]; + association [1] F96 <- D96 [1..*]; + + + enum G97 {F11, F12;} + + class B97 { + F97 e; + } + + class C97 { + B97 b97; + } + + class D97 extends C97 { + } + + class E97 { + Integer i; + } + + class F97 extends B97 { + Double d; + } + + association [1] F97 <-> E97 [1..*]; + association [*] B97 -> C97 [0..1]; + association [1] C97 <-> D97 [1]; + association [1..*] E97 <-> C97 [*]; + association [1] F97 <- D97 [1..*]; + + + enum G98 {F11, F12;} + + class B98 { + F98 e; + } + + class C98 { + B98 b98; + } + + class D98 extends C98 { + } + + class E98 { + Integer i; + } + + class F98 extends B98 { + Double d; + } + + association [1] F98 <-> E98 [1..*]; + association [*] B98 -> C98 [0..1]; + association [1] C98 <-> D98 [1]; + association [1..*] E98 <-> C98 [*]; + association [1] F98 <- D98 [1..*]; + + + enum G99 {F11, F12;} + + class B99 { + F99 e; + } + + class C99 { + B99 b99; + } + + class D99 extends C99 { + } + + class E99 { + Integer i; + } + + class F99 extends B99 { + Double d; + } + + association [1] F99 <-> E99 [1..*]; + association [*] B99 -> C99 [0..1]; + association [1] C99 <-> D99 [1]; + association [1..*] E99 <-> C99 [*]; + association [1] F99 <- D99 [1..*]; + + + enum G100 {F11, F12;} + + class B100 { + F100 e; + } + + class C100 { + B100 b100; + } + + class D100 extends C100 { + } + + class E100 { + Integer i; + } + + class F100 extends B100 { + Double d; + } + + association [1] F100 <-> E100 [1..*]; + association [*] B100 -> C100 [0..1]; + association [1] C100 <-> D100 [1]; + association [1..*] E100 <-> C100 [*]; + association [1] F100 <- D100 [1..*]; + + + enum G101 {F11, F12;} + + class B101 { + F101 e; + } + + class C101 { + B101 b101; + } + + class D101 extends C101 { + } + + class E101 { + Integer i; + } + + class F101 extends B101 { + Double d; + } + + association [1] F101 <-> E101 [1..*]; + association [*] B101 -> C101 [0..1]; + association [1] C101 <-> D101 [1]; + association [1..*] E101 <-> C101 [*]; + association [1] F101 <- D101 [1..*]; + + + enum G102 {F11, F12;} + + class B102 { + F102 e; + } + + class C102 { + B102 b102; + } + + class D102 extends C102 { + } + + class E102 { + Integer i; + } + + class F102 extends B102 { + Double d; + } + + association [1] F102 <-> E102 [1..*]; + association [*] B102 -> C102 [0..1]; + association [1] C102 <-> D102 [1]; + association [1..*] E102 <-> C102 [*]; + association [1] F102 <- D102 [1..*]; + + + enum G103 {F11, F12;} + + class B103 { + F103 e; + } + + class C103 { + B103 b103; + } + + class D103 extends C103 { + } + + class E103 { + Integer i; + } + + class F103 extends B103 { + Double d; + } + + association [1] F103 <-> E103 [1..*]; + association [*] B103 -> C103 [0..1]; + association [1] C103 <-> D103 [1]; + association [1..*] E103 <-> C103 [*]; + association [1] F103 <- D103 [1..*]; + + + enum G104 {F11, F12;} + + class B104 { + F104 e; + } + + class C104 { + B104 b104; + } + + class D104 extends C104 { + } + + class E104 { + Integer i; + } + + class F104 extends B104 { + Double d; + } + + association [1] F104 <-> E104 [1..*]; + association [*] B104 -> C104 [0..1]; + association [1] C104 <-> D104 [1]; + association [1..*] E104 <-> C104 [*]; + association [1] F104 <- D104 [1..*]; + + + enum G105 {F11, F12;} + + class B105 { + F105 e; + } + + class C105 { + B105 b105; + } + + class D105 extends C105 { + } + + class E105 { + Integer i; + } + + class F105 extends B105 { + Double d; + } + + association [1] F105 <-> E105 [1..*]; + association [*] B105 -> C105 [0..1]; + association [1] C105 <-> D105 [1]; + association [1..*] E105 <-> C105 [*]; + association [1] F105 <- D105 [1..*]; + + + enum G106 {F11, F12;} + + class B106 { + F106 e; + } + + class C106 { + B106 b106; + } + + class D106 extends C106 { + } + + class E106 { + Integer i; + } + + class F106 extends B106 { + Double d; + } + + association [1] F106 <-> E106 [1..*]; + association [*] B106 -> C106 [0..1]; + association [1] C106 <-> D106 [1]; + association [1..*] E106 <-> C106 [*]; + association [1] F106 <- D106 [1..*]; + + + enum G107 {F11, F12;} + + class B107 { + F107 e; + } + + class C107 { + B107 b107; + } + + class D107 extends C107 { + } + + class E107 { + Integer i; + } + + class F107 extends B107 { + Double d; + } + + association [1] F107 <-> E107 [1..*]; + association [*] B107 -> C107 [0..1]; + association [1] C107 <-> D107 [1]; + association [1..*] E107 <-> C107 [*]; + association [1] F107 <- D107 [1..*]; + + + enum G108 {F11, F12;} + + class B108 { + F108 e; + } + + class C108 { + B108 b108; + } + + class D108 extends C108 { + } + + class E108 { + Integer i; + } + + class F108 extends B108 { + Double d; + } + + association [1] F108 <-> E108 [1..*]; + association [*] B108 -> C108 [0..1]; + association [1] C108 <-> D108 [1]; + association [1..*] E108 <-> C108 [*]; + association [1] F108 <- D108 [1..*]; + + + enum G109 {F11, F12;} + + class B109 { + F109 e; + } + + class C109 { + B109 b109; + } + + class D109 extends C109 { + } + + class E109 { + Integer i; + } + + class F109 extends B109 { + Double d; + } + + association [1] F109 <-> E109 [1..*]; + association [*] B109 -> C109 [0..1]; + association [1] C109 <-> D109 [1]; + association [1..*] E109 <-> C109 [*]; + association [1] F109 <- D109 [1..*]; + + + enum G110 {F11, F12;} + + class B110 { + F110 e; + } + + class C110 { + B110 b110; + } + + class D110 extends C110 { + } + + class E110 { + Integer i; + } + + class F110 extends B110 { + Double d; + } + + association [1] F110 <-> E110 [1..*]; + association [*] B110 -> C110 [0..1]; + association [1] C110 <-> D110 [1]; + association [1..*] E110 <-> C110 [*]; + association [1] F110 <- D110 [1..*]; + + + enum G111 {F11, F12;} + + class B111 { + F111 e; + } + + class C111 { + B111 b111; + } + + class D111 extends C111 { + } + + class E111 { + Integer i; + } + + class F111 extends B111 { + Double d; + } + + association [1] F111 <-> E111 [1..*]; + association [*] B111 -> C111 [0..1]; + association [1] C111 <-> D111 [1]; + association [1..*] E111 <-> C111 [*]; + association [1] F111 <- D111 [1..*]; + + + enum G112 {F11, F12;} + + class B112 { + F112 e; + } + + class C112 { + B112 b112; + } + + class D112 extends C112 { + } + + class E112 { + Integer i; + } + + class F112 extends B112 { + Double d; + } + + association [1] F112 <-> E112 [1..*]; + association [*] B112 -> C112 [0..1]; + association [1] C112 <-> D112 [1]; + association [1..*] E112 <-> C112 [*]; + association [1] F112 <- D112 [1..*]; + + + enum G113 {F11, F12;} + + class B113 { + F113 e; + } + + class C113 { + B113 b113; + } + + class D113 extends C113 { + } + + class E113 { + Integer i; + } + + class F113 extends B113 { + Double d; + } + + association [1] F113 <-> E113 [1..*]; + association [*] B113 -> C113 [0..1]; + association [1] C113 <-> D113 [1]; + association [1..*] E113 <-> C113 [*]; + association [1] F113 <- D113 [1..*]; + + + enum G114 {F11, F12;} + + class B114 { + F114 e; + } + + class C114 { + B114 b114; + } + + class D114 extends C114 { + } + + class E114 { + Integer i; + } + + class F114 extends B114 { + Double d; + } + + association [1] F114 <-> E114 [1..*]; + association [*] B114 -> C114 [0..1]; + association [1] C114 <-> D114 [1]; + association [1..*] E114 <-> C114 [*]; + association [1] F114 <- D114 [1..*]; + + + enum G115 {F11, F12;} + + class B115 { + F115 e; + } + + class C115 { + B115 b115; + } + + class D115 extends C115 { + } + + class E115 { + Integer i; + } + + class F115 extends B115 { + Double d; + } + + association [1] F115 <-> E115 [1..*]; + association [*] B115 -> C115 [0..1]; + association [1] C115 <-> D115 [1]; + association [1..*] E115 <-> C115 [*]; + association [1] F115 <- D115 [1..*]; + + + enum G116 {F11, F12;} + + class B116 { + F116 e; + } + + class C116 { + B116 b116; + } + + class D116 extends C116 { + } + + class E116 { + Integer i; + } + + class F116 extends B116 { + Double d; + } + + association [1] F116 <-> E116 [1..*]; + association [*] B116 -> C116 [0..1]; + association [1] C116 <-> D116 [1]; + association [1..*] E116 <-> C116 [*]; + association [1] F116 <- D116 [1..*]; + + + enum G117 {F11, F12;} + + class B117 { + F117 e; + } + + class C117 { + B117 b117; + } + + class D117 extends C117 { + } + + class E117 { + Integer i; + } + + class F117 extends B117 { + Double d; + } + + association [1] F117 <-> E117 [1..*]; + association [*] B117 -> C117 [0..1]; + association [1] C117 <-> D117 [1]; + association [1..*] E117 <-> C117 [*]; + association [1] F117 <- D117 [1..*]; + + + enum G118 {F11, F12;} + + class B118 { + F118 e; + } + + class C118 { + B118 b118; + } + + class D118 extends C118 { + } + + class E118 { + Integer i; + } + + class F118 extends B118 { + Double d; + } + + association [1] F118 <-> E118 [1..*]; + association [*] B118 -> C118 [0..1]; + association [1] C118 <-> D118 [1]; + association [1..*] E118 <-> C118 [*]; + association [1] F118 <- D118 [1..*]; + + + enum G119 {F11, F12;} + + class B119 { + F119 e; + } + + class C119 { + B119 b119; + } + + class D119 extends C119 { + } + + class E119 { + Integer i; + } + + class F119 extends B119 { + Double d; + } + + association [1] F119 <-> E119 [1..*]; + association [*] B119 -> C119 [0..1]; + association [1] C119 <-> D119 [1]; + association [1..*] E119 <-> C119 [*]; + association [1] F119 <- D119 [1..*]; + + + enum G120 {F11, F12;} + + class B120 { + F120 e; + } + + class C120 { + B120 b120; + } + + class D120 extends C120 { + } + + class E120 { + Integer i; + } + + class F120 extends B120 { + Double d; + } + + association [1] F120 <-> E120 [1..*]; + association [*] B120 -> C120 [0..1]; + association [1] C120 <-> D120 [1]; + association [1..*] E120 <-> C120 [*]; + association [1] F120 <- D120 [1..*]; + + + enum G121 {F11, F12;} + + class B121 { + F121 e; + } + + class C121 { + B121 b121; + } + + class D121 extends C121 { + } + + class E121 { + Integer i; + } + + class F121 extends B121 { + Double d; + } + + association [1] F121 <-> E121 [1..*]; + association [*] B121 -> C121 [0..1]; + association [1] C121 <-> D121 [1]; + association [1..*] E121 <-> C121 [*]; + association [1] F121 <- D121 [1..*]; + + + enum G122 {F11, F12;} + + class B122 { + F122 e; + } + + class C122 { + B122 b122; + } + + class D122 extends C122 { + } + + class E122 { + Integer i; + } + + class F122 extends B122 { + Double d; + } + + association [1] F122 <-> E122 [1..*]; + association [*] B122 -> C122 [0..1]; + association [1] C122 <-> D122 [1]; + association [1..*] E122 <-> C122 [*]; + association [1] F122 <- D122 [1..*]; + + + enum G123 {F11, F12;} + + class B123 { + F123 e; + } + + class C123 { + B123 b123; + } + + class D123 extends C123 { + } + + class E123 { + Integer i; + } + + class F123 extends B123 { + Double d; + } + + association [1] F123 <-> E123 [1..*]; + association [*] B123 -> C123 [0..1]; + association [1] C123 <-> D123 [1]; + association [1..*] E123 <-> C123 [*]; + association [1] F123 <- D123 [1..*]; + + + enum G124 {F11, F12;} + + class B124 { + F124 e; + } + + class C124 { + B124 b124; + } + + class D124 extends C124 { + } + + class E124 { + Integer i; + } + + class F124 extends B124 { + Double d; + } + + association [1] F124 <-> E124 [1..*]; + association [*] B124 -> C124 [0..1]; + association [1] C124 <-> D124 [1]; + association [1..*] E124 <-> C124 [*]; + association [1] F124 <- D124 [1..*]; + + + enum G125 {F11, F12;} + + class B125 { + F125 e; + } + + class C125 { + B125 b125; + } + + class D125 extends C125 { + } + + class E125 { + Integer i; + } + + class F125 extends B125 { + Double d; + } + + association [1] F125 <-> E125 [1..*]; + association [*] B125 -> C125 [0..1]; + association [1] C125 <-> D125 [1]; + association [1..*] E125 <-> C125 [*]; + association [1] F125 <- D125 [1..*]; + + + enum G126 {F11, F12;} + + class B126 { + F126 e; + } + + class C126 { + B126 b126; + } + + class D126 extends C126 { + } + + class E126 { + Integer i; + } + + class F126 extends B126 { + Double d; + } + + association [1] F126 <-> E126 [1..*]; + association [*] B126 -> C126 [0..1]; + association [1] C126 <-> D126 [1]; + association [1..*] E126 <-> C126 [*]; + association [1] F126 <- D126 [1..*]; + + + enum G127 {F11, F12;} + + class B127 { + F127 e; + } + + class C127 { + B127 b127; + } + + class D127 extends C127 { + } + + class E127 { + Integer i; + } + + class F127 extends B127 { + Double d; + } + + association [1] F127 <-> E127 [1..*]; + association [*] B127 -> C127 [0..1]; + association [1] C127 <-> D127 [1]; + association [1..*] E127 <-> C127 [*]; + association [1] F127 <- D127 [1..*]; + + + enum G128 {F11, F12;} + + class B128 { + F128 e; + } + + class C128 { + B128 b128; + } + + class D128 extends C128 { + } + + class E128 { + Integer i; + } + + class F128 extends B128 { + Double d; + } + + association [1] F128 <-> E128 [1..*]; + association [*] B128 -> C128 [0..1]; + association [1] C128 <-> D128 [1]; + association [1..*] E128 <-> C128 [*]; + association [1] F128 <- D128 [1..*]; + + + enum G129 {F11, F12;} + + class B129 { + F129 e; + } + + class C129 { + B129 b129; + } + + class D129 extends C129 { + } + + class E129 { + Integer i; + } + + class F129 extends B129 { + Double d; + } + + association [1] F129 <-> E129 [1..*]; + association [*] B129 -> C129 [0..1]; + association [1] C129 <-> D129 [1]; + association [1..*] E129 <-> C129 [*]; + association [1] F129 <- D129 [1..*]; + + + enum G130 {F11, F12;} + + class B130 { + F130 e; + } + + class C130 { + B130 b130; + } + + class D130 extends C130 { + } + + class E130 { + Integer i; + } + + class F130 extends B130 { + Double d; + } + + association [1] F130 <-> E130 [1..*]; + association [*] B130 -> C130 [0..1]; + association [1] C130 <-> D130 [1]; + association [1..*] E130 <-> C130 [*]; + association [1] F130 <- D130 [1..*]; + + + enum G131 {F11, F12;} + + class B131 { + F131 e; + } + + class C131 { + B131 b131; + } + + class D131 extends C131 { + } + + class E131 { + Integer i; + } + + class F131 extends B131 { + Double d; + } + + association [1] F131 <-> E131 [1..*]; + association [*] B131 -> C131 [0..1]; + association [1] C131 <-> D131 [1]; + association [1..*] E131 <-> C131 [*]; + association [1] F131 <- D131 [1..*]; + + + enum G132 {F11, F12;} + + class B132 { + F132 e; + } + + class C132 { + B132 b132; + } + + class D132 extends C132 { + } + + class E132 { + Integer i; + } + + class F132 extends B132 { + Double d; + } + + association [1] F132 <-> E132 [1..*]; + association [*] B132 -> C132 [0..1]; + association [1] C132 <-> D132 [1]; + association [1..*] E132 <-> C132 [*]; + association [1] F132 <- D132 [1..*]; + + + enum G133 {F11, F12;} + + class B133 { + F133 e; + } + + class C133 { + B133 b133; + } + + class D133 extends C133 { + } + + class E133 { + Integer i; + } + + class F133 extends B133 { + Double d; + } + + association [1] F133 <-> E133 [1..*]; + association [*] B133 -> C133 [0..1]; + association [1] C133 <-> D133 [1]; + association [1..*] E133 <-> C133 [*]; + association [1] F133 <- D133 [1..*]; + + + enum G134 {F11, F12;} + + class B134 { + F134 e; + } + + class C134 { + B134 b134; + } + + class D134 extends C134 { + } + + class E134 { + Integer i; + } + + class F134 extends B134 { + Double d; + } + + association [1] F134 <-> E134 [1..*]; + association [*] B134 -> C134 [0..1]; + association [1] C134 <-> D134 [1]; + association [1..*] E134 <-> C134 [*]; + association [1] F134 <- D134 [1..*]; + + + enum G135 {F11, F12;} + + class B135 { + F135 e; + } + + class C135 { + B135 b135; + } + + class D135 extends C135 { + } + + class E135 { + Integer i; + } + + class F135 extends B135 { + Double d; + } + + association [1] F135 <-> E135 [1..*]; + association [*] B135 -> C135 [0..1]; + association [1] C135 <-> D135 [1]; + association [1..*] E135 <-> C135 [*]; + association [1] F135 <- D135 [1..*]; + + + enum G136 {F11, F12;} + + class B136 { + F136 e; + } + + class C136 { + B136 b136; + } + + class D136 extends C136 { + } + + class E136 { + Integer i; + } + + class F136 extends B136 { + Double d; + } + + association [1] F136 <-> E136 [1..*]; + association [*] B136 -> C136 [0..1]; + association [1] C136 <-> D136 [1]; + association [1..*] E136 <-> C136 [*]; + association [1] F136 <- D136 [1..*]; + + + enum G137 {F11, F12;} + + class B137 { + F137 e; + } + + class C137 { + B137 b137; + } + + class D137 extends C137 { + } + + class E137 { + Integer i; + } + + class F137 extends B137 { + Double d; + } + + association [1] F137 <-> E137 [1..*]; + association [*] B137 -> C137 [0..1]; + association [1] C137 <-> D137 [1]; + association [1..*] E137 <-> C137 [*]; + association [1] F137 <- D137 [1..*]; + + + enum G138 {F11, F12;} + + class B138 { + F138 e; + } + + class C138 { + B138 b138; + } + + class D138 extends C138 { + } + + class E138 { + Integer i; + } + + class F138 extends B138 { + Double d; + } + + association [1] F138 <-> E138 [1..*]; + association [*] B138 -> C138 [0..1]; + association [1] C138 <-> D138 [1]; + association [1..*] E138 <-> C138 [*]; + association [1] F138 <- D138 [1..*]; + + + enum G139 {F11, F12;} + + class B139 { + F139 e; + } + + class C139 { + B139 b139; + } + + class D139 extends C139 { + } + + class E139 { + Integer i; + } + + class F139 extends B139 { + Double d; + } + + association [1] F139 <-> E139 [1..*]; + association [*] B139 -> C139 [0..1]; + association [1] C139 <-> D139 [1]; + association [1..*] E139 <-> C139 [*]; + association [1] F139 <- D139 [1..*]; + + + enum G140 {F11, F12;} + + class B140 { + F140 e; + } + + class C140 { + B140 b140; + } + + class D140 extends C140 { + } + + class E140 { + Integer i; + } + + class F140 extends B140 { + Double d; + } + + association [1] F140 <-> E140 [1..*]; + association [*] B140 -> C140 [0..1]; + association [1] C140 <-> D140 [1]; + association [1..*] E140 <-> C140 [*]; + association [1] F140 <- D140 [1..*]; + + + enum G141 {F11, F12;} + + class B141 { + F141 e; + } + + class C141 { + B141 b141; + } + + class D141 extends C141 { + } + + class E141 { + Integer i; + } + + class F141 extends B141 { + Double d; + } + + association [1] F141 <-> E141 [1..*]; + association [*] B141 -> C141 [0..1]; + association [1] C141 <-> D141 [1]; + association [1..*] E141 <-> C141 [*]; + association [1] F141 <- D141 [1..*]; + + + enum G142 {F11, F12;} + + class B142 { + F142 e; + } + + class C142 { + B142 b142; + } + + class D142 extends C142 { + } + + class E142 { + Integer i; + } + + class F142 extends B142 { + Double d; + } + + association [1] F142 <-> E142 [1..*]; + association [*] B142 -> C142 [0..1]; + association [1] C142 <-> D142 [1]; + association [1..*] E142 <-> C142 [*]; + association [1] F142 <- D142 [1..*]; + + + enum G143 {F11, F12;} + + class B143 { + F143 e; + } + + class C143 { + B143 b143; + } + + class D143 extends C143 { + } + + class E143 { + Integer i; + } + + class F143 extends B143 { + Double d; + } + + association [1] F143 <-> E143 [1..*]; + association [*] B143 -> C143 [0..1]; + association [1] C143 <-> D143 [1]; + association [1..*] E143 <-> C143 [*]; + association [1] F143 <- D143 [1..*]; + + + enum G144 {F11, F12;} + + class B144 { + F144 e; + } + + class C144 { + B144 b144; + } + + class D144 extends C144 { + } + + class E144 { + Integer i; + } + + class F144 extends B144 { + Double d; + } + + association [1] F144 <-> E144 [1..*]; + association [*] B144 -> C144 [0..1]; + association [1] C144 <-> D144 [1]; + association [1..*] E144 <-> C144 [*]; + association [1] F144 <- D144 [1..*]; + + + enum G145 {F11, F12;} + + class B145 { + F145 e; + } + + class C145 { + B145 b145; + } + + class D145 extends C145 { + } + + class E145 { + Integer i; + } + + class F145 extends B145 { + Double d; + } + + association [1] F145 <-> E145 [1..*]; + association [*] B145 -> C145 [0..1]; + association [1] C145 <-> D145 [1]; + association [1..*] E145 <-> C145 [*]; + association [1] F145 <- D145 [1..*]; + + + enum G146 {F11, F12;} + + class B146 { + F146 e; + } + + class C146 { + B146 b146; + } + + class D146 extends C146 { + } + + class E146 { + Integer i; + } + + class F146 extends B146 { + Double d; + } + + association [1] F146 <-> E146 [1..*]; + association [*] B146 -> C146 [0..1]; + association [1] C146 <-> D146 [1]; + association [1..*] E146 <-> C146 [*]; + association [1] F146 <- D146 [1..*]; + + + enum G147 {F11, F12;} + + class B147 { + F147 e; + } + + class C147 { + B147 b147; + } + + class D147 extends C147 { + } + + class E147 { + Integer i; + } + + class F147 extends B147 { + Double d; + } + + association [1] F147 <-> E147 [1..*]; + association [*] B147 -> C147 [0..1]; + association [1] C147 <-> D147 [1]; + association [1..*] E147 <-> C147 [*]; + association [1] F147 <- D147 [1..*]; + + + enum G148 {F11, F12;} + + class B148 { + F148 e; + } + + class C148 { + B148 b148; + } + + class D148 extends C148 { + } + + class E148 { + Integer i; + } + + class F148 extends B148 { + Double d; + } + + association [1] F148 <-> E148 [1..*]; + association [*] B148 -> C148 [0..1]; + association [1] C148 <-> D148 [1]; + association [1..*] E148 <-> C148 [*]; + association [1] F148 <- D148 [1..*]; + + + enum G149 {F11, F12;} + + class B149 { + F149 e; + } + + class C149 { + B149 b149; + } + + class D149 extends C149 { + } + + class E149 { + Integer i; + } + + class F149 extends B149 { + Double d; + } + + association [1] F149 <-> E149 [1..*]; + association [*] B149 -> C149 [0..1]; + association [1] C149 <-> D149 [1]; + association [1..*] E149 <-> C149 [*]; + association [1] F149 <- D149 [1..*]; + + + enum G150 {F11, F12;} + + class B150 { + F150 e; + } + + class C150 { + B150 b150; + } + + class D150 extends C150 { + } + + class E150 { + Integer i; + } + + class F150 extends B150 { + Double d; + } + + association [1] F150 <-> E150 [1..*]; + association [*] B150 -> C150 [0..1]; + association [1] C150 <-> D150 [1]; + association [1..*] E150 <-> C150 [*]; + association [1] F150 <- D150 [1..*]; + + + enum G151 {F11, F12;} + + class B151 { + F151 e; + } + + class C151 { + B151 b151; + } + + class D151 extends C151 { + } + + class E151 { + Integer i; + } + + class F151 extends B151 { + Double d; + } + + association [1] F151 <-> E151 [1..*]; + association [*] B151 -> C151 [0..1]; + association [1] C151 <-> D151 [1]; + association [1..*] E151 <-> C151 [*]; + association [1] F151 <- D151 [1..*]; + + + enum G152 {F11, F12;} + + class B152 { + F152 e; + } + + class C152 { + B152 b152; + } + + class D152 extends C152 { + } + + class E152 { + Integer i; + } + + class F152 extends B152 { + Double d; + } + + association [1] F152 <-> E152 [1..*]; + association [*] B152 -> C152 [0..1]; + association [1] C152 <-> D152 [1]; + association [1..*] E152 <-> C152 [*]; + association [1] F152 <- D152 [1..*]; + + + enum G153 {F11, F12;} + + class B153 { + F153 e; + } + + class C153 { + B153 b153; + } + + class D153 extends C153 { + } + + class E153 { + Integer i; + } + + class F153 extends B153 { + Double d; + } + + association [1] F153 <-> E153 [1..*]; + association [*] B153 -> C153 [0..1]; + association [1] C153 <-> D153 [1]; + association [1..*] E153 <-> C153 [*]; + association [1] F153 <- D153 [1..*]; + + + enum G154 {F11, F12;} + + class B154 { + F154 e; + } + + class C154 { + B154 b154; + } + + class D154 extends C154 { + } + + class E154 { + Integer i; + } + + class F154 extends B154 { + Double d; + } + + association [1] F154 <-> E154 [1..*]; + association [*] B154 -> C154 [0..1]; + association [1] C154 <-> D154 [1]; + association [1..*] E154 <-> C154 [*]; + association [1] F154 <- D154 [1..*]; + + + enum G155 {F11, F12;} + + class B155 { + F155 e; + } + + class C155 { + B155 b155; + } + + class D155 extends C155 { + } + + class E155 { + Integer i; + } + + class F155 extends B155 { + Double d; + } + + association [1] F155 <-> E155 [1..*]; + association [*] B155 -> C155 [0..1]; + association [1] C155 <-> D155 [1]; + association [1..*] E155 <-> C155 [*]; + association [1] F155 <- D155 [1..*]; + + + enum G156 {F11, F12;} + + class B156 { + F156 e; + } + + class C156 { + B156 b156; + } + + class D156 extends C156 { + } + + class E156 { + Integer i; + } + + class F156 extends B156 { + Double d; + } + + association [1] F156 <-> E156 [1..*]; + association [*] B156 -> C156 [0..1]; + association [1] C156 <-> D156 [1]; + association [1..*] E156 <-> C156 [*]; + association [1] F156 <- D156 [1..*]; + + + enum G157 {F11, F12;} + + class B157 { + F157 e; + } + + class C157 { + B157 b157; + } + + class D157 extends C157 { + } + + class E157 { + Integer i; + } + + class F157 extends B157 { + Double d; + } + + association [1] F157 <-> E157 [1..*]; + association [*] B157 -> C157 [0..1]; + association [1] C157 <-> D157 [1]; + association [1..*] E157 <-> C157 [*]; + association [1] F157 <- D157 [1..*]; + + + enum G158 {F11, F12;} + + class B158 { + F158 e; + } + + class C158 { + B158 b158; + } + + class D158 extends C158 { + } + + class E158 { + Integer i; + } + + class F158 extends B158 { + Double d; + } + + association [1] F158 <-> E158 [1..*]; + association [*] B158 -> C158 [0..1]; + association [1] C158 <-> D158 [1]; + association [1..*] E158 <-> C158 [*]; + association [1] F158 <- D158 [1..*]; + + + enum G159 {F11, F12;} + + class B159 { + F159 e; + } + + class C159 { + B159 b159; + } + + class D159 extends C159 { + } + + class E159 { + Integer i; + } + + class F159 extends B159 { + Double d; + } + + association [1] F159 <-> E159 [1..*]; + association [*] B159 -> C159 [0..1]; + association [1] C159 <-> D159 [1]; + association [1..*] E159 <-> C159 [*]; + association [1] F159 <- D159 [1..*]; + + + enum G160 {F11, F12;} + + class B160 { + F160 e; + } + + class C160 { + B160 b160; + } + + class D160 extends C160 { + } + + class E160 { + Integer i; + } + + class F160 extends B160 { + Double d; + } + + association [1] F160 <-> E160 [1..*]; + association [*] B160 -> C160 [0..1]; + association [1] C160 <-> D160 [1]; + association [1..*] E160 <-> C160 [*]; + association [1] F160 <- D160 [1..*]; + + + enum G161 {F11, F12;} + + class B161 { + F161 e; + } + + class C161 { + B161 b161; + } + + class D161 extends C161 { + } + + class E161 { + Integer i; + } + + class F161 extends B161 { + Double d; + } + + association [1] F161 <-> E161 [1..*]; + association [*] B161 -> C161 [0..1]; + association [1] C161 <-> D161 [1]; + association [1..*] E161 <-> C161 [*]; + association [1] F161 <- D161 [1..*]; + + + enum G162 {F11, F12;} + + class B162 { + F162 e; + } + + class C162 { + B162 b162; + } + + class D162 extends C162 { + } + + class E162 { + Integer i; + } + + class F162 extends B162 { + Double d; + } + + association [1] F162 <-> E162 [1..*]; + association [*] B162 -> C162 [0..1]; + association [1] C162 <-> D162 [1]; + association [1..*] E162 <-> C162 [*]; + association [1] F162 <- D162 [1..*]; + + + enum G163 {F11, F12;} + + class B163 { + F163 e; + } + + class C163 { + B163 b163; + } + + class D163 extends C163 { + } + + class E163 { + Integer i; + } + + class F163 extends B163 { + Double d; + } + + association [1] F163 <-> E163 [1..*]; + association [*] B163 -> C163 [0..1]; + association [1] C163 <-> D163 [1]; + association [1..*] E163 <-> C163 [*]; + association [1] F163 <- D163 [1..*]; + + + enum G164 {F11, F12;} + + class B164 { + F164 e; + } + + class C164 { + B164 b164; + } + + class D164 extends C164 { + } + + class E164 { + Integer i; + } + + class F164 extends B164 { + Double d; + } + + association [1] F164 <-> E164 [1..*]; + association [*] B164 -> C164 [0..1]; + association [1] C164 <-> D164 [1]; + association [1..*] E164 <-> C164 [*]; + association [1] F164 <- D164 [1..*]; + + + enum G165 {F11, F12;} + + class B165 { + F165 e; + } + + class C165 { + B165 b165; + } + + class D165 extends C165 { + } + + class E165 { + Integer i; + } + + class F165 extends B165 { + Double d; + } + + association [1] F165 <-> E165 [1..*]; + association [*] B165 -> C165 [0..1]; + association [1] C165 <-> D165 [1]; + association [1..*] E165 <-> C165 [*]; + association [1] F165 <- D165 [1..*]; + + + enum G166 {F11, F12;} + + class B166 { + F166 e; + } + + class C166 { + B166 b166; + } + + class D166 extends C166 { + } + + class E166 { + Integer i; + } + + class F166 extends B166 { + Double d; + } + + association [1] F166 <-> E166 [1..*]; + association [*] B166 -> C166 [0..1]; + association [1] C166 <-> D166 [1]; + association [1..*] E166 <-> C166 [*]; + association [1] F166 <- D166 [1..*]; + + + enum G167 {F11, F12;} + + class B167 { + F167 e; + } + + class C167 { + B167 b167; + } + + class D167 extends C167 { + } + + class E167 { + Integer i; + } + + class F167 extends B167 { + Double d; + } + + association [1] F167 <-> E167 [1..*]; + association [*] B167 -> C167 [0..1]; + association [1] C167 <-> D167 [1]; + association [1..*] E167 <-> C167 [*]; + association [1] F167 <- D167 [1..*]; + + + enum G168 {F11, F12;} + + class B168 { + F168 e; + } + + class C168 { + B168 b168; + } + + class D168 extends C168 { + } + + class E168 { + Integer i; + } + + class F168 extends B168 { + Double d; + } + + association [1] F168 <-> E168 [1..*]; + association [*] B168 -> C168 [0..1]; + association [1] C168 <-> D168 [1]; + association [1..*] E168 <-> C168 [*]; + association [1] F168 <- D168 [1..*]; + + + enum G169 {F11, F12;} + + class B169 { + F169 e; + } + + class C169 { + B169 b169; + } + + class D169 extends C169 { + } + + class E169 { + Integer i; + } + + class F169 extends B169 { + Double d; + } + + association [1] F169 <-> E169 [1..*]; + association [*] B169 -> C169 [0..1]; + association [1] C169 <-> D169 [1]; + association [1..*] E169 <-> C169 [*]; + association [1] F169 <- D169 [1..*]; + + + enum G170 {F11, F12;} + + class B170 { + F170 e; + } + + class C170 { + B170 b170; + } + + class D170 extends C170 { + } + + class E170 { + Integer i; + } + + class F170 extends B170 { + Double d; + } + + association [1] F170 <-> E170 [1..*]; + association [*] B170 -> C170 [0..1]; + association [1] C170 <-> D170 [1]; + association [1..*] E170 <-> C170 [*]; + association [1] F170 <- D170 [1..*]; + + + enum G171 {F11, F12;} + + class B171 { + F171 e; + } + + class C171 { + B171 b171; + } + + class D171 extends C171 { + } + + class E171 { + Integer i; + } + + class F171 extends B171 { + Double d; + } + + association [1] F171 <-> E171 [1..*]; + association [*] B171 -> C171 [0..1]; + association [1] C171 <-> D171 [1]; + association [1..*] E171 <-> C171 [*]; + association [1] F171 <- D171 [1..*]; + + + enum G172 {F11, F12;} + + class B172 { + F172 e; + } + + class C172 { + B172 b172; + } + + class D172 extends C172 { + } + + class E172 { + Integer i; + } + + class F172 extends B172 { + Double d; + } + + association [1] F172 <-> E172 [1..*]; + association [*] B172 -> C172 [0..1]; + association [1] C172 <-> D172 [1]; + association [1..*] E172 <-> C172 [*]; + association [1] F172 <- D172 [1..*]; + + + enum G173 {F11, F12;} + + class B173 { + F173 e; + } + + class C173 { + B173 b173; + } + + class D173 extends C173 { + } + + class E173 { + Integer i; + } + + class F173 extends B173 { + Double d; + } + + association [1] F173 <-> E173 [1..*]; + association [*] B173 -> C173 [0..1]; + association [1] C173 <-> D173 [1]; + association [1..*] E173 <-> C173 [*]; + association [1] F173 <- D173 [1..*]; + + + enum G174 {F11, F12;} + + class B174 { + F174 e; + } + + class C174 { + B174 b174; + } + + class D174 extends C174 { + } + + class E174 { + Integer i; + } + + class F174 extends B174 { + Double d; + } + + association [1] F174 <-> E174 [1..*]; + association [*] B174 -> C174 [0..1]; + association [1] C174 <-> D174 [1]; + association [1..*] E174 <-> C174 [*]; + association [1] F174 <- D174 [1..*]; + + + enum G175 {F11, F12;} + + class B175 { + F175 e; + } + + class C175 { + B175 b175; + } + + class D175 extends C175 { + } + + class E175 { + Integer i; + } + + class F175 extends B175 { + Double d; + } + + association [1] F175 <-> E175 [1..*]; + association [*] B175 -> C175 [0..1]; + association [1] C175 <-> D175 [1]; + association [1..*] E175 <-> C175 [*]; + association [1] F175 <- D175 [1..*]; + + + enum G176 {F11, F12;} + + class B176 { + F176 e; + } + + class C176 { + B176 b176; + } + + class D176 extends C176 { + } + + class E176 { + Integer i; + } + + class F176 extends B176 { + Double d; + } + + association [1] F176 <-> E176 [1..*]; + association [*] B176 -> C176 [0..1]; + association [1] C176 <-> D176 [1]; + association [1..*] E176 <-> C176 [*]; + association [1] F176 <- D176 [1..*]; + + + enum G177 {F11, F12;} + + class B177 { + F177 e; + } + + class C177 { + B177 b177; + } + + class D177 extends C177 { + } + + class E177 { + Integer i; + } + + class F177 extends B177 { + Double d; + } + + association [1] F177 <-> E177 [1..*]; + association [*] B177 -> C177 [0..1]; + association [1] C177 <-> D177 [1]; + association [1..*] E177 <-> C177 [*]; + association [1] F177 <- D177 [1..*]; + + + enum G178 {F11, F12;} + + class B178 { + F178 e; + } + + class C178 { + B178 b178; + } + + class D178 extends C178 { + } + + class E178 { + Integer i; + } + + class F178 extends B178 { + Double d; + } + + association [1] F178 <-> E178 [1..*]; + association [*] B178 -> C178 [0..1]; + association [1] C178 <-> D178 [1]; + association [1..*] E178 <-> C178 [*]; + association [1] F178 <- D178 [1..*]; + + + enum G179 {F11, F12;} + + class B179 { + F179 e; + } + + class C179 { + B179 b179; + } + + class D179 extends C179 { + } + + class E179 { + Integer i; + } + + class F179 extends B179 { + Double d; + } + + association [1] F179 <-> E179 [1..*]; + association [*] B179 -> C179 [0..1]; + association [1] C179 <-> D179 [1]; + association [1..*] E179 <-> C179 [*]; + association [1] F179 <- D179 [1..*]; + + + enum G180 {F11, F12;} + + class B180 { + F180 e; + } + + class C180 { + B180 b180; + } + + class D180 extends C180 { + } + + class E180 { + Integer i; + } + + class F180 extends B180 { + Double d; + } + + association [1] F180 <-> E180 [1..*]; + association [*] B180 -> C180 [0..1]; + association [1] C180 <-> D180 [1]; + association [1..*] E180 <-> C180 [*]; + association [1] F180 <- D180 [1..*]; + + + enum G181 {F11, F12;} + + class B181 { + F181 e; + } + + class C181 { + B181 b181; + } + + class D181 extends C181 { + } + + class E181 { + Integer i; + } + + class F181 extends B181 { + Double d; + } + + association [1] F181 <-> E181 [1..*]; + association [*] B181 -> C181 [0..1]; + association [1] C181 <-> D181 [1]; + association [1..*] E181 <-> C181 [*]; + association [1] F181 <- D181 [1..*]; + + + enum G182 {F11, F12;} + + class B182 { + F182 e; + } + + class C182 { + B182 b182; + } + + class D182 extends C182 { + } + + class E182 { + Integer i; + } + + class F182 extends B182 { + Double d; + } + + association [1] F182 <-> E182 [1..*]; + association [*] B182 -> C182 [0..1]; + association [1] C182 <-> D182 [1]; + association [1..*] E182 <-> C182 [*]; + association [1] F182 <- D182 [1..*]; + + + enum G183 {F11, F12;} + + class B183 { + F183 e; + } + + class C183 { + B183 b183; + } + + class D183 extends C183 { + } + + class E183 { + Integer i; + } + + class F183 extends B183 { + Double d; + } + + association [1] F183 <-> E183 [1..*]; + association [*] B183 -> C183 [0..1]; + association [1] C183 <-> D183 [1]; + association [1..*] E183 <-> C183 [*]; + association [1] F183 <- D183 [1..*]; + + + enum G184 {F11, F12;} + + class B184 { + F184 e; + } + + class C184 { + B184 b184; + } + + class D184 extends C184 { + } + + class E184 { + Integer i; + } + + class F184 extends B184 { + Double d; + } + + association [1] F184 <-> E184 [1..*]; + association [*] B184 -> C184 [0..1]; + association [1] C184 <-> D184 [1]; + association [1..*] E184 <-> C184 [*]; + association [1] F184 <- D184 [1..*]; + + + enum G185 {F11, F12;} + + class B185 { + F185 e; + } + + class C185 { + B185 b185; + } + + class D185 extends C185 { + } + + class E185 { + Integer i; + } + + class F185 extends B185 { + Double d; + } + + association [1] F185 <-> E185 [1..*]; + association [*] B185 -> C185 [0..1]; + association [1] C185 <-> D185 [1]; + association [1..*] E185 <-> C185 [*]; + association [1] F185 <- D185 [1..*]; + + + enum G186 {F11, F12;} + + class B186 { + F186 e; + } + + class C186 { + B186 b186; + } + + class D186 extends C186 { + } + + class E186 { + Integer i; + } + + class F186 extends B186 { + Double d; + } + + association [1] F186 <-> E186 [1..*]; + association [*] B186 -> C186 [0..1]; + association [1] C186 <-> D186 [1]; + association [1..*] E186 <-> C186 [*]; + association [1] F186 <- D186 [1..*]; + + + enum G187 {F11, F12;} + + class B187 { + F187 e; + } + + class C187 { + B187 b187; + } + + class D187 extends C187 { + } + + class E187 { + Integer i; + } + + class F187 extends B187 { + Double d; + } + + association [1] F187 <-> E187 [1..*]; + association [*] B187 -> C187 [0..1]; + association [1] C187 <-> D187 [1]; + association [1..*] E187 <-> C187 [*]; + association [1] F187 <- D187 [1..*]; + + + enum G188 {F11, F12;} + + class B188 { + F188 e; + } + + class C188 { + B188 b188; + } + + class D188 extends C188 { + } + + class E188 { + Integer i; + } + + class F188 extends B188 { + Double d; + } + + association [1] F188 <-> E188 [1..*]; + association [*] B188 -> C188 [0..1]; + association [1] C188 <-> D188 [1]; + association [1..*] E188 <-> C188 [*]; + association [1] F188 <- D188 [1..*]; + + + enum G189 {F11, F12;} + + class B189 { + F189 e; + } + + class C189 { + B189 b189; + } + + class D189 extends C189 { + } + + class E189 { + Integer i; + } + + class F189 extends B189 { + Double d; + } + + association [1] F189 <-> E189 [1..*]; + association [*] B189 -> C189 [0..1]; + association [1] C189 <-> D189 [1]; + association [1..*] E189 <-> C189 [*]; + association [1] F189 <- D189 [1..*]; + + + enum G190 {F11, F12;} + + class B190 { + F190 e; + } + + class C190 { + B190 b190; + } + + class D190 extends C190 { + } + + class E190 { + Integer i; + } + + class F190 extends B190 { + Double d; + } + + association [1] F190 <-> E190 [1..*]; + association [*] B190 -> C190 [0..1]; + association [1] C190 <-> D190 [1]; + association [1..*] E190 <-> C190 [*]; + association [1] F190 <- D190 [1..*]; + + + enum G191 {F11, F12;} + + class B191 { + F191 e; + } + + class C191 { + B191 b191; + } + + class D191 extends C191 { + } + + class E191 { + Integer i; + } + + class F191 extends B191 { + Double d; + } + + association [1] F191 <-> E191 [1..*]; + association [*] B191 -> C191 [0..1]; + association [1] C191 <-> D191 [1]; + association [1..*] E191 <-> C191 [*]; + association [1] F191 <- D191 [1..*]; + + + enum G192 {F11, F12;} + + class B192 { + F192 e; + } + + class C192 { + B192 b192; + } + + class D192 extends C192 { + } + + class E192 { + Integer i; + } + + class F192 extends B192 { + Double d; + } + + association [1] F192 <-> E192 [1..*]; + association [*] B192 -> C192 [0..1]; + association [1] C192 <-> D192 [1]; + association [1..*] E192 <-> C192 [*]; + association [1] F192 <- D192 [1..*]; + + + enum G193 {F11, F12;} + + class B193 { + F193 e; + } + + class C193 { + B193 b193; + } + + class D193 extends C193 { + } + + class E193 { + Integer i; + } + + class F193 extends B193 { + Double d; + } + + association [1] F193 <-> E193 [1..*]; + association [*] B193 -> C193 [0..1]; + association [1] C193 <-> D193 [1]; + association [1..*] E193 <-> C193 [*]; + association [1] F193 <- D193 [1..*]; + + + enum G194 {F11, F12;} + + class B194 { + F194 e; + } + + class C194 { + B194 b194; + } + + class D194 extends C194 { + } + + class E194 { + Integer i; + } + + class F194 extends B194 { + Double d; + } + + association [1] F194 <-> E194 [1..*]; + association [*] B194 -> C194 [0..1]; + association [1] C194 <-> D194 [1]; + association [1..*] E194 <-> C194 [*]; + association [1] F194 <- D194 [1..*]; + + + enum G195 {F11, F12;} + + class B195 { + F195 e; + } + + class C195 { + B195 b195; + } + + class D195 extends C195 { + } + + class E195 { + Integer i; + } + + class F195 extends B195 { + Double d; + } + + association [1] F195 <-> E195 [1..*]; + association [*] B195 -> C195 [0..1]; + association [1] C195 <-> D195 [1]; + association [1..*] E195 <-> C195 [*]; + association [1] F195 <- D195 [1..*]; + + + enum G196 {F11, F12;} + + class B196 { + F196 e; + } + + class C196 { + B196 b196; + } + + class D196 extends C196 { + } + + class E196 { + Integer i; + } + + class F196 extends B196 { + Double d; + } + + association [1] F196 <-> E196 [1..*]; + association [*] B196 -> C196 [0..1]; + association [1] C196 <-> D196 [1]; + association [1..*] E196 <-> C196 [*]; + association [1] F196 <- D196 [1..*]; + + + enum G197 {F11, F12;} + + class B197 { + F197 e; + } + + class C197 { + B197 b197; + } + + class D197 extends C197 { + } + + class E197 { + Integer i; + } + + class F197 extends B197 { + Double d; + } + + association [1] F197 <-> E197 [1..*]; + association [*] B197 -> C197 [0..1]; + association [1] C197 <-> D197 [1]; + association [1..*] E197 <-> C197 [*]; + association [1] F197 <- D197 [1..*]; + + + enum G198 {F11, F12;} + + class B198 { + F198 e; + } + + class C198 { + B198 b198; + } + + class D198 extends C198 { + } + + class E198 { + Integer i; + } + + class F198 extends B198 { + Double d; + } + + association [1] F198 <-> E198 [1..*]; + association [*] B198 -> C198 [0..1]; + association [1] C198 <-> D198 [1]; + association [1..*] E198 <-> C198 [*]; + association [1] F198 <- D198 [1..*]; + + + enum G199 {F11, F12;} + + class B199 { + F199 e; + } + + class C199 { + B199 b199; + } + + class D199 extends C199 { + } + + class E199 { + Integer i; + } + + class F199 extends B199 { + Double d; + } + + association [1] F199 <-> E199 [1..*]; + association [*] B199 -> C199 [0..1]; + association [1] C199 <-> D199 [1]; + association [1..*] E199 <-> C199 [*]; + association [1] F199 <- D199 [1..*]; + + + enum G200 {F11, F12;} + + class B200 { + F200 e; + } + + class C200 { + B200 b200; + } + + class D200 extends C200 { + } + + class E200 { + Integer i; + } + + class F200 extends B200 { + Double d; + } + + association [1] F200 <-> E200 [1..*]; + association [*] B200 -> C200 [0..1]; + association [1] C200 <-> D200 [1]; + association [1..*] E200 <-> C200 [*]; + association [1] F200 <- D200 [1..*]; + +} + diff --git a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/Source2.cd b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/Source2.cd index 95b9f7327..86ce39472 100644 --- a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/Source2.cd +++ b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/Source2.cd @@ -2,6 +2,7 @@ import java.lang.String; classdiagram Source2 { enum EnumsCheck{e;} + enum AddedEnum{a,b;} class A extends B{ EnumsCheck e; diff --git a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/Target2.cd b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/Target2.cd index ee11d1375..0c4b5cd4c 100644 --- a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/Target2.cd +++ b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/Target2.cd @@ -2,6 +2,7 @@ import java.lang.String; classdiagram Target2 { enum EnumsCheck{e;} + enum DeletedEnum{c,d;} class A{ int a; From 1e5df003cba11ad70a075e0f024c21fdd42f0e4f Mon Sep 17 00:00:00 2001 From: Lukas Kronast Date: Fri, 27 Jun 2025 12:18:15 +0200 Subject: [PATCH 03/17] linting --- .../cddiff/syndiff/CDSyntaxDiff.java | 181 ++++++------ .../cddiff/syndiff/AssertSynDiff.java | 80 +++-- .../cddiff/syndiff/PerformanceTest.java | 26 +- .../cddiff/syndiff/Syn2SemDiffTest.java | 274 +++++++++++------- .../cddiff/syndiff/SynAssocDiffTest.java | 92 +++--- .../cddiff/syndiff/SynDiffTestBasis.java | 26 +- .../cddiff/syndiff/SyntaxDiffTest.java | 213 ++++++-------- .../cddiff/syndiff/TypeDiffTest.java | 77 ++--- 8 files changed, 483 insertions(+), 486 deletions(-) diff --git a/cddiff/src/main/java/de/monticore/cddiff/syndiff/CDSyntaxDiff.java b/cddiff/src/main/java/de/monticore/cddiff/syndiff/CDSyntaxDiff.java index 63f537e6f..2f7fd2f50 100644 --- a/cddiff/src/main/java/de/monticore/cddiff/syndiff/CDSyntaxDiff.java +++ b/cddiff/src/main/java/de/monticore/cddiff/syndiff/CDSyntaxDiff.java @@ -49,7 +49,7 @@ * this class the overlapping and duplicated associations are handled. */ public class CDSyntaxDiff extends SyntaxDiffHelper implements ICDSyntaxDiff { - + private ASTCDCompilationUnit srcCD; private ASTCDCompilationUnit tgtCD; private List changedTypes; @@ -73,27 +73,27 @@ public class CDSyntaxDiff extends SyntaxDiffHelper implements ICDSyntaxDiff { private List baseDiff; List srcCDTypes; ICD4CodeArtifactScope scopeSrcCD, scopeTgtCD; - + protected CDSynDiffMatches matches; protected Syn2SemDiffHelper helper; private final List matchingStrategies; - + public CDSyntaxDiff(ASTCDCompilationUnit srcCD, ASTCDCompilationUnit tgtCD) { this(srcCD, tgtCD, List.of()); // Use all matching strategies } - + public CDSyntaxDiff(ASTCDCompilationUnit srcCD, ASTCDCompilationUnit tgtCD, List matchingStrategies) { this.srcCD = srcCD; this.tgtCD = tgtCD; CDDiffUtil.refreshSymbolTable(srcCD); CDDiffUtil.refreshSymbolTable(tgtCD); - + this.matchingStrategies = matchingStrategies; boolean structureMatch = matchingStrategies.contains(MatchingStrategy.STRUCTURE_TYPE_MATCHING) || matchingStrategies.isEmpty(); this.matches = new CDSynDiffMatches(this.srcCD, this.tgtCD, structureMatch); - + helper = new Syn2SemDiffHelper(matches); // Don't change the order of the calls! helper.setNotInstClassesSrc(new HashSet<>()); helper.setNotInstClassesTgt(new HashSet<>()); @@ -127,11 +127,11 @@ public CDSyntaxDiff(ASTCDCompilationUnit srcCD, ASTCDCompilationUnit tgtCD, srcCDTypes.addAll(srcCD.getCDDefinition().getCDClassesList()); srcCDTypes.addAll(srcCD.getCDDefinition().getCDEnumsList()); srcCDTypes.addAll(srcCD.getCDDefinition().getCDInterfacesList()); - + // Trafo to make in-class declarations of compositions appear in the association list new CD4CodeDirectCompositionTrafo().transform(srcCD); new CD4CodeDirectCompositionTrafo().transform(tgtCD); - + loadAllLists(srcCD, tgtCD, scopeSrcCD, scopeTgtCD); helper.setMatchedClasses(matchedClasses); helper.setDeletedAssocs(deletedAssocs); @@ -141,130 +141,129 @@ public CDSyntaxDiff(ASTCDCompilationUnit srcCD, ASTCDCompilationUnit tgtCD, helper.setDiffs(changedAssocs); helper.setMatcher(); } - + @Override public ASTCDCompilationUnit getSrcCD() { return srcCD; } - + @Override public void setSrcCD(ASTCDCompilationUnit srcCD) { this.srcCD = srcCD; } - + @Override public ASTCDCompilationUnit getTgtCD() { return tgtCD; } - + @Override public void setTgtCD(ASTCDCompilationUnit tgtCD) { this.tgtCD = tgtCD; } - + public Syn2SemDiffHelper getHelper() { return helper; } - + @Override public List getBaseDiff() { return baseDiff; } - + @Override public void setBaseDiff(List baseDiff) { this.baseDiff = baseDiff; } - + @Override - public List getChangedTypes() { - return changedTypes; } - + public List getChangedTypes() { return changedTypes; } + @Override public void setChangedTypes(List changedTypes) { this.changedTypes = changedTypes; } - + @Override public List getChangedAssocs() { return changedAssocs; } - + @Override public void setChangedAssocs(List changedAssocs) { this.changedAssocs = changedAssocs; } - + @Override public List getAddedClasses() { return addedClasses; } - + @Override public void setAddedClasses(List addedClasses) { this.addedClasses = addedClasses; } - + @Override public List getDeletedClasses() { return deletedClasses; } - + @Override public List getAddedInterfaces() { return addedInterfaces; } - + @Override public List getDeletedInterfaces() { return deletedInterfaces; } - + @Override public void setDeletedClasses(List deletedClasses) { this.deletedClasses = deletedClasses; } - + @Override public void setAddedInterfaces(List addedInterfaces) { this.addedInterfaces = addedInterfaces; } - + @Override public void setDeletedInterfaces(List deletedInterfaces) { this.deletedInterfaces = deletedInterfaces; } - + @Override public List getAddedEnums() { return addedEnums; } - + @Override public void setAddedEnums(List addedEnums) { this.addedEnums = addedEnums; } - + @Override public List getDeletedEnums() { return deletedEnums; } - + @Override public void setDeletedEnums(List deletedEnums) { this.deletedEnums = deletedEnums; } - + @Override public List getAddedAssocs() { return addedAssocs; } - + @Override public void setAddedAssocs(List addedAssocs) { this.addedAssocs = addedAssocs; } - + @Override public List getDeletedAssocs() { return deletedAssocs; } - + @Override public void setDeletedAssocs(List deletedAssocs) { this.deletedAssocs = deletedAssocs; } - + @Override public List> getMatchedClasses() { return matchedClasses; } - + @Override public List> getMatchedEnums() { return matchedEnums; } - + @Override public List> getMatchedInterfaces() { return matchedInterfaces; } - + @Override public void setMatchedClasses(List> matchedClasses) { this.matchedClasses = matchedClasses; } - + @Override public List> getMatchedAssocs() { return matchedAssocs; } - + @Override public void setMatchedAssocs(List> matchedAssocs) { this.matchedAssocs = matchedAssocs; } - + @Override public void setMatchedEnums(List> matchedEnums) { this.matchedEnums = matchedEnums; } - + @Override public void setMatchedInterfaces(List> matchedInterfaces) { this.matchedInterfaces = matchedInterfaces; } - + @Override public ASTCDClass isSupClass(ASTCDClass astcdClass) { if (astcdClass.getModifier().isAbstract()) { @@ -295,7 +294,7 @@ public ASTCDClass isSupClass(ASTCDClass astcdClass) { } return null; } - + // CHECKED @Override public Set>> deletedInheritance() { @@ -319,7 +318,7 @@ public Set>> deletedInheritance() { } return diff; } - + // CHECKED @Override public boolean isInheritanceDeleted(ASTCDType superClassTgt, ASTCDType subClassSrc) { @@ -376,7 +375,7 @@ public boolean isInheritanceDeleted(ASTCDType superClassTgt, ASTCDType subClassS } return false; } - + // CHECKED @Override public Set>> addedInheritance() { @@ -398,7 +397,7 @@ && isInheritanceAdded(superClass, struc.a)) { } return diff; } - + // CHECKED @Override public Set mergeInheritanceDiffs() { @@ -429,7 +428,7 @@ public Set mergeInheritanceDiffs() { } return set; } - + // CHECKED @Override public boolean isInheritanceAdded(ASTCDType astcdClass, ASTCDType subClass) { @@ -462,7 +461,7 @@ public boolean isInheritanceAdded(ASTCDType astcdClass, ASTCDType subClass) { } boolean isContained = false; Optional matched = helper.findMatchedTypeTgt(astcdClass); - + for (AssocStruct newAssocs : helper.getSrcMap().get(astcdClass)) { for (AssocStruct srcStruct : helper.getTgtMap().get(helper.findMatchedTypeTgt(subClass) .get())) { @@ -492,7 +491,7 @@ public boolean isInheritanceAdded(ASTCDType astcdClass, ASTCDType subClass) { } return false; } - + // CHECKED @Override public List isAssocDeleted(ASTCDAssociation association, ASTCDType astcdClass) { @@ -585,7 +584,7 @@ else if (!helper.getNotInstClassesTgt().contains(left) && sub.isPresent() && !he } return list; } - + @Override public List isAssocAdded(ASTCDAssociation association) { ASTCDType isAddedSrc = null; @@ -633,7 +632,7 @@ else if (!helper.getNotInstClassesSrc().contains(otherSide) && sub2.isPresent()) } return list; } - + @Override public void findOverlappingAssocs() { Set srcToDelete = new HashSet<>(); @@ -672,7 +671,7 @@ else if (isInConflict(association, superAssoc) && !helper.inInheritanceRelation( } } } - + for (ASTCDType astcdClass : helper.getTgtMap().keySet()) { Set> toCheck = new HashSet<>(); OverlappingAssocsDirect pairs = helper.computeDirectForType(astcdClass, helper.getTgtMap(), @@ -763,7 +762,7 @@ else if (helper.sameAssocStruct(association, superAssoc) || helper.sameAssocStru helper.deleteCompositions(); helper.reduceMaps(); } - + // CHECKED @Override public List>> addedAssocList() { @@ -780,7 +779,7 @@ public List>> addedAssocList() { } return associationList; } - + // CHECKED @Override public List>> deletedAssocList() { @@ -816,7 +815,7 @@ else if (association.getCDAssocDir().isDefinitiveNavigableLeft()) { } return list; } - + // CHECKED @Override public List> addedClassList() { @@ -829,7 +828,7 @@ public List> addedClassList() { } return classList; } - + // CHECKED @Override public List changedTypes() { @@ -883,7 +882,7 @@ else if (!helper.getNotInstClassesSrc().contains(typeDiff.getSrcElem())) { } return list; } - + // CHECKED @Override public List changedAssoc() { @@ -923,7 +922,7 @@ public List changedAssoc() { changed = true; } } - + if (assocDiff.getBaseDiff().contains(DiffTypes.CHANGED_ASSOCIATION_TARGET_CLASS)) { if (!helper.inheritanceTgt(matchedPairs.a, matchedPairs.b)) { List added = isAssocAdded(matchedPairs.a.getAssociation()); @@ -989,7 +988,7 @@ else if (!deleted1.isEmpty()) { } return list; } - + // CHECKED @Override public List srcExistsTgtNot() { @@ -1002,7 +1001,7 @@ public List srcExistsTgtNot() { } return list; } - + // CHECKED @Override public List>> srcAssocExistsTgtNot() { @@ -1020,7 +1019,7 @@ public List>> srcAssocExistsTgtNot() { } return allAddedAssocs; } - + // CHECKED @Override public List>> tgtAssocsExistsSrcNot() { @@ -1049,7 +1048,7 @@ else if (assoc.getSide() == ClassSide.Right) { } return new ArrayList<>(allDeletedAssocs); } - + // CHECKED @Override public List getAssocDiffs() { @@ -1089,7 +1088,7 @@ public List getAssocDiffs() { } return result; } - + // CHECKED @Override public List hasDiffSuper() { @@ -1110,7 +1109,7 @@ public List hasDiffSuper() { } return list; } - + public void addAllAddedClassesSem(ASTCDCompilationUnit srcCD, ASTCDCompilationUnit tgtCD) { boolean found = false; for (ASTCDClass srcClass : srcCD.getCDDefinition().getCDClassesList()) { @@ -1128,7 +1127,7 @@ public void addAllAddedClassesSem(ASTCDCompilationUnit srcCD, ASTCDCompilationUn baseDiff.add(DiffTypes.ADDED_CLASS); } } - + public void addAllDeletedClassesSem(ASTCDCompilationUnit srcCD, ASTCDCompilationUnit tgtCD) { boolean found = false; for (ASTCDClass tgtClass : tgtCD.getCDDefinition().getCDClassesList()) { @@ -1146,9 +1145,9 @@ public void addAllDeletedClassesSem(ASTCDCompilationUnit srcCD, ASTCDCompilation baseDiff.add(DiffTypes.DELETED_CLASS); } } - + /*--------------------------------------------------------------------*/ - + /** * Adds matched CD types from the computed matching map to their respective type lists (classes, * enums, or interfaces). It iterates through the keys (source CD types) of the computed matching @@ -1171,7 +1170,7 @@ public void addAllMatchedTypes(Map computedMatchingMapType } } } - + /** * Adds matched associations from the computed matching map to the 'matchedAssocs' list. It * iterates through the keys (source associations) of the computed matching map and creates pairs @@ -1187,7 +1186,7 @@ public void addAllMatchedAssocs( matchedAssocs.add(new Pair<>(x, computedMatchingMapAssocs.get(x))); } } - + /** * Adds changed type differences from the matched classes and enums in the source and target CDs * to the 'changedTypes' list. It iterates through the matched classes and enums, calculates the @@ -1210,7 +1209,7 @@ public void addAllChangedTypes() { } } } - + /** * Adds changed association differences from the matched associations in the source and target CDs * to the 'changedAssocs' list. It iterates through the matched associations and calculates the @@ -1226,7 +1225,7 @@ public void addAllChangedAssocs() { } } } - + /** * Adds added class types from the source CD to the 'addedClasses' list based on matching maps * between source and target CD types. It identifies the class types in the source CD that do not @@ -1248,7 +1247,7 @@ public void addAllAddedClasses(ASTCDCompilationUnit srcCD, baseDiff.add(DiffTypes.ADDED_CLASS); } } - + /** * Adds deleted class types in the target CD to the 'deletedClasses' list based on matching maps * between source and target CD types. It identifies the class types in the target CD that do not @@ -1270,7 +1269,7 @@ public void addAllDeletedClasses(ASTCDCompilationUnit tgtCD, baseDiff.add(DiffTypes.DELETED_CLASS); } } - + public void addAllAddedInterfaces(ASTCDCompilationUnit srcCD, Map computedMatchingMapTypes) { List tmp = new ArrayList<>(srcCD.getCDDefinition().getCDInterfacesList()); @@ -1284,7 +1283,7 @@ public void addAllAddedInterfaces(ASTCDCompilationUnit srcCD, baseDiff.add(DiffTypes.ADDED_INTERFACE); } } - + public void addAllDeletedInterfaces(ASTCDCompilationUnit tgtCD, Map computedMatchingMapTypes) { List tmp = new ArrayList<>(tgtCD.getCDDefinition().getCDInterfacesList()); @@ -1298,7 +1297,7 @@ public void addAllDeletedInterfaces(ASTCDCompilationUnit tgtCD, baseDiff.add(DiffTypes.DELETED_INTERFACE); } } - + /** * Adds added enumeration types in the source CD to the 'addedEnums' list based on matching maps * between source and target CD types. It identifies the enumeration types in the source CD that @@ -1320,7 +1319,7 @@ public void addAllAddedEnums(ASTCDCompilationUnit srcCD, baseDiff.add(DiffTypes.ADDED_ENUM); } } - + /** * Adds deleted enumeration types in the target CD to the 'deletedEnums' list based on matching * maps between source and target CD types. It identifies the enumeration types in the target CD @@ -1342,7 +1341,7 @@ public void addAllDeletedEnums(ASTCDCompilationUnit tgtCD, baseDiff.add(DiffTypes.DELETED_ENUM); } } - + /** * Adds added association relationships in the source CD to the 'addedAssocs' list based on * matching maps between source and target CD associations. It identifies the associations in the @@ -1366,7 +1365,7 @@ public void addAllAddedAssocs(ASTCDCompilationUnit srcCD, baseDiff.add(DiffTypes.ADDED_ASSOCIATION); } } - + /** * Adds deleted association relationships in the target CD to the 'deletedAssocs' list based on * matching maps between source and target CD associations. It identifies the associations in the @@ -1383,12 +1382,12 @@ public void addAllDeletedAssocs(ASTCDCompilationUnit tgtCD) { } } } - + if (!deletedAssocs.isEmpty() && !baseDiff.contains(DiffTypes.DELETED_ASSOCIATION)) { baseDiff.add(DiffTypes.DELETED_ASSOCIATION); } } - + /** * Adds added inheritance relationships to the 'addedInheritance' list based on matching maps * between source and target CD classes. It identifies the added superclasses for each matched @@ -1409,7 +1408,7 @@ public void addAllAddedInheritance(ICD4CodeArtifactScope srcCDScope, allSuperClassOfTgtClass.addAll(getAllSuper(matchOfSrcClass, tgtCDScope)); } } - + for (ASTCDType srcSuper : getAllSuper(srcClass, srcCDScope)) { for (ASTCDType tgtSuper : allSuperClassOfTgtClass) { for (Pair pair : matchedClasses) { @@ -1419,7 +1418,7 @@ public void addAllAddedInheritance(ICD4CodeArtifactScope srcCDScope, } } } - + if (!allSuperClassOfSrcClass.isEmpty()) { addedInheritance.add(new Pair<>(srcClass, allSuperClassOfSrcClass)); } @@ -1428,7 +1427,7 @@ public void addAllAddedInheritance(ICD4CodeArtifactScope srcCDScope, } } } - + /** * Adds deleted inheritance relationships to the 'deletedInheritance' list based on matching maps * between source and target CD classes. It identifies the deleted superclasses for each matched @@ -1447,7 +1446,7 @@ public void addAllDeletedInheritance(ICD4CodeArtifactScope srcCDScope, allSuperClassOfSrcClass.addAll(getAllSuper(entry.getKey(), srcCDScope)); } } - + for (ASTCDType tgtSuper : getAllSuper(tgtClass, srcCDScope)) { for (ASTCDType srcSuper : allSuperClassOfSrcClass) { for (Pair pair : matchedClasses) { @@ -1457,7 +1456,7 @@ public void addAllDeletedInheritance(ICD4CodeArtifactScope srcCDScope, } } } - + if (!allSuperClassOfTgtClass.isEmpty()) { deletedInheritance.add(new Pair<>(tgtClass, allSuperClassOfTgtClass)); } @@ -1466,7 +1465,7 @@ public void addAllDeletedInheritance(ICD4CodeArtifactScope srcCDScope, } } } - + /** * Loads various lists of differences between source and target CD and scopes. This method * populates lists for matched types, associations, changed types, changed associations, added @@ -1497,5 +1496,5 @@ private void loadAllLists(ASTCDCompilationUnit srcCD, ASTCDCompilationUnit tgtCD addAllAddedInheritance(srcCDScope, tgtCDScope, matches.getTypeMatches()); addAllDeletedInheritance(srcCDScope, tgtCDScope, matches.getTypeMatches()); } - + } diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/AssertSynDiff.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/AssertSynDiff.java index e812eac77..f0b02f0c4 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/AssertSynDiff.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/AssertSynDiff.java @@ -1,3 +1,4 @@ +/* (c) https://github.com/MontiCore/monticore */ package de.monticore.cddiff.syndiff; import java.util.Collection; @@ -9,9 +10,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; public class AssertSynDiff { + CDSyntaxDiff diff; Map> remainingFunctions = new HashMap<>(); - + public AssertSynDiff(CDSyntaxDiff diff) { this.diff = diff; remainingFunctions.put("assertAddedClasses", this::assertAddedClasses); @@ -29,93 +31,109 @@ public AssertSynDiff(CDSyntaxDiff diff) { remainingFunctions.put("assertDeletedInterfaces", this::assertDeletedInterfaces); remainingFunctions.put("assertMatchedInterfaces", this::assertMatchedInterfaces); } - + public AssertSynDiff assertAddedClasses(int expected) { - assertEquals(expected, diff.getAddedClasses().size(), "Expected " + expected + " added classes, but found " + diff.getAddedClasses().size()); + assertEquals(expected, diff.getAddedClasses().size(), "Expected " + expected + + " added classes, but found " + diff.getAddedClasses().size()); remainingFunctions.remove("assertAddedClasses"); return this; } - + public AssertSynDiff assertDeletedClasses(int expected) { - assertEquals(expected, diff.getDeletedClasses().size(), "Expected " + expected + " deleted classes, but found " + diff.getDeletedClasses().size()); + assertEquals(expected, diff.getDeletedClasses().size(), "Expected " + expected + + " deleted classes, but found " + diff.getDeletedClasses().size()); remainingFunctions.remove("assertDeletedClasses"); return this; } - + public AssertSynDiff assertMatchedClasses(int expected) { - assertEquals(expected, diff.getMatchedClasses().size(), "Expected " + expected + " matched classes, but found " + diff.getMatchedClasses().size()); + assertEquals(expected, diff.getMatchedClasses().size(), "Expected " + expected + + " matched classes, but found " + diff.getMatchedClasses().size()); remainingFunctions.remove("assertMatchedClasses"); return this; } - + public AssertSynDiff assertChangedTypes(int expected) { - assertEquals(expected, diff.getChangedTypes().size(), "Expected " + expected + " changed types, but found " + diff.getChangedTypes().size()); + assertEquals(expected, diff.getChangedTypes().size(), "Expected " + expected + + " changed types, but found " + diff.getChangedTypes().size()); remainingFunctions.remove("assertChangedTypes"); return this; } - + public AssertSynDiff assertAddedEnums(int expected) { - assertEquals(expected, diff.getAddedEnums().size(), "Expected " + expected + " added enums, but found " + diff.getAddedEnums().size()); + assertEquals(expected, diff.getAddedEnums().size(), "Expected " + expected + + " added enums, but found " + diff.getAddedEnums().size()); remainingFunctions.remove("assertAddedEnums"); return this; } - + public AssertSynDiff assertDeletedEnums(int expected) { - assertEquals(expected, diff.getDeletedEnums().size(), "Expected " + expected + " deleted enums, but found " + diff.getDeletedEnums().size()); + assertEquals(expected, diff.getDeletedEnums().size(), "Expected " + expected + + " deleted enums, but found " + diff.getDeletedEnums().size()); remainingFunctions.remove("assertDeletedEnums"); return this; } - + public AssertSynDiff assertMatchedEnums(int expected) { - assertEquals(expected, diff.getMatchedEnums().size(), "Expected " + expected + " matched enums, but found " + diff.getMatchedEnums().size()); + assertEquals(expected, diff.getMatchedEnums().size(), "Expected " + expected + + " matched enums, but found " + diff.getMatchedEnums().size()); remainingFunctions.remove("assertMatchedEnums"); return this; } - + public AssertSynDiff assertChangedAssocs(int expected) { - assertEquals(expected, diff.getChangedAssocs().size(), "Expected " + expected + " changed associations, but found " + diff.getChangedAssocs().size()); + assertEquals(expected, diff.getChangedAssocs().size(), "Expected " + expected + + " changed associations, but found " + diff.getChangedAssocs().size()); remainingFunctions.remove("assertChangedAssocs"); return this; } - + public AssertSynDiff assertAddedAssocs(int expected) { - assertEquals(expected, diff.getAddedAssocs().size(), "Expected " + expected + " added associations, but found " + diff.getAddedAssocs().size()); + assertEquals(expected, diff.getAddedAssocs().size(), "Expected " + expected + + " added associations, but found " + diff.getAddedAssocs().size()); remainingFunctions.remove("assertAddedAssocs"); return this; } - + public AssertSynDiff assertDeletedAssocs(int expected) { - assertEquals(expected, diff.getDeletedAssocs().size(), "Expected " + expected + " deleted associations, but found " + diff.getDeletedAssocs().size()); + assertEquals(expected, diff.getDeletedAssocs().size(), "Expected " + expected + + " deleted associations, but found " + diff.getDeletedAssocs().size()); remainingFunctions.remove("assertDeletedAssocs"); return this; } - + public AssertSynDiff assertMatchedAssocs(int expected) { - assertEquals(expected, diff.getMatchedAssocs().size(), "Expected " + expected + " matched associations, but found " + diff.getMatchedAssocs().size()); + assertEquals(expected, diff.getMatchedAssocs().size(), "Expected " + expected + + " matched associations, but found " + diff.getMatchedAssocs().size()); remainingFunctions.remove("assertMatchedAssocs"); return this; } - + public AssertSynDiff assertAddedInterfaces(int expected) { - assertEquals(expected, diff.getAddedInterfaces().size(), "Expected " + expected + " added interfaces, but found " + diff.getAddedInterfaces().size()); + assertEquals(expected, diff.getAddedInterfaces().size(), "Expected " + expected + + " added interfaces, but found " + diff.getAddedInterfaces().size()); remainingFunctions.remove("assertAddedInterfaces"); return this; } - + public AssertSynDiff assertDeletedInterfaces(int expected) { - assertEquals(expected, diff.getDeletedInterfaces().size(), "Expected " + expected + " deleted interfaces, but found " + diff.getDeletedInterfaces().size()); + assertEquals(expected, diff.getDeletedInterfaces().size(), "Expected " + expected + + " deleted interfaces, but found " + diff.getDeletedInterfaces().size()); remainingFunctions.remove("assertDeletedInterfaces"); return this; } - + public AssertSynDiff assertMatchedInterfaces(int expected) { - assertEquals(expected, diff.getMatchedInterfaces().size(), "Expected " + expected + " matched interfaces, but found " + diff.getMatchedInterfaces().size()); + assertEquals(expected, diff.getMatchedInterfaces().size(), "Expected " + expected + + " matched interfaces, but found " + diff.getMatchedInterfaces().size()); remainingFunctions.remove("assertMatchedInterfaces"); return this; } - + public void assertRemainingEmpty() { - Collection> functionsToCall = new LinkedList<>(remainingFunctions.values()); + Collection> functionsToCall = new LinkedList<>( + remainingFunctions.values()); functionsToCall.forEach(func -> func.apply(0)); } + } diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java index f7a0b17b8..a6ce4cf7b 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java @@ -12,33 +12,27 @@ import java.util.stream.Stream; public class PerformanceTest extends SynDiffTestBasis { - + @BeforeAll public static void init() { dir = "src/test/resources/de/monticore/cddiff/syndiff/Performance/"; } - + public static Stream performanceData() { - return Stream.of( - Arguments.of("5/CD1.cd", "5/CD2.cd", 1), - Arguments.of("10/CD1.cd", "10/CD2.cd", 1), - Arguments.of("15/CD1.cd", "15/CD2.cd", 1), - Arguments.of("20/CD1.cd", "20/CD2.cd", 1), - Arguments.of("25/CD1.cd", "25/CD2.cd", 1), - Arguments.of("100/CD1.cd", "100/CD2.cd", 2), - Arguments.of("1000/CD1.cd", "1000/CD2.cd", 120) - ); + return Stream.of(Arguments.of("5/CD1.cd", "5/CD2.cd", 1), Arguments.of("10/CD1.cd", "10/CD2.cd", + 1), Arguments.of("15/CD1.cd", "15/CD2.cd", 1), Arguments.of("20/CD1.cd", "20/CD2.cd", 1), + Arguments.of("25/CD1.cd", "25/CD2.cd", 1), Arguments.of("100/CD1.cd", "100/CD2.cd", 2), + Arguments.of("1000/CD1.cd", "1000/CD2.cd", 120)); } - - + @ParameterizedTest @MethodSource("performanceData") public void testPerformance(String srcPath, String tgtPath, int timeoutSec) { parseModels(srcPath, tgtPath); - + Duration timeout = Duration.ofSeconds(timeoutSec); Assertions.assertTimeout(timeout, () -> new Syn2SemDiff(src, tgt)); - + } - + } diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java index b7b9abdc0..25583d687 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java @@ -28,163 +28,228 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class Syn2SemDiffTest extends SynDiffTestBasis { - + private static final String cddiffDir = "src/test/resources/de/monticore/cddiff/"; private static final String validationDir = "src/test/resources/validation/"; - + public static Stream emptyWitnesses() { - return Stream.of( - Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", false, false), - Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, false), - Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, false), - Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", false, false), - Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, true), - Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, true), - Arguments.of(cddiffDir, "syndiff/TypeDiff/ChangedAttribute/CD71.cd", "syndiff/TypeDiff/ChangedAttribute/CD71.cd", false, false), - Arguments.of(cddiffDir, "syndiff/TypeDiff/ChangedAttribute/CD71.cd", "syndiff/TypeDiff/ChangedAttribute/CD71.cd", false, true), - Arguments.of(cddiffDir, "syndiff/TypeDiff/RemovedAttributeNoDiff/CD21.cd", "syndiff/TypeDiff/RemovedAttributeNoDiff/CD22.cd", false, false), - Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MaCoCo_v2.cd", "syndiff/SyntaxDiff/MaCoCo_v1.cd", false, false), - Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin3.cd", false, false), - Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", false, false), - Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin1.cd", true, true), - Arguments.of(cddiffDir, "Employees/Employees2.cd", "Employees/Employees1.cd", true, true), - Arguments.of(cddiffDir, "Employees/Employees2.cd", "Employees/Employees1.cd", false, true), - Arguments.of(cddiffDir, "Employees/Employees8.cd", "Employees/Employees7.cd", true, true), - Arguments.of(validationDir, "cddiff/LibraryV3.cd", "cddiff/LibraryV2.cd", true, true), - Arguments.of(validationDir, "cddiff/LibraryV5.cd", "cddiff/LibraryV4.cd", true, true), - Arguments.of(validationDir, "cd4analysis/ManagementV2.cd", "cd4analysis/ManagementV1.cd", true, true), - Arguments.of(validationDir, "cd4analysis/MyCompanyV2.cd", "cd4analysis/MyCompanyV1.cd", true, true), - Arguments.of(validationDir, "cd4analysis/MyExampleV2.cd", "cd4analysis/MyExampleV1.cd", true, true), - Arguments.of(validationDir, "cd4analysis/MyExampleV1.cd", "cd4analysis/MyExampleV2.cd", true, true), - Arguments.of(validationDir, "cd4analysis/ManagementV2.cd", "cd4analysis/ManagementV1.cd", true, false), - Arguments.of(validationDir, "cd4analysis/MyExampleV2.cd", "cd4analysis/MyExampleV1.cd", true, false), - Arguments.of(validationDir, "cd4analysis/MyExampleV1.cd", "cd4analysis/MyExampleV2.cd", true, false) - ); + return Stream.of(Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", + "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", false, false), Arguments.of(cddiffDir, + "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", + "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, false), Arguments.of(cddiffDir, + "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", + "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, false), Arguments.of(cddiffDir, + "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", + "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", false, false), Arguments.of( + cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", + "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, true), Arguments.of( + cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", + "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, true), Arguments.of( + cddiffDir, "syndiff/TypeDiff/ChangedAttribute/CD71.cd", + "syndiff/TypeDiff/ChangedAttribute/CD71.cd", false, false), + Arguments.of(cddiffDir, "syndiff/TypeDiff/ChangedAttribute/CD71.cd", + "syndiff/TypeDiff/ChangedAttribute/CD71.cd", false, true), Arguments.of(cddiffDir, + "syndiff/TypeDiff/RemovedAttributeNoDiff/CD21.cd", + "syndiff/TypeDiff/RemovedAttributeNoDiff/CD22.cd", false, false), Arguments.of( + cddiffDir, "syndiff/SyntaxDiff/MaCoCo_v2.cd", "syndiff/SyntaxDiff/MaCoCo_v1.cd", + false, false), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", + "DigitalTwins/DigitalTwin3.cd", false, false), Arguments.of(cddiffDir, + "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", false, + false), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", + "DigitalTwins/DigitalTwin1.cd", true, true), Arguments.of(cddiffDir, + "Employees/Employees2.cd", "Employees/Employees1.cd", true, + true), Arguments.of(cddiffDir, "Employees/Employees2.cd", + "Employees/Employees1.cd", false, true), Arguments.of( + cddiffDir, "Employees/Employees8.cd", + "Employees/Employees7.cd", true, true), Arguments.of( + validationDir, "cddiff/LibraryV3.cd", + "cddiff/LibraryV2.cd", true, true), Arguments.of( + validationDir, "cddiff/LibraryV5.cd", + "cddiff/LibraryV4.cd", true, true), Arguments + .of(validationDir, + "cd4analysis/ManagementV2.cd", + "cd4analysis/ManagementV1.cd", true, + true), Arguments.of(validationDir, + "cd4analysis/MyCompanyV2.cd", + "cd4analysis/MyCompanyV1.cd", true, + true), Arguments.of(validationDir, + "cd4analysis/MyExampleV2.cd", + "cd4analysis/MyExampleV1.cd", + true, true), Arguments.of( + validationDir, + "cd4analysis/MyExampleV1.cd", + "cd4analysis/MyExampleV2.cd", + true, true), Arguments.of( + validationDir, + "cd4analysis/ManagementV2.cd", + "cd4analysis/ManagementV1.cd", + true, false), Arguments + .of(validationDir, + "cd4analysis/MyExampleV2.cd", + "cd4analysis/MyExampleV1.cd", + true, false), + Arguments.of(validationDir, "cd4analysis/MyExampleV1.cd", "cd4analysis/MyExampleV2.cd", + true, false)); } - + @ParameterizedTest @MethodSource("emptyWitnesses") - public void testEmptyWitnesses(String baseDir, String srcPath, String tgtPath, boolean staDiff, boolean reduction) { + public void testEmptyWitnesses(String baseDir, String srcPath, String tgtPath, boolean staDiff, + boolean reduction) { dir = baseDir; parseModels(srcPath, tgtPath); - + if (reduction) { ReductionTrafo trafo = new ReductionTrafo(); trafo.transform(src, tgt); } - + Syn2SemDiff syn2semdiff = new Syn2SemDiff(src, tgt); List witnesses = syn2semdiff.generateODs(staDiff); - + assertTrue(witnesses.isEmpty()); } - + public static Stream witnesses() { return Stream.of( - //Arguments.of("syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", SIMPLE_CLOSED_WORLD, true), - //Arguments.of(validationDir, "cddiff/LibraryV5.cd", "cddiff/LibraryV4.cd", STA_CLOSED_WORLD, false), - //Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd", SIMPLE_CLOSED_WORLD, true), - Arguments.of(cddiffDir, "syndiff/SyntaxDiff/AddedDeletedAssocs/CD31.cd", "syndiff/SyntaxDiff/AddedDeletedAssocs/CD32.cd", SIMPLE_CLOSED_WORLD, false), - Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", SIMPLE_CLOSED_WORLD, true), - Arguments.of(cddiffDir, "syndiff/TypeDiff/DeletedAttribute/CD11.cd", "syndiff/TypeDiff/DeletedAttribute/CD12.cd", SIMPLE_CLOSED_WORLD, false), - Arguments.of(cddiffDir, "syndiff/TypeDiff/DeletedAttribute/CD11.cd", "syndiff/TypeDiff/DeletedAttribute/CD12.cd", SIMPLE_CLOSED_WORLD, true), - Arguments.of(cddiffDir, "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD31.cd", "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD32.cd", SIMPLE_CLOSED_WORLD, false), - Arguments.of(cddiffDir, "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD31.cd", "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD32.cd", SIMPLE_CLOSED_WORLD, true), - Arguments.of(cddiffDir, "syndiff/TypeDiff/RemovedAttributeNoDiff/CD21.cd", "syndiff/TypeDiff/RemovedAttributeNoDiff/CD22.cd", SIMPLE_CLOSED_WORLD, true), - Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MaCoCo_v1.cd", "syndiff/SyntaxDiff/MaCoCo_v2.cd", SIMPLE_CLOSED_WORLD, false), - Arguments.of(cddiffDir, "syndiff/SyntaxDiff/SS1.cd", "syndiff/SyntaxDiff/SS2.cd", SIMPLE_CLOSED_WORLD, false), - Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin1.cd", SIMPLE_CLOSED_WORLD, false), - Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin1.cd", "DigitalTwins/DigitalTwin2.cd", SIMPLE_CLOSED_WORLD, true), - Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin3.cd", SIMPLE_CLOSED_WORLD, true), - Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", SIMPLE_CLOSED_WORLD, true), - Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin1.cd", SIMPLE_OPEN_WORLD, false), - Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin1.cd", "DigitalTwins/DigitalTwin2.cd", SIMPLE_OPEN_WORLD, true), - Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin3.cd", SIMPLE_OPEN_WORLD, true), - Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", SIMPLE_OPEN_WORLD, true), - Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd", SIMPLE_CLOSED_WORLD, false), - Arguments.of(cddiffDir, "Employees/Employees2.cd", "Employees/Employees1.cd", SIMPLE_CLOSED_WORLD, false), - Arguments.of(cddiffDir, "Employees/Employees7.cd", "Employees/Employees8.cd", STA_CLOSED_WORLD, true), - Arguments.of(cddiffDir, "Employees/Employees7.cd", "Employees/Employees8.cd", STA_CLOSED_WORLD, false), - Arguments.of(cddiffDir, "Employees/Employees8.cd", "Employees/Employees7.cd", STA_CLOSED_WORLD, false), - Arguments.of(validationDir, "cddiff/LibraryV2.cd", "cddiff/LibraryV3.cd", STA_CLOSED_WORLD, true), - Arguments.of(validationDir, "cddiff/LibraryV4.cd", "cddiff/LibraryV5.cd", STA_CLOSED_WORLD, true), - Arguments.of(validationDir, "cddiff/LibraryV3.cd", "cddiff/LibraryV2.cd", STA_CLOSED_WORLD, false), - Arguments.of(validationDir, "cddiff/LibraryV2.cd", "cddiff/LibraryV3.cd", STA_CLOSED_WORLD, false), - Arguments.of(validationDir, "cddiff/LibraryV4.cd", "cddiff/LibraryV5.cd", STA_CLOSED_WORLD, false), - Arguments.of(validationDir, "cd4analysis/ManagementV1.cd", "cd4analysis/ManagementV2.cd", STA_CLOSED_WORLD, true), - Arguments.of(validationDir, "cd4analysis/MyCompanyV1.cd", "cd4analysis/MyCompanyV2.cd", STA_CLOSED_WORLD, true), - Arguments.of(validationDir, "cd4analysis/MyCompanyV2.cd", "cd4analysis/MyCompanyV1.cd", STA_CLOSED_WORLD, false) - ); + //Arguments.of("syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", SIMPLE_CLOSED_WORLD, true), + //Arguments.of(validationDir, "cddiff/LibraryV5.cd", "cddiff/LibraryV4.cd", STA_CLOSED_WORLD, false), + //Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd", SIMPLE_CLOSED_WORLD, true), + Arguments.of(cddiffDir, "syndiff/SyntaxDiff/AddedDeletedAssocs/CD31.cd", + "syndiff/SyntaxDiff/AddedDeletedAssocs/CD32.cd", SIMPLE_CLOSED_WORLD, false), Arguments + .of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", + "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", SIMPLE_CLOSED_WORLD, true), + Arguments.of(cddiffDir, "syndiff/TypeDiff/DeletedAttribute/CD11.cd", + "syndiff/TypeDiff/DeletedAttribute/CD12.cd", SIMPLE_CLOSED_WORLD, false), Arguments.of( + cddiffDir, "syndiff/TypeDiff/DeletedAttribute/CD11.cd", + "syndiff/TypeDiff/DeletedAttribute/CD12.cd", SIMPLE_CLOSED_WORLD, true), Arguments + .of(cddiffDir, "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD31.cd", + "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD32.cd", SIMPLE_CLOSED_WORLD, + false), Arguments.of(cddiffDir, + "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD31.cd", + "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD32.cd", + SIMPLE_CLOSED_WORLD, true), Arguments.of(cddiffDir, + "syndiff/TypeDiff/RemovedAttributeNoDiff/CD21.cd", + "syndiff/TypeDiff/RemovedAttributeNoDiff/CD22.cd", + SIMPLE_CLOSED_WORLD, true), Arguments.of(cddiffDir, + "syndiff/SyntaxDiff/MaCoCo_v1.cd", + "syndiff/SyntaxDiff/MaCoCo_v2.cd", SIMPLE_CLOSED_WORLD, false), + Arguments.of(cddiffDir, "syndiff/SyntaxDiff/SS1.cd", "syndiff/SyntaxDiff/SS2.cd", + SIMPLE_CLOSED_WORLD, false), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", + "DigitalTwins/DigitalTwin1.cd", SIMPLE_CLOSED_WORLD, false), Arguments.of(cddiffDir, + "DigitalTwins/DigitalTwin1.cd", "DigitalTwins/DigitalTwin2.cd", + SIMPLE_CLOSED_WORLD, true), Arguments.of(cddiffDir, + "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin3.cd", + SIMPLE_CLOSED_WORLD, true), Arguments.of(cddiffDir, + "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", + SIMPLE_CLOSED_WORLD, true), Arguments.of(cddiffDir, + "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin1.cd", + SIMPLE_OPEN_WORLD, false), Arguments.of(cddiffDir, + "DigitalTwins/DigitalTwin1.cd", "DigitalTwins/DigitalTwin2.cd", + SIMPLE_OPEN_WORLD, true), Arguments.of(cddiffDir, + "DigitalTwins/DigitalTwin2.cd", + "DigitalTwins/DigitalTwin3.cd", SIMPLE_OPEN_WORLD, true), + Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", + SIMPLE_OPEN_WORLD, true), Arguments.of(cddiffDir, "Employees/Employees1.cd", + "Employees/Employees2.cd", SIMPLE_CLOSED_WORLD, false), Arguments.of(cddiffDir, + "Employees/Employees2.cd", "Employees/Employees1.cd", SIMPLE_CLOSED_WORLD, + false), Arguments.of(cddiffDir, "Employees/Employees7.cd", + "Employees/Employees8.cd", STA_CLOSED_WORLD, true), Arguments.of(cddiffDir, + "Employees/Employees7.cd", "Employees/Employees8.cd", STA_CLOSED_WORLD, + false), Arguments.of(cddiffDir, "Employees/Employees8.cd", + "Employees/Employees7.cd", STA_CLOSED_WORLD, false), Arguments.of( + validationDir, "cddiff/LibraryV2.cd", "cddiff/LibraryV3.cd", + STA_CLOSED_WORLD, true), Arguments.of(validationDir, + "cddiff/LibraryV4.cd", "cddiff/LibraryV5.cd", + STA_CLOSED_WORLD, true), Arguments.of(validationDir, + "cddiff/LibraryV3.cd", "cddiff/LibraryV2.cd", + STA_CLOSED_WORLD, false), Arguments.of(validationDir, + "cddiff/LibraryV2.cd", "cddiff/LibraryV3.cd", + STA_CLOSED_WORLD, false), Arguments.of( + validationDir, "cddiff/LibraryV4.cd", + "cddiff/LibraryV5.cd", STA_CLOSED_WORLD, false), + Arguments.of(validationDir, "cd4analysis/ManagementV1.cd", "cd4analysis/ManagementV2.cd", + STA_CLOSED_WORLD, true), Arguments.of(validationDir, "cd4analysis/MyCompanyV1.cd", + "cd4analysis/MyCompanyV2.cd", STA_CLOSED_WORLD, true), Arguments.of(validationDir, + "cd4analysis/MyCompanyV2.cd", "cd4analysis/MyCompanyV1.cd", STA_CLOSED_WORLD, + false)); } - + @ParameterizedTest @MethodSource("witnesses") - public void testWitnesses(String baseDir, String srcPath, String tgtPath, CDSemantics semantics, boolean reduction) { + public void testWitnesses(String baseDir, String srcPath, String tgtPath, CDSemantics semantics, + boolean reduction) { dir = baseDir; parseModels(srcPath, tgtPath); - + if (reduction) { ReductionTrafo trafo = new ReductionTrafo(); trafo.transform(src, tgt); } - + Syn2SemDiff syn2semdiff = new Syn2SemDiff(src, tgt); - List witnesses = syn2semdiff.generateODs(semantics.equals(STA_CLOSED_WORLD) || semantics.equals(STA_OPEN_WORLD)); - + List witnesses = syn2semdiff.generateODs(semantics.equals(STA_CLOSED_WORLD) + || semantics.equals(STA_OPEN_WORLD)); + assertFalse(witnesses.isEmpty()); - + checkDiffWitnesses(semantics, src, tgt, witnesses); } - + public static Stream witnessesReduction() { return Stream.of( -// Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd"), - Arguments.of(validationDir, "Performance/5A.cd", "Performance/5B.cd"), - Arguments.of(validationDir, "Performance/10A.cd", "Performance/10B.cd"), - Arguments.of(validationDir, "Performance/15A.cd", "Performance/15B.cd"), - Arguments.of(validationDir, "Performance/20A.cd", "Performance/20B.cd"), - Arguments.of(validationDir, "Performance/25A.cd", "Performance/25B.cd"), - Arguments.of(validationDir, "cddiff/DEv2.cd", "cddiff/DEv1.cd"), - Arguments.of(validationDir, "cddiff/EAv2.cd", "cddiff/EAv1.cd"), - Arguments.of(validationDir, "cddiff/EMTv1.cd", "cddiff/EMTv2.cd"), - Arguments.of(validationDir, "cddiff/LibraryV2.cd", "cddiff/LibraryV1.cd"), - Arguments.of(validationDir, "cddiff/LibraryV4.cd", "cddiff/LibraryV3.cd"), - Arguments.of(validationDir, "cd4analysis/MyLifeV2.cd", "cd4analysis/MyLifeV1.cd"), - Arguments.of(validationDir, "cd4analysis/TeachingV2.cd", "cd4analysis/TeachingV1.cd"), - Arguments.of(cddiffDir, "Employees/Employees7.cd", "Employees/Employees8.cd"), - Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd"), - Arguments.of(cddiffDir, "Employees/Employees7.cd", "Employees/Employees8.cd"), - Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd") - ); + // Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd"), + Arguments.of(validationDir, "Performance/5A.cd", "Performance/5B.cd"), Arguments.of( + validationDir, "Performance/10A.cd", "Performance/10B.cd"), Arguments.of(validationDir, + "Performance/15A.cd", "Performance/15B.cd"), Arguments.of(validationDir, + "Performance/20A.cd", "Performance/20B.cd"), Arguments.of(validationDir, + "Performance/25A.cd", "Performance/25B.cd"), Arguments.of(validationDir, + "cddiff/DEv2.cd", "cddiff/DEv1.cd"), Arguments.of(validationDir, + "cddiff/EAv2.cd", "cddiff/EAv1.cd"), Arguments.of(validationDir, + "cddiff/EMTv1.cd", "cddiff/EMTv2.cd"), Arguments.of( + validationDir, "cddiff/LibraryV2.cd", + "cddiff/LibraryV1.cd"), Arguments.of(validationDir, + "cddiff/LibraryV4.cd", "cddiff/LibraryV3.cd"), Arguments + .of(validationDir, "cd4analysis/MyLifeV2.cd", + "cd4analysis/MyLifeV1.cd"), Arguments.of( + validationDir, "cd4analysis/TeachingV2.cd", + "cd4analysis/TeachingV1.cd"), Arguments.of( + cddiffDir, "Employees/Employees7.cd", + "Employees/Employees8.cd"), Arguments + .of(cddiffDir, + "Employees/Employees1.cd", + "Employees/Employees2.cd"), + Arguments.of(cddiffDir, "Employees/Employees7.cd", "Employees/Employees8.cd"), Arguments.of( + cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd")); } - + @ParameterizedTest @MethodSource("witnessesReduction") public void testWitnessesReduction(String baseDir, String srcPath, String tgtPath) { dir = baseDir; parseModels(srcPath, tgtPath); - + ASTCDCompilationUnit srcOriginal = src.deepClone(); ASTCDCompilationUnit tgtOriginal = tgt.deepClone(); - + // reduction-based ReductionTrafo trafo = new ReductionTrafo(); trafo.transform(src, tgt); - + Syn2SemDiff syn2semdiff = new Syn2SemDiff(src, tgt); List witnesses = syn2semdiff.generateODs(true); - + Assertions.assertFalse(witnesses.isEmpty()); - + checkDiffWitnesses(CDSemantics.STA_CLOSED_WORLD, src, tgt, witnesses); - + CD4CodeMill.scopesGenitorDelegator().createFromAST(srcOriginal); CD4CodeMill.scopesGenitorDelegator().createFromAST(tgtOriginal); checkDiffWitnesses(CDSemantics.STA_OPEN_WORLD, srcOriginal, tgtOriginal, witnesses); } - + protected void checkDiffWitnesses(CDSemantics semantics, ASTCDCompilationUnit cd1, - ASTCDCompilationUnit cd2, Collection witnesses) { + ASTCDCompilationUnit cd2, Collection witnesses) { for (ASTODArtifact od : witnesses) { if (!new OD2CDMatcher().checkIfDiffWitness(semantics, cd1, cd2, od)) { Log.println(new OD4ReportFullPrettyPrinter(new IndentPrinter()).prettyprint(od)); @@ -192,4 +257,5 @@ protected void checkDiffWitnesses(CDSemantics semantics, ASTCDCompilationUnit cd } } } + } diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/SynAssocDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SynAssocDiffTest.java index caf450abe..167d77215 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/SynAssocDiffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SynAssocDiffTest.java @@ -11,27 +11,22 @@ import static org.junit.jupiter.api.Assertions.assertEquals; public class SynAssocDiffTest extends SynDiffTestBasis { - + @BeforeAll public static void init() { dir = "src/test/resources/de/monticore/cddiff/syndiff/AssocDiff/"; } - + @Test public void testAssoc1() { parseModels("Source1.cd", "Target1.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - - new AssertSynDiff(synDiff) - .assertAddedClasses(1) - .assertMatchedClasses(3) - .assertAddedAssocs(1) - .assertDeletedAssocs(1) - .assertChangedAssocs(1) - .assertMatchedAssocs(1) - .assertRemainingEmpty(); - + + new AssertSynDiff(synDiff).assertAddedClasses(1).assertMatchedClasses(3).assertAddedAssocs(1) + .assertDeletedAssocs(1).assertChangedAssocs(1).assertMatchedAssocs(1) + .assertRemainingEmpty(); + // Check that no other diffs exist Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_CARDINALITY, 1L); @@ -39,86 +34,73 @@ public void testAssoc1() { expectedDiffTypes.put(DiffTypes.ADDED_ASSOCIATION, 1L); expectedDiffTypes.put(DiffTypes.ADDED_INHERITANCE, 1L); expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testAssoc2() { parseModels("Source2.cd", "Target2.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - - new AssertSynDiff(synDiff) - .assertMatchedClasses(3) - .assertChangedAssocs(1) - .assertMatchedAssocs(1) - .assertRemainingEmpty(); - + + new AssertSynDiff(synDiff).assertMatchedClasses(3).assertChangedAssocs(1).assertMatchedAssocs(1) + .assertRemainingEmpty(); + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_CARDINALITY, 1L); expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_SOURCE_CLASS, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testAssoc3() { parseModels("Source3.cd", "Target3.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - - new AssertSynDiff(synDiff) - .assertMatchedClasses(4) - .assertChangedTypes(2) - .assertChangedAssocs(3) - .assertMatchedAssocs(3) - .assertRemainingEmpty(); - + + new AssertSynDiff(synDiff).assertMatchedClasses(4).assertChangedTypes(2).assertChangedAssocs(3) + .assertMatchedAssocs(3).assertRemainingEmpty(); + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_CARDINALITY, 3L); expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_DIRECTION, 1L); expectedDiffTypes.put(DiffTypes.CHANGED_TYPE_EXTENDS, 1L); expectedDiffTypes.put(DiffTypes.DELETED_INHERITANCE, 1L); expectedDiffTypes.put(DiffTypes.CHANGED_CLASS_MODIFIER, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testAssoc4() { parseModels("Source4.cd", "Target4.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - - new AssertSynDiff(synDiff) - .assertMatchedClasses(4) - .assertAddedAssocs(4) - .assertDeletedAssocs(4) - .assertRemainingEmpty(); - + + new AssertSynDiff(synDiff).assertMatchedClasses(4).assertAddedAssocs(4).assertDeletedAssocs(4) + .assertRemainingEmpty(); + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.ADDED_ASSOCIATION, 1L); expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testAssoc5() { parseModels("Source5.cd", "Target5.cd"); CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - - new AssertSynDiff(synDiff) - .assertMatchedClasses(2) - .assertChangedAssocs(1) - .assertMatchedAssocs(1) - .assertRemainingEmpty(); - + + new AssertSynDiff(synDiff).assertMatchedClasses(2).assertChangedAssocs(1).assertMatchedAssocs(1) + .assertRemainingEmpty(); + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_CARDINALITY, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + } diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/SynDiffTestBasis.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SynDiffTestBasis.java index 3ef952c88..571104305 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/SynDiffTestBasis.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SynDiffTestBasis.java @@ -1,3 +1,4 @@ +/* (c) https://github.com/MontiCore/monticore */ package de.monticore.cddiff.syndiff; import de.monticore.cd._symboltable.BuiltInTypes; @@ -18,7 +19,7 @@ import static org.junit.jupiter.api.Assertions.fail; public abstract class SynDiffTestBasis { - + @BeforeEach public void setup() { LogStub.init(); @@ -29,15 +30,15 @@ public void setup() { CD4CodeMill.globalScope().init(); BuiltInTypes.addBuiltInTypes(CD4CodeMill.globalScope()); } - + public static String dir; protected ASTCDCompilationUnit tgt; protected ASTCDCompilationUnit src; - + public void parseModels(String concrete, String ref) { try { Optional src = CD4CodeMill.parser().parseCDCompilationUnit(dir - + concrete); + + concrete); Optional tgt = CD4CodeMill.parser().parseCDCompilationUnit(dir + ref); if (src.isPresent() && tgt.isPresent()) { (new CD4AnalysisAfterParseTrafo()).transform(src.get()); @@ -50,22 +51,19 @@ public void parseModels(String concrete, String ref) { this.src = src.get(); } else { - fail(String.format("Parsing src: '%s', tgt: '%s'.", src.isPresent() ? "success" : "failure", tgt.isPresent() ? "success" : "failure")); + fail(String.format("Parsing src: '%s', tgt: '%s'.", src.isPresent() ? "success" : "failure", + tgt.isPresent() ? "success" : "failure")); } - + } catch (IOException e) { fail(e.getMessage()); } } - + public Map getDiffTypesCount(CDSyntaxDiff synDiff) { - return synDiff.getBaseDiff().stream().collect( - Collectors.groupingBy( - Function.identity(), - Collectors.counting() - ) - ); + return synDiff.getBaseDiff().stream().collect(Collectors.groupingBy(Function.identity(), + Collectors.counting())); } - + } diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java index a34cc4e05..2bdd745c8 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java @@ -30,45 +30,40 @@ import static org.junit.jupiter.api.Assertions.fail; public class SyntaxDiffTest extends SynDiffTestBasis { - + @BeforeAll public static void init() { dir = "src/test/resources/de/monticore/cddiff/"; } - + @Test public void testMember1() { parseModels("syndiff/MemberDiff/Source1.cd", "syndiff/MemberDiff/Target1.cd"); - + ASTCDClass cNew = CDTestHelper.getClass("A", src.getCDDefinition()); ASTCDClass cOld = CDTestHelper.getClass("A", tgt.getCDDefinition()); - + Assertions.assertNotNull(cNew); Assertions.assertNotNull(cOld); - + ASTNode attributeNew = CDTestHelper.getAttribute(cNew, "a"); ASTNode attributeOld = CDTestHelper.getAttribute(cOld, "a"); - + CDMemberDiff attrDiff = new CDMemberDiff(attributeNew, attributeOld); - - assertEquals(new HashSet<>(attrDiff.getBaseDiff()), Set.of(DiffTypes.CHANGED_ATTRIBUTE_TYPE, DiffTypes.CHANGED_ATTRIBUTE_MODIFIER)); + + assertEquals(new HashSet<>(attrDiff.getBaseDiff()), Set.of(DiffTypes.CHANGED_ATTRIBUTE_TYPE, + DiffTypes.CHANGED_ATTRIBUTE_MODIFIER)); } - + @Test public void testDTs() { parseModels("DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin1.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - - new AssertSynDiff(synDiff) - .assertAddedClasses(4) - .assertMatchedClasses(4) - .assertAddedAssocs(2) - .assertChangedAssocs(3) - .assertMatchedAssocs(3) - .assertChangedTypes(2) - .assertRemainingEmpty(); - + + new AssertSynDiff(synDiff).assertAddedClasses(4).assertMatchedClasses(4).assertAddedAssocs(2) + .assertChangedAssocs(3).assertMatchedAssocs(3).assertChangedTypes(2).assertRemainingEmpty(); + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.ADDED_CLASS, 1L); expectedDiffTypes.put(DiffTypes.ADDED_ASSOCIATION, 1L); @@ -77,30 +72,21 @@ public void testDTs() { expectedDiffTypes.put(DiffTypes.ADDED_INHERITANCE, 1L); expectedDiffTypes.put(DiffTypes.CHANGED_TYPE_EXTENDS, 1L); expectedDiffTypes.put(DiffTypes.CHANGED_CLASS_MODIFIER, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testSyntaxDiff1() { parseModels("syndiff/SyntaxDiff/Source1.cd", "syndiff/SyntaxDiff/Target1.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - - new AssertSynDiff(synDiff) - .assertAddedClasses(1) - .assertDeletedClasses(1) - .assertMatchedClasses(3) - .assertChangedTypes(5) - .assertAddedAssocs(2) - .assertDeletedAssocs(2) - .assertChangedAssocs(2) - .assertMatchedAssocs(2) - .assertAddedEnums(1) - .assertDeletedEnums(1) - .assertMatchedEnums(1) - .assertRemainingEmpty(); - + + new AssertSynDiff(synDiff).assertAddedClasses(1).assertDeletedClasses(1).assertMatchedClasses(3) + .assertChangedTypes(5).assertAddedAssocs(2).assertDeletedAssocs(2).assertChangedAssocs(2) + .assertMatchedAssocs(2).assertAddedEnums(1).assertDeletedEnums(1).assertMatchedEnums(1) + .assertRemainingEmpty(); + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); expectedDiffTypes.put(DiffTypes.DELETED_ENUM, 1L); @@ -120,28 +106,20 @@ public void testSyntaxDiff1() { expectedDiffTypes.put(DiffTypes.CHANGED_CLASS_NAME, 1L); expectedDiffTypes.put(DiffTypes.CHANGED_CLASS_MODIFIER, 1L); expectedDiffTypes.put(DiffTypes.INHERITED_ATTRIBUTE, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testSyntaxDiff2() { parseModels("syndiff/SyntaxDiff/Source2.cd", "syndiff/SyntaxDiff/Target2.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - - new AssertSynDiff(synDiff) - .assertAddedClasses(2) - .assertDeletedClasses(2) - .assertMatchedClasses(2) - .assertAddedAssocs(1) - .assertDeletedAssocs(1) - .assertMatchedAssocs(1) - .assertAddedEnums(1) - .assertDeletedEnums(1) - .assertMatchedEnums(1) - .assertRemainingEmpty(); - + + new AssertSynDiff(synDiff).assertAddedClasses(2).assertDeletedClasses(2).assertMatchedClasses(2) + .assertAddedAssocs(1).assertDeletedAssocs(1).assertMatchedAssocs(1).assertAddedEnums(1) + .assertDeletedEnums(1).assertMatchedEnums(1).assertRemainingEmpty(); + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.ADDED_CLASS, 1L); expectedDiffTypes.put(DiffTypes.ADDED_ASSOCIATION, 1L); @@ -151,28 +129,20 @@ public void testSyntaxDiff2() { expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); expectedDiffTypes.put(DiffTypes.DELETED_INHERITANCE, 1L); expectedDiffTypes.put(DiffTypes.DELETED_ENUM, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testSyntaxDiff3() { parseModels("syndiff/SyntaxDiff/TechStoreV2.cd", "syndiff/SyntaxDiff/TechStoreV1.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - - new AssertSynDiff(synDiff) - .assertDeletedClasses(2) - .assertMatchedClasses(11) - .assertChangedTypes(3) - .assertAddedAssocs(4) - .assertDeletedAssocs(2) - .assertChangedAssocs(5) - .assertMatchedAssocs(6) - .assertMatchedEnums(1) - .assertRemainingEmpty(); - - + + new AssertSynDiff(synDiff).assertDeletedClasses(2).assertMatchedClasses(11).assertChangedTypes( + 3).assertAddedAssocs(4).assertDeletedAssocs(2).assertChangedAssocs(5).assertMatchedAssocs(6) + .assertMatchedEnums(1).assertRemainingEmpty(); + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); expectedDiffTypes.put(DiffTypes.DELETED_INHERITANCE, 1L); @@ -188,133 +158,122 @@ public void testSyntaxDiff3() { expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_CLASS, 2L); expectedDiffTypes.put(DiffTypes.CHANGED_ATTRIBUTE_TYPE, 1L); expectedDiffTypes.put(DiffTypes.CHANGED_CLASS_NAME, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testSyntaxDiff4() { parseModels("syndiff/SyntaxDiff/TechStoreV9.cd", "syndiff/SyntaxDiff/TechStoreV10.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - - new AssertSynDiff(synDiff) - .assertMatchedClasses(2) - .assertDeletedAssocs(1) - .assertRemainingEmpty(); - + + new AssertSynDiff(synDiff).assertMatchedClasses(2).assertDeletedAssocs(1) + .assertRemainingEmpty(); + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testSyntaxDiff5() { parseModels("syndiff/SyntaxDiff/TechStoreV11.cd", "syndiff/SyntaxDiff/TechStoreV12.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - - new AssertSynDiff(synDiff) - .assertChangedTypes(3) - .assertMatchedClasses(3) - .assertRemainingEmpty(); - + + new AssertSynDiff(synDiff).assertChangedTypes(3).assertMatchedClasses(3).assertRemainingEmpty(); + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.ADDED_ATTRIBUTE, 1L); expectedDiffTypes.put(DiffTypes.INHERITED_ATTRIBUTE, 2L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testMaCoCo() { CDDiffUtil.setUseJavaTypes(true); parseMaCoCo("syndiff/SyntaxDiff/MaCoCo_v1.cd", "syndiff/SyntaxDiff/MaCoCo_v2.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - - new AssertSynDiff(synDiff) - .assertAddedClasses(1) - .assertAddedEnums(1) - .assertAddedAssocs(1) - .assertMatchedAssocs(91) - .assertMatchedClasses(94) - .assertMatchedEnums(45) - .assertRemainingEmpty(); - + + new AssertSynDiff(synDiff).assertAddedClasses(1).assertAddedEnums(1).assertAddedAssocs(1) + .assertMatchedAssocs(91).assertMatchedClasses(94).assertMatchedEnums(45) + .assertRemainingEmpty(); + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.ADDED_CLASS, 1L); expectedDiffTypes.put(DiffTypes.ADDED_ENUM, 1L); expectedDiffTypes.put(DiffTypes.ADDED_ASSOCIATION, 1L); expectedDiffTypes.put(DiffTypes.ADDED_INHERITANCE, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); - + // Conformance Checking without stereotype mapping constitutes a refinement check boolean conform = new CDConformanceChecker(Set.of(CDConfParameter.STEREOTYPE_MAPPING, CDConfParameter.NAME_MAPPING, CDConfParameter.SRC_TARGET_ASSOC_MAPPING, CDConfParameter.ALLOW_CARD_RESTRICTION)).checkConformance(src, tgt, "incarnates"); - + assertTrue(conform); - + // Syn2SemDiff produces correct diff-witnesses Syn2SemDiff semDiff = new Syn2SemDiff(src, tgt); OD2CDMatcher matcher = new OD2CDMatcher(); List ods = semDiff.generateODs(false); - + assertFalse(ods.isEmpty()); assertTrue(semDiff.generateODs(false).stream().allMatch(od -> matcher.checkIfDiffWitness( CDSemantics.SIMPLE_CLOSED_WORLD, src, tgt, od))); - + synDiff = new CDSyntaxDiff(tgt, src, List.of()); - new AssertSynDiff(synDiff) - .assertDeletedClasses(1) - .assertDeletedEnums(1) - .assertDeletedAssocs(1) - .assertMatchedAssocs(91) - .assertMatchedClasses(94) - .assertMatchedEnums(45) - .assertRemainingEmpty(); - + new AssertSynDiff(synDiff).assertDeletedClasses(1).assertDeletedEnums(1).assertDeletedAssocs(1) + .assertMatchedAssocs(91).assertMatchedClasses(94).assertMatchedEnums(45) + .assertRemainingEmpty(); + expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.DELETED_CLASS, 1L); expectedDiffTypes.put(DiffTypes.DELETED_ENUM, 1L); expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); expectedDiffTypes.put(DiffTypes.DELETED_INHERITANCE, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); - + // Conformance Checking without stereotype mapping constitutes a refinement check conform = new CDConformanceChecker(Set.of(CDConfParameter.STEREOTYPE_MAPPING, CDConfParameter.NAME_MAPPING, CDConfParameter.SRC_TARGET_ASSOC_MAPPING, CDConfParameter.ALLOW_CARD_RESTRICTION)).checkConformance(tgt, src, "incarnates"); - + assertFalse(conform); - + // Syn2SemDiff produces correct diff-witnesses semDiff = new Syn2SemDiff(tgt, src); ods = semDiff.generateODs(false); - + assertTrue(ods.isEmpty()); } - + public void parseMaCoCo(String concrete, String ref) { try { Optional src = CD4CodeMill.parser().parseCDCompilationUnit(dir - + concrete); + + concrete); Optional tgt = CD4CodeMill.parser().parseCDCompilationUnit(dir + ref); if (src.isPresent() && tgt.isPresent()) { CDDiffUtil.refreshSymbolTable(src.get()); CDDiffUtil.refreshSymbolTable(tgt.get()); this.tgt = tgt.get(); this.src = src.get(); - } else { - fail(String.format("Parsing src: '%s', tgt: '%s'.", src.isPresent() ? "success" : "failure", tgt.isPresent() ? "success" : "failure")); } - - } catch (IOException e) { + else { + fail(String.format("Parsing src: '%s', tgt: '%s'.", src.isPresent() ? "success" : "failure", + tgt.isPresent() ? "success" : "failure")); + } + + } + catch (IOException e) { fail(e.getMessage()); } } + } diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/TypeDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/TypeDiffTest.java index e2d93d7a6..74231bf39 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/TypeDiffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/TypeDiffTest.java @@ -11,31 +11,23 @@ import static org.junit.jupiter.api.Assertions.assertEquals; public class TypeDiffTest extends SynDiffTestBasis { - + @BeforeAll public static void init() { dir = "src/test/resources/de/monticore/cddiff/syndiff/TypeDiff/"; } - + // Test for all kinds of changes in attributes @Test public void testType1() { parseModels("Source1.cd", "Target1.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - - new AssertSynDiff(synDiff) - .assertMatchedClasses(3) - .assertMatchedEnums(1) - .assertChangedTypes(4) - .assertAddedClasses(1) - .assertDeletedClasses(1) - .assertAddedEnums(1) - .assertDeletedEnums(1) - .assertAddedAssocs(1) - .assertDeletedAssocs(2) - .assertRemainingEmpty(); - + + new AssertSynDiff(synDiff).assertMatchedClasses(3).assertMatchedEnums(1).assertChangedTypes(4) + .assertAddedClasses(1).assertDeletedClasses(1).assertAddedEnums(1).assertDeletedEnums(1) + .assertAddedAssocs(1).assertDeletedAssocs(2).assertRemainingEmpty(); + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.DELETED_ATTRIBUTE, 2L); expectedDiffTypes.put(DiffTypes.INHERITED_ATTRIBUTE, 1L); @@ -52,25 +44,20 @@ public void testType1() { expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); expectedDiffTypes.put(DiffTypes.ADDED_INHERITANCE, 1L); expectedDiffTypes.put(DiffTypes.DELETED_INHERITANCE, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + // Tests for all kinds of changes in enum constants @Test public void testType2() { parseModels("Source2.cd", "Target2.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - - new AssertSynDiff(synDiff) - .assertMatchedClasses(2) - .assertMatchedEnums(1) - .assertChangedTypes(2) - .assertAddedEnums(1) - .assertDeletedEnums(1) - .assertRemainingEmpty(); - + + new AssertSynDiff(synDiff).assertMatchedClasses(2).assertMatchedEnums(1).assertChangedTypes(2) + .assertAddedEnums(1).assertDeletedEnums(1).assertRemainingEmpty(); + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.DELETED_ATTRIBUTE, 1L); expectedDiffTypes.put(DiffTypes.ADDED_ATTRIBUTE, 1L); @@ -79,49 +66,43 @@ public void testType2() { expectedDiffTypes.put(DiffTypes.ADDED_ENUM, 1L); expectedDiffTypes.put(DiffTypes.DELETED_ENUM, 1L); expectedDiffTypes.put(DiffTypes.ADDED_INHERITANCE, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + // Test for change of modifiers, extensions, and implementations @Test public void testType3() { parseModels("Source3.cd", "Target3.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - - new AssertSynDiff(synDiff) - .assertMatchedClasses(5) - .assertChangedTypes(3) - .assertRemainingEmpty(); - + + new AssertSynDiff(synDiff).assertMatchedClasses(5).assertChangedTypes(3).assertRemainingEmpty(); + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.CHANGED_CLASS_MODIFIER, 3L); expectedDiffTypes.put(DiffTypes.CHANGED_TYPE_IMPLEMENTS, 2L); expectedDiffTypes.put(DiffTypes.CHANGED_TYPE_EXTENDS, 1L); expectedDiffTypes.put(DiffTypes.ADDED_INHERITANCE, 1L); expectedDiffTypes.put(DiffTypes.DELETED_INHERITANCE, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + // Test for inherited attributes @Test public void testType4() { parseModels("Source4.cd", "Target4.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - - new AssertSynDiff(synDiff) - .assertMatchedClasses(3) - .assertChangedTypes(3) - .assertRemainingEmpty(); - + + new AssertSynDiff(synDiff).assertMatchedClasses(3).assertChangedTypes(3).assertRemainingEmpty(); + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.DELETED_ATTRIBUTE, 2L); expectedDiffTypes.put(DiffTypes.INHERITED_ATTRIBUTE, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + } From 87ce1a7f98afef26cc711316c0d8f1dd7ffaaa15 Mon Sep 17 00:00:00 2001 From: Lukas Kronast Date: Fri, 27 Jun 2025 12:41:17 +0200 Subject: [PATCH 04/17] small fix --- .../java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java index 25583d687..d2e4150d1 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java @@ -217,10 +217,9 @@ public static Stream witnessesReduction() { cddiffDir, "Employees/Employees7.cd", "Employees/Employees8.cd"), Arguments .of(cddiffDir, - "Employees/Employees1.cd", - "Employees/Employees2.cd"), - Arguments.of(cddiffDir, "Employees/Employees7.cd", "Employees/Employees8.cd"), Arguments.of( - cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd")); + "Employees/Employees7.cd", + "Employees/Employees8.cd"), + Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd")); } @ParameterizedTest From 582c04f3fb406c49b6d8eaef84048a7d8d23fca5 Mon Sep 17 00:00:00 2001 From: Lukas Kronast Date: Fri, 4 Jul 2025 12:05:40 +0200 Subject: [PATCH 05/17] reduce load for pipeline --- .../cddiff/syndiff/PerformanceTest.java | 14 +- .../syndiff/Performance/{1000 => 900}/CD1.cd | 609 ------------------ .../syndiff/Performance/{1000 => 900}/CD2.cd | 588 ----------------- 3 files changed, 7 insertions(+), 1204 deletions(-) rename cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/{1000 => 900}/CD1.cd (89%) rename cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/{1000 => 900}/CD2.cd (89%) diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java index a6ce4cf7b..f4b67e8d9 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java @@ -12,27 +12,27 @@ import java.util.stream.Stream; public class PerformanceTest extends SynDiffTestBasis { - + @BeforeAll public static void init() { dir = "src/test/resources/de/monticore/cddiff/syndiff/Performance/"; } - + public static Stream performanceData() { return Stream.of(Arguments.of("5/CD1.cd", "5/CD2.cd", 1), Arguments.of("10/CD1.cd", "10/CD2.cd", 1), Arguments.of("15/CD1.cd", "15/CD2.cd", 1), Arguments.of("20/CD1.cd", "20/CD2.cd", 1), Arguments.of("25/CD1.cd", "25/CD2.cd", 1), Arguments.of("100/CD1.cd", "100/CD2.cd", 2), - Arguments.of("1000/CD1.cd", "1000/CD2.cd", 120)); + Arguments.of("900/CD1.cd", "900/CD2.cd", 120)); } - + @ParameterizedTest @MethodSource("performanceData") public void testPerformance(String srcPath, String tgtPath, int timeoutSec) { parseModels(srcPath, tgtPath); - + Duration timeout = Duration.ofSeconds(timeoutSec); Assertions.assertTimeout(timeout, () -> new Syn2SemDiff(src, tgt)); - + } - + } diff --git a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/1000/CD1.cd b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/900/CD1.cd similarity index 89% rename from cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/1000/CD1.cd rename to cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/900/CD1.cd index 1ef8be30e..a4111ea86 100644 --- a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/1000/CD1.cd +++ b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/900/CD1.cd @@ -5193,613 +5193,4 @@ classdiagram CD1 { association [*] E179 <- C179 [0..1]; association [1] E179 -> D179 [1..*]; - - enum G180 {e11, e12, e13;} - - abstract class A180 { - String s; - } - - class B180 extends A180 { - E180 e; - } - - class C180 { - B180 b180; - } - - class D180 extends A180 { - String s; - } - - class E180 { - Double d; - } - - association [1] A180 <-> E180 [1..*]; - association [1..*] B180 -> C180 [0..1]; - association [1] C180 <-> D180 [1..*]; - association [*] E180 <- C180 [0..1]; - association [1] E180 -> D180 [1..*]; - - - enum G181 {e11, e12, e13;} - - abstract class A181 { - String s; - } - - class B181 extends A181 { - E181 e; - } - - class C181 { - B181 b181; - } - - class D181 extends A181 { - String s; - } - - class E181 { - Double d; - } - - association [1] A181 <-> E181 [1..*]; - association [1..*] B181 -> C181 [0..1]; - association [1] C181 <-> D181 [1..*]; - association [*] E181 <- C181 [0..1]; - association [1] E181 -> D181 [1..*]; - - - enum G182 {e11, e12, e13;} - - abstract class A182 { - String s; - } - - class B182 extends A182 { - E182 e; - } - - class C182 { - B182 b182; - } - - class D182 extends A182 { - String s; - } - - class E182 { - Double d; - } - - association [1] A182 <-> E182 [1..*]; - association [1..*] B182 -> C182 [0..1]; - association [1] C182 <-> D182 [1..*]; - association [*] E182 <- C182 [0..1]; - association [1] E182 -> D182 [1..*]; - - - enum G183 {e11, e12, e13;} - - abstract class A183 { - String s; - } - - class B183 extends A183 { - E183 e; - } - - class C183 { - B183 b183; - } - - class D183 extends A183 { - String s; - } - - class E183 { - Double d; - } - - association [1] A183 <-> E183 [1..*]; - association [1..*] B183 -> C183 [0..1]; - association [1] C183 <-> D183 [1..*]; - association [*] E183 <- C183 [0..1]; - association [1] E183 -> D183 [1..*]; - - - enum G184 {e11, e12, e13;} - - abstract class A184 { - String s; - } - - class B184 extends A184 { - E184 e; - } - - class C184 { - B184 b184; - } - - class D184 extends A184 { - String s; - } - - class E184 { - Double d; - } - - association [1] A184 <-> E184 [1..*]; - association [1..*] B184 -> C184 [0..1]; - association [1] C184 <-> D184 [1..*]; - association [*] E184 <- C184 [0..1]; - association [1] E184 -> D184 [1..*]; - - - enum G185 {e11, e12, e13;} - - abstract class A185 { - String s; - } - - class B185 extends A185 { - E185 e; - } - - class C185 { - B185 b185; - } - - class D185 extends A185 { - String s; - } - - class E185 { - Double d; - } - - association [1] A185 <-> E185 [1..*]; - association [1..*] B185 -> C185 [0..1]; - association [1] C185 <-> D185 [1..*]; - association [*] E185 <- C185 [0..1]; - association [1] E185 -> D185 [1..*]; - - - enum G186 {e11, e12, e13;} - - abstract class A186 { - String s; - } - - class B186 extends A186 { - E186 e; - } - - class C186 { - B186 b186; - } - - class D186 extends A186 { - String s; - } - - class E186 { - Double d; - } - - association [1] A186 <-> E186 [1..*]; - association [1..*] B186 -> C186 [0..1]; - association [1] C186 <-> D186 [1..*]; - association [*] E186 <- C186 [0..1]; - association [1] E186 -> D186 [1..*]; - - - enum G187 {e11, e12, e13;} - - abstract class A187 { - String s; - } - - class B187 extends A187 { - E187 e; - } - - class C187 { - B187 b187; - } - - class D187 extends A187 { - String s; - } - - class E187 { - Double d; - } - - association [1] A187 <-> E187 [1..*]; - association [1..*] B187 -> C187 [0..1]; - association [1] C187 <-> D187 [1..*]; - association [*] E187 <- C187 [0..1]; - association [1] E187 -> D187 [1..*]; - - - enum G188 {e11, e12, e13;} - - abstract class A188 { - String s; - } - - class B188 extends A188 { - E188 e; - } - - class C188 { - B188 b188; - } - - class D188 extends A188 { - String s; - } - - class E188 { - Double d; - } - - association [1] A188 <-> E188 [1..*]; - association [1..*] B188 -> C188 [0..1]; - association [1] C188 <-> D188 [1..*]; - association [*] E188 <- C188 [0..1]; - association [1] E188 -> D188 [1..*]; - - - enum G189 {e11, e12, e13;} - - abstract class A189 { - String s; - } - - class B189 extends A189 { - E189 e; - } - - class C189 { - B189 b189; - } - - class D189 extends A189 { - String s; - } - - class E189 { - Double d; - } - - association [1] A189 <-> E189 [1..*]; - association [1..*] B189 -> C189 [0..1]; - association [1] C189 <-> D189 [1..*]; - association [*] E189 <- C189 [0..1]; - association [1] E189 -> D189 [1..*]; - - - enum G190 {e11, e12, e13;} - - abstract class A190 { - String s; - } - - class B190 extends A190 { - E190 e; - } - - class C190 { - B190 b190; - } - - class D190 extends A190 { - String s; - } - - class E190 { - Double d; - } - - association [1] A190 <-> E190 [1..*]; - association [1..*] B190 -> C190 [0..1]; - association [1] C190 <-> D190 [1..*]; - association [*] E190 <- C190 [0..1]; - association [1] E190 -> D190 [1..*]; - - - enum G191 {e11, e12, e13;} - - abstract class A191 { - String s; - } - - class B191 extends A191 { - E191 e; - } - - class C191 { - B191 b191; - } - - class D191 extends A191 { - String s; - } - - class E191 { - Double d; - } - - association [1] A191 <-> E191 [1..*]; - association [1..*] B191 -> C191 [0..1]; - association [1] C191 <-> D191 [1..*]; - association [*] E191 <- C191 [0..1]; - association [1] E191 -> D191 [1..*]; - - - enum G192 {e11, e12, e13;} - - abstract class A192 { - String s; - } - - class B192 extends A192 { - E192 e; - } - - class C192 { - B192 b192; - } - - class D192 extends A192 { - String s; - } - - class E192 { - Double d; - } - - association [1] A192 <-> E192 [1..*]; - association [1..*] B192 -> C192 [0..1]; - association [1] C192 <-> D192 [1..*]; - association [*] E192 <- C192 [0..1]; - association [1] E192 -> D192 [1..*]; - - - enum G193 {e11, e12, e13;} - - abstract class A193 { - String s; - } - - class B193 extends A193 { - E193 e; - } - - class C193 { - B193 b193; - } - - class D193 extends A193 { - String s; - } - - class E193 { - Double d; - } - - association [1] A193 <-> E193 [1..*]; - association [1..*] B193 -> C193 [0..1]; - association [1] C193 <-> D193 [1..*]; - association [*] E193 <- C193 [0..1]; - association [1] E193 -> D193 [1..*]; - - - enum G194 {e11, e12, e13;} - - abstract class A194 { - String s; - } - - class B194 extends A194 { - E194 e; - } - - class C194 { - B194 b194; - } - - class D194 extends A194 { - String s; - } - - class E194 { - Double d; - } - - association [1] A194 <-> E194 [1..*]; - association [1..*] B194 -> C194 [0..1]; - association [1] C194 <-> D194 [1..*]; - association [*] E194 <- C194 [0..1]; - association [1] E194 -> D194 [1..*]; - - - enum G195 {e11, e12, e13;} - - abstract class A195 { - String s; - } - - class B195 extends A195 { - E195 e; - } - - class C195 { - B195 b195; - } - - class D195 extends A195 { - String s; - } - - class E195 { - Double d; - } - - association [1] A195 <-> E195 [1..*]; - association [1..*] B195 -> C195 [0..1]; - association [1] C195 <-> D195 [1..*]; - association [*] E195 <- C195 [0..1]; - association [1] E195 -> D195 [1..*]; - - - enum G196 {e11, e12, e13;} - - abstract class A196 { - String s; - } - - class B196 extends A196 { - E196 e; - } - - class C196 { - B196 b196; - } - - class D196 extends A196 { - String s; - } - - class E196 { - Double d; - } - - association [1] A196 <-> E196 [1..*]; - association [1..*] B196 -> C196 [0..1]; - association [1] C196 <-> D196 [1..*]; - association [*] E196 <- C196 [0..1]; - association [1] E196 -> D196 [1..*]; - - - enum G197 {e11, e12, e13;} - - abstract class A197 { - String s; - } - - class B197 extends A197 { - E197 e; - } - - class C197 { - B197 b197; - } - - class D197 extends A197 { - String s; - } - - class E197 { - Double d; - } - - association [1] A197 <-> E197 [1..*]; - association [1..*] B197 -> C197 [0..1]; - association [1] C197 <-> D197 [1..*]; - association [*] E197 <- C197 [0..1]; - association [1] E197 -> D197 [1..*]; - - - enum G198 {e11, e12, e13;} - - abstract class A198 { - String s; - } - - class B198 extends A198 { - E198 e; - } - - class C198 { - B198 b198; - } - - class D198 extends A198 { - String s; - } - - class E198 { - Double d; - } - - association [1] A198 <-> E198 [1..*]; - association [1..*] B198 -> C198 [0..1]; - association [1] C198 <-> D198 [1..*]; - association [*] E198 <- C198 [0..1]; - association [1] E198 -> D198 [1..*]; - - - enum G199 {e11, e12, e13;} - - abstract class A199 { - String s; - } - - class B199 extends A199 { - E199 e; - } - - class C199 { - B199 b199; - } - - class D199 extends A199 { - String s; - } - - class E199 { - Double d; - } - - association [1] A199 <-> E199 [1..*]; - association [1..*] B199 -> C199 [0..1]; - association [1] C199 <-> D199 [1..*]; - association [*] E199 <- C199 [0..1]; - association [1] E199 -> D199 [1..*]; - - - enum G200 {e11, e12, e13;} - - abstract class A200 { - String s; - } - - class B200 extends A200 { - E200 e; - } - - class C200 { - B200 b200; - } - - class D200 extends A200 { - String s; - } - - class E200 { - Double d; - } - - association [1] A200 <-> E200 [1..*]; - association [1..*] B200 -> C200 [0..1]; - association [1] C200 <-> D200 [1..*]; - association [*] E200 <- C200 [0..1]; - association [1] E200 -> D200 [1..*]; - } diff --git a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/1000/CD2.cd b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/900/CD2.cd similarity index 89% rename from cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/1000/CD2.cd rename to cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/900/CD2.cd index cf0f568d7..c8e2807b8 100644 --- a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/1000/CD2.cd +++ b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/900/CD2.cd @@ -5013,593 +5013,5 @@ classdiagram CD2 { association [1..*] E179 <-> C179 [*]; association [1] F179 <- D179 [1..*]; - - enum G180 {F11, F12;} - - class B180 { - F180 e; - } - - class C180 { - B180 b180; - } - - class D180 extends C180 { - } - - class E180 { - Integer i; - } - - class F180 extends B180 { - Double d; - } - - association [1] F180 <-> E180 [1..*]; - association [*] B180 -> C180 [0..1]; - association [1] C180 <-> D180 [1]; - association [1..*] E180 <-> C180 [*]; - association [1] F180 <- D180 [1..*]; - - - enum G181 {F11, F12;} - - class B181 { - F181 e; - } - - class C181 { - B181 b181; - } - - class D181 extends C181 { - } - - class E181 { - Integer i; - } - - class F181 extends B181 { - Double d; - } - - association [1] F181 <-> E181 [1..*]; - association [*] B181 -> C181 [0..1]; - association [1] C181 <-> D181 [1]; - association [1..*] E181 <-> C181 [*]; - association [1] F181 <- D181 [1..*]; - - - enum G182 {F11, F12;} - - class B182 { - F182 e; - } - - class C182 { - B182 b182; - } - - class D182 extends C182 { - } - - class E182 { - Integer i; - } - - class F182 extends B182 { - Double d; - } - - association [1] F182 <-> E182 [1..*]; - association [*] B182 -> C182 [0..1]; - association [1] C182 <-> D182 [1]; - association [1..*] E182 <-> C182 [*]; - association [1] F182 <- D182 [1..*]; - - - enum G183 {F11, F12;} - - class B183 { - F183 e; - } - - class C183 { - B183 b183; - } - - class D183 extends C183 { - } - - class E183 { - Integer i; - } - - class F183 extends B183 { - Double d; - } - - association [1] F183 <-> E183 [1..*]; - association [*] B183 -> C183 [0..1]; - association [1] C183 <-> D183 [1]; - association [1..*] E183 <-> C183 [*]; - association [1] F183 <- D183 [1..*]; - - - enum G184 {F11, F12;} - - class B184 { - F184 e; - } - - class C184 { - B184 b184; - } - - class D184 extends C184 { - } - - class E184 { - Integer i; - } - - class F184 extends B184 { - Double d; - } - - association [1] F184 <-> E184 [1..*]; - association [*] B184 -> C184 [0..1]; - association [1] C184 <-> D184 [1]; - association [1..*] E184 <-> C184 [*]; - association [1] F184 <- D184 [1..*]; - - - enum G185 {F11, F12;} - - class B185 { - F185 e; - } - - class C185 { - B185 b185; - } - - class D185 extends C185 { - } - - class E185 { - Integer i; - } - - class F185 extends B185 { - Double d; - } - - association [1] F185 <-> E185 [1..*]; - association [*] B185 -> C185 [0..1]; - association [1] C185 <-> D185 [1]; - association [1..*] E185 <-> C185 [*]; - association [1] F185 <- D185 [1..*]; - - - enum G186 {F11, F12;} - - class B186 { - F186 e; - } - - class C186 { - B186 b186; - } - - class D186 extends C186 { - } - - class E186 { - Integer i; - } - - class F186 extends B186 { - Double d; - } - - association [1] F186 <-> E186 [1..*]; - association [*] B186 -> C186 [0..1]; - association [1] C186 <-> D186 [1]; - association [1..*] E186 <-> C186 [*]; - association [1] F186 <- D186 [1..*]; - - - enum G187 {F11, F12;} - - class B187 { - F187 e; - } - - class C187 { - B187 b187; - } - - class D187 extends C187 { - } - - class E187 { - Integer i; - } - - class F187 extends B187 { - Double d; - } - - association [1] F187 <-> E187 [1..*]; - association [*] B187 -> C187 [0..1]; - association [1] C187 <-> D187 [1]; - association [1..*] E187 <-> C187 [*]; - association [1] F187 <- D187 [1..*]; - - - enum G188 {F11, F12;} - - class B188 { - F188 e; - } - - class C188 { - B188 b188; - } - - class D188 extends C188 { - } - - class E188 { - Integer i; - } - - class F188 extends B188 { - Double d; - } - - association [1] F188 <-> E188 [1..*]; - association [*] B188 -> C188 [0..1]; - association [1] C188 <-> D188 [1]; - association [1..*] E188 <-> C188 [*]; - association [1] F188 <- D188 [1..*]; - - - enum G189 {F11, F12;} - - class B189 { - F189 e; - } - - class C189 { - B189 b189; - } - - class D189 extends C189 { - } - - class E189 { - Integer i; - } - - class F189 extends B189 { - Double d; - } - - association [1] F189 <-> E189 [1..*]; - association [*] B189 -> C189 [0..1]; - association [1] C189 <-> D189 [1]; - association [1..*] E189 <-> C189 [*]; - association [1] F189 <- D189 [1..*]; - - - enum G190 {F11, F12;} - - class B190 { - F190 e; - } - - class C190 { - B190 b190; - } - - class D190 extends C190 { - } - - class E190 { - Integer i; - } - - class F190 extends B190 { - Double d; - } - - association [1] F190 <-> E190 [1..*]; - association [*] B190 -> C190 [0..1]; - association [1] C190 <-> D190 [1]; - association [1..*] E190 <-> C190 [*]; - association [1] F190 <- D190 [1..*]; - - - enum G191 {F11, F12;} - - class B191 { - F191 e; - } - - class C191 { - B191 b191; - } - - class D191 extends C191 { - } - - class E191 { - Integer i; - } - - class F191 extends B191 { - Double d; - } - - association [1] F191 <-> E191 [1..*]; - association [*] B191 -> C191 [0..1]; - association [1] C191 <-> D191 [1]; - association [1..*] E191 <-> C191 [*]; - association [1] F191 <- D191 [1..*]; - - - enum G192 {F11, F12;} - - class B192 { - F192 e; - } - - class C192 { - B192 b192; - } - - class D192 extends C192 { - } - - class E192 { - Integer i; - } - - class F192 extends B192 { - Double d; - } - - association [1] F192 <-> E192 [1..*]; - association [*] B192 -> C192 [0..1]; - association [1] C192 <-> D192 [1]; - association [1..*] E192 <-> C192 [*]; - association [1] F192 <- D192 [1..*]; - - - enum G193 {F11, F12;} - - class B193 { - F193 e; - } - - class C193 { - B193 b193; - } - - class D193 extends C193 { - } - - class E193 { - Integer i; - } - - class F193 extends B193 { - Double d; - } - - association [1] F193 <-> E193 [1..*]; - association [*] B193 -> C193 [0..1]; - association [1] C193 <-> D193 [1]; - association [1..*] E193 <-> C193 [*]; - association [1] F193 <- D193 [1..*]; - - - enum G194 {F11, F12;} - - class B194 { - F194 e; - } - - class C194 { - B194 b194; - } - - class D194 extends C194 { - } - - class E194 { - Integer i; - } - - class F194 extends B194 { - Double d; - } - - association [1] F194 <-> E194 [1..*]; - association [*] B194 -> C194 [0..1]; - association [1] C194 <-> D194 [1]; - association [1..*] E194 <-> C194 [*]; - association [1] F194 <- D194 [1..*]; - - - enum G195 {F11, F12;} - - class B195 { - F195 e; - } - - class C195 { - B195 b195; - } - - class D195 extends C195 { - } - - class E195 { - Integer i; - } - - class F195 extends B195 { - Double d; - } - - association [1] F195 <-> E195 [1..*]; - association [*] B195 -> C195 [0..1]; - association [1] C195 <-> D195 [1]; - association [1..*] E195 <-> C195 [*]; - association [1] F195 <- D195 [1..*]; - - - enum G196 {F11, F12;} - - class B196 { - F196 e; - } - - class C196 { - B196 b196; - } - - class D196 extends C196 { - } - - class E196 { - Integer i; - } - - class F196 extends B196 { - Double d; - } - - association [1] F196 <-> E196 [1..*]; - association [*] B196 -> C196 [0..1]; - association [1] C196 <-> D196 [1]; - association [1..*] E196 <-> C196 [*]; - association [1] F196 <- D196 [1..*]; - - - enum G197 {F11, F12;} - - class B197 { - F197 e; - } - - class C197 { - B197 b197; - } - - class D197 extends C197 { - } - - class E197 { - Integer i; - } - - class F197 extends B197 { - Double d; - } - - association [1] F197 <-> E197 [1..*]; - association [*] B197 -> C197 [0..1]; - association [1] C197 <-> D197 [1]; - association [1..*] E197 <-> C197 [*]; - association [1] F197 <- D197 [1..*]; - - - enum G198 {F11, F12;} - - class B198 { - F198 e; - } - - class C198 { - B198 b198; - } - - class D198 extends C198 { - } - - class E198 { - Integer i; - } - - class F198 extends B198 { - Double d; - } - - association [1] F198 <-> E198 [1..*]; - association [*] B198 -> C198 [0..1]; - association [1] C198 <-> D198 [1]; - association [1..*] E198 <-> C198 [*]; - association [1] F198 <- D198 [1..*]; - - - enum G199 {F11, F12;} - - class B199 { - F199 e; - } - - class C199 { - B199 b199; - } - - class D199 extends C199 { - } - - class E199 { - Integer i; - } - - class F199 extends B199 { - Double d; - } - - association [1] F199 <-> E199 [1..*]; - association [*] B199 -> C199 [0..1]; - association [1] C199 <-> D199 [1]; - association [1..*] E199 <-> C199 [*]; - association [1] F199 <- D199 [1..*]; - - - enum G200 {F11, F12;} - - class B200 { - F200 e; - } - - class C200 { - B200 b200; - } - - class D200 extends C200 { - } - - class E200 { - Integer i; - } - - class F200 extends B200 { - Double d; - } - - association [1] F200 <-> E200 [1..*]; - association [*] B200 -> C200 [0..1]; - association [1] C200 <-> D200 [1]; - association [1..*] E200 <-> C200 [*]; - association [1] F200 <- D200 [1..*]; - } From 72774a8354faac028d03b1812431bcfa506e038f Mon Sep 17 00:00:00 2001 From: Lukas Kronast Date: Fri, 4 Jul 2025 12:45:02 +0200 Subject: [PATCH 06/17] linting --- .../de/monticore/cddiff/syndiff/PerformanceTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java index f4b67e8d9..dd6857e8a 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java @@ -12,27 +12,27 @@ import java.util.stream.Stream; public class PerformanceTest extends SynDiffTestBasis { - + @BeforeAll public static void init() { dir = "src/test/resources/de/monticore/cddiff/syndiff/Performance/"; } - + public static Stream performanceData() { return Stream.of(Arguments.of("5/CD1.cd", "5/CD2.cd", 1), Arguments.of("10/CD1.cd", "10/CD2.cd", 1), Arguments.of("15/CD1.cd", "15/CD2.cd", 1), Arguments.of("20/CD1.cd", "20/CD2.cd", 1), Arguments.of("25/CD1.cd", "25/CD2.cd", 1), Arguments.of("100/CD1.cd", "100/CD2.cd", 2), Arguments.of("900/CD1.cd", "900/CD2.cd", 120)); } - + @ParameterizedTest @MethodSource("performanceData") public void testPerformance(String srcPath, String tgtPath, int timeoutSec) { parseModels(srcPath, tgtPath); - + Duration timeout = Duration.ofSeconds(timeoutSec); Assertions.assertTimeout(timeout, () -> new Syn2SemDiff(src, tgt)); - + } - + } From 6aa36c9ddb8790be14b4ed1aeaf46dcac2e301f3 Mon Sep 17 00:00:00 2001 From: Lukas Kronast Date: Fri, 4 Jul 2025 15:00:50 +0200 Subject: [PATCH 07/17] reduce pipeline load even further --- .../cddiff/syndiff/PerformanceTest.java | 2 +- .../syndiff/Performance/{900 => 500}/CD1.cd | 2291 ----------------- .../syndiff/Performance/{900 => 500}/CD2.cd | 2212 ---------------- 3 files changed, 1 insertion(+), 4504 deletions(-) rename cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/{900 => 500}/CD1.cd (54%) rename cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/{900 => 500}/CD2.cd (54%) diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java index dd6857e8a..5976df24f 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java @@ -22,7 +22,7 @@ public static Stream performanceData() { return Stream.of(Arguments.of("5/CD1.cd", "5/CD2.cd", 1), Arguments.of("10/CD1.cd", "10/CD2.cd", 1), Arguments.of("15/CD1.cd", "15/CD2.cd", 1), Arguments.of("20/CD1.cd", "20/CD2.cd", 1), Arguments.of("25/CD1.cd", "25/CD2.cd", 1), Arguments.of("100/CD1.cd", "100/CD2.cd", 2), - Arguments.of("900/CD1.cd", "900/CD2.cd", 120)); + Arguments.of("500/CD1.cd", "500/CD2.cd", 120)); } @ParameterizedTest diff --git a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/900/CD1.cd b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/500/CD1.cd similarity index 54% rename from cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/900/CD1.cd rename to cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/500/CD1.cd index a4111ea86..a71bd52bd 100644 --- a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/900/CD1.cd +++ b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/500/CD1.cd @@ -2902,2295 +2902,4 @@ classdiagram CD1 { association [*] E100 <- C100 [0..1]; association [1] E100 -> D100 [1..*]; - - enum G101 {e11, e12, e13;} - - abstract class A101 { - String s; - } - - class B101 extends A101 { - E101 e; - } - - class C101 { - B101 b101; - } - - class D101 extends A101 { - String s; - } - - class E101 { - Double d; - } - - association [1] A101 <-> E101 [1..*]; - association [1..*] B101 -> C101 [0..1]; - association [1] C101 <-> D101 [1..*]; - association [*] E101 <- C101 [0..1]; - association [1] E101 -> D101 [1..*]; - - - enum G102 {e11, e12, e13;} - - abstract class A102 { - String s; - } - - class B102 extends A102 { - E102 e; - } - - class C102 { - B102 b102; - } - - class D102 extends A102 { - String s; - } - - class E102 { - Double d; - } - - association [1] A102 <-> E102 [1..*]; - association [1..*] B102 -> C102 [0..1]; - association [1] C102 <-> D102 [1..*]; - association [*] E102 <- C102 [0..1]; - association [1] E102 -> D102 [1..*]; - - - enum G103 {e11, e12, e13;} - - abstract class A103 { - String s; - } - - class B103 extends A103 { - E103 e; - } - - class C103 { - B103 b103; - } - - class D103 extends A103 { - String s; - } - - class E103 { - Double d; - } - - association [1] A103 <-> E103 [1..*]; - association [1..*] B103 -> C103 [0..1]; - association [1] C103 <-> D103 [1..*]; - association [*] E103 <- C103 [0..1]; - association [1] E103 -> D103 [1..*]; - - - enum G104 {e11, e12, e13;} - - abstract class A104 { - String s; - } - - class B104 extends A104 { - E104 e; - } - - class C104 { - B104 b104; - } - - class D104 extends A104 { - String s; - } - - class E104 { - Double d; - } - - association [1] A104 <-> E104 [1..*]; - association [1..*] B104 -> C104 [0..1]; - association [1] C104 <-> D104 [1..*]; - association [*] E104 <- C104 [0..1]; - association [1] E104 -> D104 [1..*]; - - - enum G105 {e11, e12, e13;} - - abstract class A105 { - String s; - } - - class B105 extends A105 { - E105 e; - } - - class C105 { - B105 b105; - } - - class D105 extends A105 { - String s; - } - - class E105 { - Double d; - } - - association [1] A105 <-> E105 [1..*]; - association [1..*] B105 -> C105 [0..1]; - association [1] C105 <-> D105 [1..*]; - association [*] E105 <- C105 [0..1]; - association [1] E105 -> D105 [1..*]; - - - enum G106 {e11, e12, e13;} - - abstract class A106 { - String s; - } - - class B106 extends A106 { - E106 e; - } - - class C106 { - B106 b106; - } - - class D106 extends A106 { - String s; - } - - class E106 { - Double d; - } - - association [1] A106 <-> E106 [1..*]; - association [1..*] B106 -> C106 [0..1]; - association [1] C106 <-> D106 [1..*]; - association [*] E106 <- C106 [0..1]; - association [1] E106 -> D106 [1..*]; - - - enum G107 {e11, e12, e13;} - - abstract class A107 { - String s; - } - - class B107 extends A107 { - E107 e; - } - - class C107 { - B107 b107; - } - - class D107 extends A107 { - String s; - } - - class E107 { - Double d; - } - - association [1] A107 <-> E107 [1..*]; - association [1..*] B107 -> C107 [0..1]; - association [1] C107 <-> D107 [1..*]; - association [*] E107 <- C107 [0..1]; - association [1] E107 -> D107 [1..*]; - - - enum G108 {e11, e12, e13;} - - abstract class A108 { - String s; - } - - class B108 extends A108 { - E108 e; - } - - class C108 { - B108 b108; - } - - class D108 extends A108 { - String s; - } - - class E108 { - Double d; - } - - association [1] A108 <-> E108 [1..*]; - association [1..*] B108 -> C108 [0..1]; - association [1] C108 <-> D108 [1..*]; - association [*] E108 <- C108 [0..1]; - association [1] E108 -> D108 [1..*]; - - - enum G109 {e11, e12, e13;} - - abstract class A109 { - String s; - } - - class B109 extends A109 { - E109 e; - } - - class C109 { - B109 b109; - } - - class D109 extends A109 { - String s; - } - - class E109 { - Double d; - } - - association [1] A109 <-> E109 [1..*]; - association [1..*] B109 -> C109 [0..1]; - association [1] C109 <-> D109 [1..*]; - association [*] E109 <- C109 [0..1]; - association [1] E109 -> D109 [1..*]; - - - enum G110 {e11, e12, e13;} - - abstract class A110 { - String s; - } - - class B110 extends A110 { - E110 e; - } - - class C110 { - B110 b110; - } - - class D110 extends A110 { - String s; - } - - class E110 { - Double d; - } - - association [1] A110 <-> E110 [1..*]; - association [1..*] B110 -> C110 [0..1]; - association [1] C110 <-> D110 [1..*]; - association [*] E110 <- C110 [0..1]; - association [1] E110 -> D110 [1..*]; - - - enum G111 {e11, e12, e13;} - - abstract class A111 { - String s; - } - - class B111 extends A111 { - E111 e; - } - - class C111 { - B111 b111; - } - - class D111 extends A111 { - String s; - } - - class E111 { - Double d; - } - - association [1] A111 <-> E111 [1..*]; - association [1..*] B111 -> C111 [0..1]; - association [1] C111 <-> D111 [1..*]; - association [*] E111 <- C111 [0..1]; - association [1] E111 -> D111 [1..*]; - - - enum G112 {e11, e12, e13;} - - abstract class A112 { - String s; - } - - class B112 extends A112 { - E112 e; - } - - class C112 { - B112 b112; - } - - class D112 extends A112 { - String s; - } - - class E112 { - Double d; - } - - association [1] A112 <-> E112 [1..*]; - association [1..*] B112 -> C112 [0..1]; - association [1] C112 <-> D112 [1..*]; - association [*] E112 <- C112 [0..1]; - association [1] E112 -> D112 [1..*]; - - - enum G113 {e11, e12, e13;} - - abstract class A113 { - String s; - } - - class B113 extends A113 { - E113 e; - } - - class C113 { - B113 b113; - } - - class D113 extends A113 { - String s; - } - - class E113 { - Double d; - } - - association [1] A113 <-> E113 [1..*]; - association [1..*] B113 -> C113 [0..1]; - association [1] C113 <-> D113 [1..*]; - association [*] E113 <- C113 [0..1]; - association [1] E113 -> D113 [1..*]; - - - enum G114 {e11, e12, e13;} - - abstract class A114 { - String s; - } - - class B114 extends A114 { - E114 e; - } - - class C114 { - B114 b114; - } - - class D114 extends A114 { - String s; - } - - class E114 { - Double d; - } - - association [1] A114 <-> E114 [1..*]; - association [1..*] B114 -> C114 [0..1]; - association [1] C114 <-> D114 [1..*]; - association [*] E114 <- C114 [0..1]; - association [1] E114 -> D114 [1..*]; - - - enum G115 {e11, e12, e13;} - - abstract class A115 { - String s; - } - - class B115 extends A115 { - E115 e; - } - - class C115 { - B115 b115; - } - - class D115 extends A115 { - String s; - } - - class E115 { - Double d; - } - - association [1] A115 <-> E115 [1..*]; - association [1..*] B115 -> C115 [0..1]; - association [1] C115 <-> D115 [1..*]; - association [*] E115 <- C115 [0..1]; - association [1] E115 -> D115 [1..*]; - - - enum G116 {e11, e12, e13;} - - abstract class A116 { - String s; - } - - class B116 extends A116 { - E116 e; - } - - class C116 { - B116 b116; - } - - class D116 extends A116 { - String s; - } - - class E116 { - Double d; - } - - association [1] A116 <-> E116 [1..*]; - association [1..*] B116 -> C116 [0..1]; - association [1] C116 <-> D116 [1..*]; - association [*] E116 <- C116 [0..1]; - association [1] E116 -> D116 [1..*]; - - - enum G117 {e11, e12, e13;} - - abstract class A117 { - String s; - } - - class B117 extends A117 { - E117 e; - } - - class C117 { - B117 b117; - } - - class D117 extends A117 { - String s; - } - - class E117 { - Double d; - } - - association [1] A117 <-> E117 [1..*]; - association [1..*] B117 -> C117 [0..1]; - association [1] C117 <-> D117 [1..*]; - association [*] E117 <- C117 [0..1]; - association [1] E117 -> D117 [1..*]; - - - enum G118 {e11, e12, e13;} - - abstract class A118 { - String s; - } - - class B118 extends A118 { - E118 e; - } - - class C118 { - B118 b118; - } - - class D118 extends A118 { - String s; - } - - class E118 { - Double d; - } - - association [1] A118 <-> E118 [1..*]; - association [1..*] B118 -> C118 [0..1]; - association [1] C118 <-> D118 [1..*]; - association [*] E118 <- C118 [0..1]; - association [1] E118 -> D118 [1..*]; - - - enum G119 {e11, e12, e13;} - - abstract class A119 { - String s; - } - - class B119 extends A119 { - E119 e; - } - - class C119 { - B119 b119; - } - - class D119 extends A119 { - String s; - } - - class E119 { - Double d; - } - - association [1] A119 <-> E119 [1..*]; - association [1..*] B119 -> C119 [0..1]; - association [1] C119 <-> D119 [1..*]; - association [*] E119 <- C119 [0..1]; - association [1] E119 -> D119 [1..*]; - - - enum G120 {e11, e12, e13;} - - abstract class A120 { - String s; - } - - class B120 extends A120 { - E120 e; - } - - class C120 { - B120 b120; - } - - class D120 extends A120 { - String s; - } - - class E120 { - Double d; - } - - association [1] A120 <-> E120 [1..*]; - association [1..*] B120 -> C120 [0..1]; - association [1] C120 <-> D120 [1..*]; - association [*] E120 <- C120 [0..1]; - association [1] E120 -> D120 [1..*]; - - - enum G121 {e11, e12, e13;} - - abstract class A121 { - String s; - } - - class B121 extends A121 { - E121 e; - } - - class C121 { - B121 b121; - } - - class D121 extends A121 { - String s; - } - - class E121 { - Double d; - } - - association [1] A121 <-> E121 [1..*]; - association [1..*] B121 -> C121 [0..1]; - association [1] C121 <-> D121 [1..*]; - association [*] E121 <- C121 [0..1]; - association [1] E121 -> D121 [1..*]; - - - enum G122 {e11, e12, e13;} - - abstract class A122 { - String s; - } - - class B122 extends A122 { - E122 e; - } - - class C122 { - B122 b122; - } - - class D122 extends A122 { - String s; - } - - class E122 { - Double d; - } - - association [1] A122 <-> E122 [1..*]; - association [1..*] B122 -> C122 [0..1]; - association [1] C122 <-> D122 [1..*]; - association [*] E122 <- C122 [0..1]; - association [1] E122 -> D122 [1..*]; - - - enum G123 {e11, e12, e13;} - - abstract class A123 { - String s; - } - - class B123 extends A123 { - E123 e; - } - - class C123 { - B123 b123; - } - - class D123 extends A123 { - String s; - } - - class E123 { - Double d; - } - - association [1] A123 <-> E123 [1..*]; - association [1..*] B123 -> C123 [0..1]; - association [1] C123 <-> D123 [1..*]; - association [*] E123 <- C123 [0..1]; - association [1] E123 -> D123 [1..*]; - - - enum G124 {e11, e12, e13;} - - abstract class A124 { - String s; - } - - class B124 extends A124 { - E124 e; - } - - class C124 { - B124 b124; - } - - class D124 extends A124 { - String s; - } - - class E124 { - Double d; - } - - association [1] A124 <-> E124 [1..*]; - association [1..*] B124 -> C124 [0..1]; - association [1] C124 <-> D124 [1..*]; - association [*] E124 <- C124 [0..1]; - association [1] E124 -> D124 [1..*]; - - - enum G125 {e11, e12, e13;} - - abstract class A125 { - String s; - } - - class B125 extends A125 { - E125 e; - } - - class C125 { - B125 b125; - } - - class D125 extends A125 { - String s; - } - - class E125 { - Double d; - } - - association [1] A125 <-> E125 [1..*]; - association [1..*] B125 -> C125 [0..1]; - association [1] C125 <-> D125 [1..*]; - association [*] E125 <- C125 [0..1]; - association [1] E125 -> D125 [1..*]; - - - enum G126 {e11, e12, e13;} - - abstract class A126 { - String s; - } - - class B126 extends A126 { - E126 e; - } - - class C126 { - B126 b126; - } - - class D126 extends A126 { - String s; - } - - class E126 { - Double d; - } - - association [1] A126 <-> E126 [1..*]; - association [1..*] B126 -> C126 [0..1]; - association [1] C126 <-> D126 [1..*]; - association [*] E126 <- C126 [0..1]; - association [1] E126 -> D126 [1..*]; - - - enum G127 {e11, e12, e13;} - - abstract class A127 { - String s; - } - - class B127 extends A127 { - E127 e; - } - - class C127 { - B127 b127; - } - - class D127 extends A127 { - String s; - } - - class E127 { - Double d; - } - - association [1] A127 <-> E127 [1..*]; - association [1..*] B127 -> C127 [0..1]; - association [1] C127 <-> D127 [1..*]; - association [*] E127 <- C127 [0..1]; - association [1] E127 -> D127 [1..*]; - - - enum G128 {e11, e12, e13;} - - abstract class A128 { - String s; - } - - class B128 extends A128 { - E128 e; - } - - class C128 { - B128 b128; - } - - class D128 extends A128 { - String s; - } - - class E128 { - Double d; - } - - association [1] A128 <-> E128 [1..*]; - association [1..*] B128 -> C128 [0..1]; - association [1] C128 <-> D128 [1..*]; - association [*] E128 <- C128 [0..1]; - association [1] E128 -> D128 [1..*]; - - - enum G129 {e11, e12, e13;} - - abstract class A129 { - String s; - } - - class B129 extends A129 { - E129 e; - } - - class C129 { - B129 b129; - } - - class D129 extends A129 { - String s; - } - - class E129 { - Double d; - } - - association [1] A129 <-> E129 [1..*]; - association [1..*] B129 -> C129 [0..1]; - association [1] C129 <-> D129 [1..*]; - association [*] E129 <- C129 [0..1]; - association [1] E129 -> D129 [1..*]; - - - enum G130 {e11, e12, e13;} - - abstract class A130 { - String s; - } - - class B130 extends A130 { - E130 e; - } - - class C130 { - B130 b130; - } - - class D130 extends A130 { - String s; - } - - class E130 { - Double d; - } - - association [1] A130 <-> E130 [1..*]; - association [1..*] B130 -> C130 [0..1]; - association [1] C130 <-> D130 [1..*]; - association [*] E130 <- C130 [0..1]; - association [1] E130 -> D130 [1..*]; - - - enum G131 {e11, e12, e13;} - - abstract class A131 { - String s; - } - - class B131 extends A131 { - E131 e; - } - - class C131 { - B131 b131; - } - - class D131 extends A131 { - String s; - } - - class E131 { - Double d; - } - - association [1] A131 <-> E131 [1..*]; - association [1..*] B131 -> C131 [0..1]; - association [1] C131 <-> D131 [1..*]; - association [*] E131 <- C131 [0..1]; - association [1] E131 -> D131 [1..*]; - - - enum G132 {e11, e12, e13;} - - abstract class A132 { - String s; - } - - class B132 extends A132 { - E132 e; - } - - class C132 { - B132 b132; - } - - class D132 extends A132 { - String s; - } - - class E132 { - Double d; - } - - association [1] A132 <-> E132 [1..*]; - association [1..*] B132 -> C132 [0..1]; - association [1] C132 <-> D132 [1..*]; - association [*] E132 <- C132 [0..1]; - association [1] E132 -> D132 [1..*]; - - - enum G133 {e11, e12, e13;} - - abstract class A133 { - String s; - } - - class B133 extends A133 { - E133 e; - } - - class C133 { - B133 b133; - } - - class D133 extends A133 { - String s; - } - - class E133 { - Double d; - } - - association [1] A133 <-> E133 [1..*]; - association [1..*] B133 -> C133 [0..1]; - association [1] C133 <-> D133 [1..*]; - association [*] E133 <- C133 [0..1]; - association [1] E133 -> D133 [1..*]; - - - enum G134 {e11, e12, e13;} - - abstract class A134 { - String s; - } - - class B134 extends A134 { - E134 e; - } - - class C134 { - B134 b134; - } - - class D134 extends A134 { - String s; - } - - class E134 { - Double d; - } - - association [1] A134 <-> E134 [1..*]; - association [1..*] B134 -> C134 [0..1]; - association [1] C134 <-> D134 [1..*]; - association [*] E134 <- C134 [0..1]; - association [1] E134 -> D134 [1..*]; - - - enum G135 {e11, e12, e13;} - - abstract class A135 { - String s; - } - - class B135 extends A135 { - E135 e; - } - - class C135 { - B135 b135; - } - - class D135 extends A135 { - String s; - } - - class E135 { - Double d; - } - - association [1] A135 <-> E135 [1..*]; - association [1..*] B135 -> C135 [0..1]; - association [1] C135 <-> D135 [1..*]; - association [*] E135 <- C135 [0..1]; - association [1] E135 -> D135 [1..*]; - - - enum G136 {e11, e12, e13;} - - abstract class A136 { - String s; - } - - class B136 extends A136 { - E136 e; - } - - class C136 { - B136 b136; - } - - class D136 extends A136 { - String s; - } - - class E136 { - Double d; - } - - association [1] A136 <-> E136 [1..*]; - association [1..*] B136 -> C136 [0..1]; - association [1] C136 <-> D136 [1..*]; - association [*] E136 <- C136 [0..1]; - association [1] E136 -> D136 [1..*]; - - - enum G137 {e11, e12, e13;} - - abstract class A137 { - String s; - } - - class B137 extends A137 { - E137 e; - } - - class C137 { - B137 b137; - } - - class D137 extends A137 { - String s; - } - - class E137 { - Double d; - } - - association [1] A137 <-> E137 [1..*]; - association [1..*] B137 -> C137 [0..1]; - association [1] C137 <-> D137 [1..*]; - association [*] E137 <- C137 [0..1]; - association [1] E137 -> D137 [1..*]; - - - enum G138 {e11, e12, e13;} - - abstract class A138 { - String s; - } - - class B138 extends A138 { - E138 e; - } - - class C138 { - B138 b138; - } - - class D138 extends A138 { - String s; - } - - class E138 { - Double d; - } - - association [1] A138 <-> E138 [1..*]; - association [1..*] B138 -> C138 [0..1]; - association [1] C138 <-> D138 [1..*]; - association [*] E138 <- C138 [0..1]; - association [1] E138 -> D138 [1..*]; - - - enum G139 {e11, e12, e13;} - - abstract class A139 { - String s; - } - - class B139 extends A139 { - E139 e; - } - - class C139 { - B139 b139; - } - - class D139 extends A139 { - String s; - } - - class E139 { - Double d; - } - - association [1] A139 <-> E139 [1..*]; - association [1..*] B139 -> C139 [0..1]; - association [1] C139 <-> D139 [1..*]; - association [*] E139 <- C139 [0..1]; - association [1] E139 -> D139 [1..*]; - - - enum G140 {e11, e12, e13;} - - abstract class A140 { - String s; - } - - class B140 extends A140 { - E140 e; - } - - class C140 { - B140 b140; - } - - class D140 extends A140 { - String s; - } - - class E140 { - Double d; - } - - association [1] A140 <-> E140 [1..*]; - association [1..*] B140 -> C140 [0..1]; - association [1] C140 <-> D140 [1..*]; - association [*] E140 <- C140 [0..1]; - association [1] E140 -> D140 [1..*]; - - - enum G141 {e11, e12, e13;} - - abstract class A141 { - String s; - } - - class B141 extends A141 { - E141 e; - } - - class C141 { - B141 b141; - } - - class D141 extends A141 { - String s; - } - - class E141 { - Double d; - } - - association [1] A141 <-> E141 [1..*]; - association [1..*] B141 -> C141 [0..1]; - association [1] C141 <-> D141 [1..*]; - association [*] E141 <- C141 [0..1]; - association [1] E141 -> D141 [1..*]; - - - enum G142 {e11, e12, e13;} - - abstract class A142 { - String s; - } - - class B142 extends A142 { - E142 e; - } - - class C142 { - B142 b142; - } - - class D142 extends A142 { - String s; - } - - class E142 { - Double d; - } - - association [1] A142 <-> E142 [1..*]; - association [1..*] B142 -> C142 [0..1]; - association [1] C142 <-> D142 [1..*]; - association [*] E142 <- C142 [0..1]; - association [1] E142 -> D142 [1..*]; - - - enum G143 {e11, e12, e13;} - - abstract class A143 { - String s; - } - - class B143 extends A143 { - E143 e; - } - - class C143 { - B143 b143; - } - - class D143 extends A143 { - String s; - } - - class E143 { - Double d; - } - - association [1] A143 <-> E143 [1..*]; - association [1..*] B143 -> C143 [0..1]; - association [1] C143 <-> D143 [1..*]; - association [*] E143 <- C143 [0..1]; - association [1] E143 -> D143 [1..*]; - - - enum G144 {e11, e12, e13;} - - abstract class A144 { - String s; - } - - class B144 extends A144 { - E144 e; - } - - class C144 { - B144 b144; - } - - class D144 extends A144 { - String s; - } - - class E144 { - Double d; - } - - association [1] A144 <-> E144 [1..*]; - association [1..*] B144 -> C144 [0..1]; - association [1] C144 <-> D144 [1..*]; - association [*] E144 <- C144 [0..1]; - association [1] E144 -> D144 [1..*]; - - - enum G145 {e11, e12, e13;} - - abstract class A145 { - String s; - } - - class B145 extends A145 { - E145 e; - } - - class C145 { - B145 b145; - } - - class D145 extends A145 { - String s; - } - - class E145 { - Double d; - } - - association [1] A145 <-> E145 [1..*]; - association [1..*] B145 -> C145 [0..1]; - association [1] C145 <-> D145 [1..*]; - association [*] E145 <- C145 [0..1]; - association [1] E145 -> D145 [1..*]; - - - enum G146 {e11, e12, e13;} - - abstract class A146 { - String s; - } - - class B146 extends A146 { - E146 e; - } - - class C146 { - B146 b146; - } - - class D146 extends A146 { - String s; - } - - class E146 { - Double d; - } - - association [1] A146 <-> E146 [1..*]; - association [1..*] B146 -> C146 [0..1]; - association [1] C146 <-> D146 [1..*]; - association [*] E146 <- C146 [0..1]; - association [1] E146 -> D146 [1..*]; - - - enum G147 {e11, e12, e13;} - - abstract class A147 { - String s; - } - - class B147 extends A147 { - E147 e; - } - - class C147 { - B147 b147; - } - - class D147 extends A147 { - String s; - } - - class E147 { - Double d; - } - - association [1] A147 <-> E147 [1..*]; - association [1..*] B147 -> C147 [0..1]; - association [1] C147 <-> D147 [1..*]; - association [*] E147 <- C147 [0..1]; - association [1] E147 -> D147 [1..*]; - - - enum G148 {e11, e12, e13;} - - abstract class A148 { - String s; - } - - class B148 extends A148 { - E148 e; - } - - class C148 { - B148 b148; - } - - class D148 extends A148 { - String s; - } - - class E148 { - Double d; - } - - association [1] A148 <-> E148 [1..*]; - association [1..*] B148 -> C148 [0..1]; - association [1] C148 <-> D148 [1..*]; - association [*] E148 <- C148 [0..1]; - association [1] E148 -> D148 [1..*]; - - - enum G149 {e11, e12, e13;} - - abstract class A149 { - String s; - } - - class B149 extends A149 { - E149 e; - } - - class C149 { - B149 b149; - } - - class D149 extends A149 { - String s; - } - - class E149 { - Double d; - } - - association [1] A149 <-> E149 [1..*]; - association [1..*] B149 -> C149 [0..1]; - association [1] C149 <-> D149 [1..*]; - association [*] E149 <- C149 [0..1]; - association [1] E149 -> D149 [1..*]; - - - enum G150 {e11, e12, e13;} - - abstract class A150 { - String s; - } - - class B150 extends A150 { - E150 e; - } - - class C150 { - B150 b150; - } - - class D150 extends A150 { - String s; - } - - class E150 { - Double d; - } - - association [1] A150 <-> E150 [1..*]; - association [1..*] B150 -> C150 [0..1]; - association [1] C150 <-> D150 [1..*]; - association [*] E150 <- C150 [0..1]; - association [1] E150 -> D150 [1..*]; - - - enum G151 {e11, e12, e13;} - - abstract class A151 { - String s; - } - - class B151 extends A151 { - E151 e; - } - - class C151 { - B151 b151; - } - - class D151 extends A151 { - String s; - } - - class E151 { - Double d; - } - - association [1] A151 <-> E151 [1..*]; - association [1..*] B151 -> C151 [0..1]; - association [1] C151 <-> D151 [1..*]; - association [*] E151 <- C151 [0..1]; - association [1] E151 -> D151 [1..*]; - - - enum G152 {e11, e12, e13;} - - abstract class A152 { - String s; - } - - class B152 extends A152 { - E152 e; - } - - class C152 { - B152 b152; - } - - class D152 extends A152 { - String s; - } - - class E152 { - Double d; - } - - association [1] A152 <-> E152 [1..*]; - association [1..*] B152 -> C152 [0..1]; - association [1] C152 <-> D152 [1..*]; - association [*] E152 <- C152 [0..1]; - association [1] E152 -> D152 [1..*]; - - - enum G153 {e11, e12, e13;} - - abstract class A153 { - String s; - } - - class B153 extends A153 { - E153 e; - } - - class C153 { - B153 b153; - } - - class D153 extends A153 { - String s; - } - - class E153 { - Double d; - } - - association [1] A153 <-> E153 [1..*]; - association [1..*] B153 -> C153 [0..1]; - association [1] C153 <-> D153 [1..*]; - association [*] E153 <- C153 [0..1]; - association [1] E153 -> D153 [1..*]; - - - enum G154 {e11, e12, e13;} - - abstract class A154 { - String s; - } - - class B154 extends A154 { - E154 e; - } - - class C154 { - B154 b154; - } - - class D154 extends A154 { - String s; - } - - class E154 { - Double d; - } - - association [1] A154 <-> E154 [1..*]; - association [1..*] B154 -> C154 [0..1]; - association [1] C154 <-> D154 [1..*]; - association [*] E154 <- C154 [0..1]; - association [1] E154 -> D154 [1..*]; - - - enum G155 {e11, e12, e13;} - - abstract class A155 { - String s; - } - - class B155 extends A155 { - E155 e; - } - - class C155 { - B155 b155; - } - - class D155 extends A155 { - String s; - } - - class E155 { - Double d; - } - - association [1] A155 <-> E155 [1..*]; - association [1..*] B155 -> C155 [0..1]; - association [1] C155 <-> D155 [1..*]; - association [*] E155 <- C155 [0..1]; - association [1] E155 -> D155 [1..*]; - - - enum G156 {e11, e12, e13;} - - abstract class A156 { - String s; - } - - class B156 extends A156 { - E156 e; - } - - class C156 { - B156 b156; - } - - class D156 extends A156 { - String s; - } - - class E156 { - Double d; - } - - association [1] A156 <-> E156 [1..*]; - association [1..*] B156 -> C156 [0..1]; - association [1] C156 <-> D156 [1..*]; - association [*] E156 <- C156 [0..1]; - association [1] E156 -> D156 [1..*]; - - - enum G157 {e11, e12, e13;} - - abstract class A157 { - String s; - } - - class B157 extends A157 { - E157 e; - } - - class C157 { - B157 b157; - } - - class D157 extends A157 { - String s; - } - - class E157 { - Double d; - } - - association [1] A157 <-> E157 [1..*]; - association [1..*] B157 -> C157 [0..1]; - association [1] C157 <-> D157 [1..*]; - association [*] E157 <- C157 [0..1]; - association [1] E157 -> D157 [1..*]; - - - enum G158 {e11, e12, e13;} - - abstract class A158 { - String s; - } - - class B158 extends A158 { - E158 e; - } - - class C158 { - B158 b158; - } - - class D158 extends A158 { - String s; - } - - class E158 { - Double d; - } - - association [1] A158 <-> E158 [1..*]; - association [1..*] B158 -> C158 [0..1]; - association [1] C158 <-> D158 [1..*]; - association [*] E158 <- C158 [0..1]; - association [1] E158 -> D158 [1..*]; - - - enum G159 {e11, e12, e13;} - - abstract class A159 { - String s; - } - - class B159 extends A159 { - E159 e; - } - - class C159 { - B159 b159; - } - - class D159 extends A159 { - String s; - } - - class E159 { - Double d; - } - - association [1] A159 <-> E159 [1..*]; - association [1..*] B159 -> C159 [0..1]; - association [1] C159 <-> D159 [1..*]; - association [*] E159 <- C159 [0..1]; - association [1] E159 -> D159 [1..*]; - - - enum G160 {e11, e12, e13;} - - abstract class A160 { - String s; - } - - class B160 extends A160 { - E160 e; - } - - class C160 { - B160 b160; - } - - class D160 extends A160 { - String s; - } - - class E160 { - Double d; - } - - association [1] A160 <-> E160 [1..*]; - association [1..*] B160 -> C160 [0..1]; - association [1] C160 <-> D160 [1..*]; - association [*] E160 <- C160 [0..1]; - association [1] E160 -> D160 [1..*]; - - - enum G161 {e11, e12, e13;} - - abstract class A161 { - String s; - } - - class B161 extends A161 { - E161 e; - } - - class C161 { - B161 b161; - } - - class D161 extends A161 { - String s; - } - - class E161 { - Double d; - } - - association [1] A161 <-> E161 [1..*]; - association [1..*] B161 -> C161 [0..1]; - association [1] C161 <-> D161 [1..*]; - association [*] E161 <- C161 [0..1]; - association [1] E161 -> D161 [1..*]; - - - enum G162 {e11, e12, e13;} - - abstract class A162 { - String s; - } - - class B162 extends A162 { - E162 e; - } - - class C162 { - B162 b162; - } - - class D162 extends A162 { - String s; - } - - class E162 { - Double d; - } - - association [1] A162 <-> E162 [1..*]; - association [1..*] B162 -> C162 [0..1]; - association [1] C162 <-> D162 [1..*]; - association [*] E162 <- C162 [0..1]; - association [1] E162 -> D162 [1..*]; - - - enum G163 {e11, e12, e13;} - - abstract class A163 { - String s; - } - - class B163 extends A163 { - E163 e; - } - - class C163 { - B163 b163; - } - - class D163 extends A163 { - String s; - } - - class E163 { - Double d; - } - - association [1] A163 <-> E163 [1..*]; - association [1..*] B163 -> C163 [0..1]; - association [1] C163 <-> D163 [1..*]; - association [*] E163 <- C163 [0..1]; - association [1] E163 -> D163 [1..*]; - - - enum G164 {e11, e12, e13;} - - abstract class A164 { - String s; - } - - class B164 extends A164 { - E164 e; - } - - class C164 { - B164 b164; - } - - class D164 extends A164 { - String s; - } - - class E164 { - Double d; - } - - association [1] A164 <-> E164 [1..*]; - association [1..*] B164 -> C164 [0..1]; - association [1] C164 <-> D164 [1..*]; - association [*] E164 <- C164 [0..1]; - association [1] E164 -> D164 [1..*]; - - - enum G165 {e11, e12, e13;} - - abstract class A165 { - String s; - } - - class B165 extends A165 { - E165 e; - } - - class C165 { - B165 b165; - } - - class D165 extends A165 { - String s; - } - - class E165 { - Double d; - } - - association [1] A165 <-> E165 [1..*]; - association [1..*] B165 -> C165 [0..1]; - association [1] C165 <-> D165 [1..*]; - association [*] E165 <- C165 [0..1]; - association [1] E165 -> D165 [1..*]; - - - enum G166 {e11, e12, e13;} - - abstract class A166 { - String s; - } - - class B166 extends A166 { - E166 e; - } - - class C166 { - B166 b166; - } - - class D166 extends A166 { - String s; - } - - class E166 { - Double d; - } - - association [1] A166 <-> E166 [1..*]; - association [1..*] B166 -> C166 [0..1]; - association [1] C166 <-> D166 [1..*]; - association [*] E166 <- C166 [0..1]; - association [1] E166 -> D166 [1..*]; - - - enum G167 {e11, e12, e13;} - - abstract class A167 { - String s; - } - - class B167 extends A167 { - E167 e; - } - - class C167 { - B167 b167; - } - - class D167 extends A167 { - String s; - } - - class E167 { - Double d; - } - - association [1] A167 <-> E167 [1..*]; - association [1..*] B167 -> C167 [0..1]; - association [1] C167 <-> D167 [1..*]; - association [*] E167 <- C167 [0..1]; - association [1] E167 -> D167 [1..*]; - - - enum G168 {e11, e12, e13;} - - abstract class A168 { - String s; - } - - class B168 extends A168 { - E168 e; - } - - class C168 { - B168 b168; - } - - class D168 extends A168 { - String s; - } - - class E168 { - Double d; - } - - association [1] A168 <-> E168 [1..*]; - association [1..*] B168 -> C168 [0..1]; - association [1] C168 <-> D168 [1..*]; - association [*] E168 <- C168 [0..1]; - association [1] E168 -> D168 [1..*]; - - - enum G169 {e11, e12, e13;} - - abstract class A169 { - String s; - } - - class B169 extends A169 { - E169 e; - } - - class C169 { - B169 b169; - } - - class D169 extends A169 { - String s; - } - - class E169 { - Double d; - } - - association [1] A169 <-> E169 [1..*]; - association [1..*] B169 -> C169 [0..1]; - association [1] C169 <-> D169 [1..*]; - association [*] E169 <- C169 [0..1]; - association [1] E169 -> D169 [1..*]; - - - enum G170 {e11, e12, e13;} - - abstract class A170 { - String s; - } - - class B170 extends A170 { - E170 e; - } - - class C170 { - B170 b170; - } - - class D170 extends A170 { - String s; - } - - class E170 { - Double d; - } - - association [1] A170 <-> E170 [1..*]; - association [1..*] B170 -> C170 [0..1]; - association [1] C170 <-> D170 [1..*]; - association [*] E170 <- C170 [0..1]; - association [1] E170 -> D170 [1..*]; - - - enum G171 {e11, e12, e13;} - - abstract class A171 { - String s; - } - - class B171 extends A171 { - E171 e; - } - - class C171 { - B171 b171; - } - - class D171 extends A171 { - String s; - } - - class E171 { - Double d; - } - - association [1] A171 <-> E171 [1..*]; - association [1..*] B171 -> C171 [0..1]; - association [1] C171 <-> D171 [1..*]; - association [*] E171 <- C171 [0..1]; - association [1] E171 -> D171 [1..*]; - - - enum G172 {e11, e12, e13;} - - abstract class A172 { - String s; - } - - class B172 extends A172 { - E172 e; - } - - class C172 { - B172 b172; - } - - class D172 extends A172 { - String s; - } - - class E172 { - Double d; - } - - association [1] A172 <-> E172 [1..*]; - association [1..*] B172 -> C172 [0..1]; - association [1] C172 <-> D172 [1..*]; - association [*] E172 <- C172 [0..1]; - association [1] E172 -> D172 [1..*]; - - - enum G173 {e11, e12, e13;} - - abstract class A173 { - String s; - } - - class B173 extends A173 { - E173 e; - } - - class C173 { - B173 b173; - } - - class D173 extends A173 { - String s; - } - - class E173 { - Double d; - } - - association [1] A173 <-> E173 [1..*]; - association [1..*] B173 -> C173 [0..1]; - association [1] C173 <-> D173 [1..*]; - association [*] E173 <- C173 [0..1]; - association [1] E173 -> D173 [1..*]; - - - enum G174 {e11, e12, e13;} - - abstract class A174 { - String s; - } - - class B174 extends A174 { - E174 e; - } - - class C174 { - B174 b174; - } - - class D174 extends A174 { - String s; - } - - class E174 { - Double d; - } - - association [1] A174 <-> E174 [1..*]; - association [1..*] B174 -> C174 [0..1]; - association [1] C174 <-> D174 [1..*]; - association [*] E174 <- C174 [0..1]; - association [1] E174 -> D174 [1..*]; - - - enum G175 {e11, e12, e13;} - - abstract class A175 { - String s; - } - - class B175 extends A175 { - E175 e; - } - - class C175 { - B175 b175; - } - - class D175 extends A175 { - String s; - } - - class E175 { - Double d; - } - - association [1] A175 <-> E175 [1..*]; - association [1..*] B175 -> C175 [0..1]; - association [1] C175 <-> D175 [1..*]; - association [*] E175 <- C175 [0..1]; - association [1] E175 -> D175 [1..*]; - - - enum G176 {e11, e12, e13;} - - abstract class A176 { - String s; - } - - class B176 extends A176 { - E176 e; - } - - class C176 { - B176 b176; - } - - class D176 extends A176 { - String s; - } - - class E176 { - Double d; - } - - association [1] A176 <-> E176 [1..*]; - association [1..*] B176 -> C176 [0..1]; - association [1] C176 <-> D176 [1..*]; - association [*] E176 <- C176 [0..1]; - association [1] E176 -> D176 [1..*]; - - - enum G177 {e11, e12, e13;} - - abstract class A177 { - String s; - } - - class B177 extends A177 { - E177 e; - } - - class C177 { - B177 b177; - } - - class D177 extends A177 { - String s; - } - - class E177 { - Double d; - } - - association [1] A177 <-> E177 [1..*]; - association [1..*] B177 -> C177 [0..1]; - association [1] C177 <-> D177 [1..*]; - association [*] E177 <- C177 [0..1]; - association [1] E177 -> D177 [1..*]; - - - enum G178 {e11, e12, e13;} - - abstract class A178 { - String s; - } - - class B178 extends A178 { - E178 e; - } - - class C178 { - B178 b178; - } - - class D178 extends A178 { - String s; - } - - class E178 { - Double d; - } - - association [1] A178 <-> E178 [1..*]; - association [1..*] B178 -> C178 [0..1]; - association [1] C178 <-> D178 [1..*]; - association [*] E178 <- C178 [0..1]; - association [1] E178 -> D178 [1..*]; - - - enum G179 {e11, e12, e13;} - - abstract class A179 { - String s; - } - - class B179 extends A179 { - E179 e; - } - - class C179 { - B179 b179; - } - - class D179 extends A179 { - String s; - } - - class E179 { - Double d; - } - - association [1] A179 <-> E179 [1..*]; - association [1..*] B179 -> C179 [0..1]; - association [1] C179 <-> D179 [1..*]; - association [*] E179 <- C179 [0..1]; - association [1] E179 -> D179 [1..*]; - } diff --git a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/900/CD2.cd b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/500/CD2.cd similarity index 54% rename from cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/900/CD2.cd rename to cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/500/CD2.cd index c8e2807b8..2ef264269 100644 --- a/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/900/CD2.cd +++ b/cddiff/src/test/resources/de/monticore/cddiff/syndiff/Performance/500/CD2.cd @@ -2801,2217 +2801,5 @@ classdiagram CD2 { association [1..*] E100 <-> C100 [*]; association [1] F100 <- D100 [1..*]; - - enum G101 {F11, F12;} - - class B101 { - F101 e; - } - - class C101 { - B101 b101; - } - - class D101 extends C101 { - } - - class E101 { - Integer i; - } - - class F101 extends B101 { - Double d; - } - - association [1] F101 <-> E101 [1..*]; - association [*] B101 -> C101 [0..1]; - association [1] C101 <-> D101 [1]; - association [1..*] E101 <-> C101 [*]; - association [1] F101 <- D101 [1..*]; - - - enum G102 {F11, F12;} - - class B102 { - F102 e; - } - - class C102 { - B102 b102; - } - - class D102 extends C102 { - } - - class E102 { - Integer i; - } - - class F102 extends B102 { - Double d; - } - - association [1] F102 <-> E102 [1..*]; - association [*] B102 -> C102 [0..1]; - association [1] C102 <-> D102 [1]; - association [1..*] E102 <-> C102 [*]; - association [1] F102 <- D102 [1..*]; - - - enum G103 {F11, F12;} - - class B103 { - F103 e; - } - - class C103 { - B103 b103; - } - - class D103 extends C103 { - } - - class E103 { - Integer i; - } - - class F103 extends B103 { - Double d; - } - - association [1] F103 <-> E103 [1..*]; - association [*] B103 -> C103 [0..1]; - association [1] C103 <-> D103 [1]; - association [1..*] E103 <-> C103 [*]; - association [1] F103 <- D103 [1..*]; - - - enum G104 {F11, F12;} - - class B104 { - F104 e; - } - - class C104 { - B104 b104; - } - - class D104 extends C104 { - } - - class E104 { - Integer i; - } - - class F104 extends B104 { - Double d; - } - - association [1] F104 <-> E104 [1..*]; - association [*] B104 -> C104 [0..1]; - association [1] C104 <-> D104 [1]; - association [1..*] E104 <-> C104 [*]; - association [1] F104 <- D104 [1..*]; - - - enum G105 {F11, F12;} - - class B105 { - F105 e; - } - - class C105 { - B105 b105; - } - - class D105 extends C105 { - } - - class E105 { - Integer i; - } - - class F105 extends B105 { - Double d; - } - - association [1] F105 <-> E105 [1..*]; - association [*] B105 -> C105 [0..1]; - association [1] C105 <-> D105 [1]; - association [1..*] E105 <-> C105 [*]; - association [1] F105 <- D105 [1..*]; - - - enum G106 {F11, F12;} - - class B106 { - F106 e; - } - - class C106 { - B106 b106; - } - - class D106 extends C106 { - } - - class E106 { - Integer i; - } - - class F106 extends B106 { - Double d; - } - - association [1] F106 <-> E106 [1..*]; - association [*] B106 -> C106 [0..1]; - association [1] C106 <-> D106 [1]; - association [1..*] E106 <-> C106 [*]; - association [1] F106 <- D106 [1..*]; - - - enum G107 {F11, F12;} - - class B107 { - F107 e; - } - - class C107 { - B107 b107; - } - - class D107 extends C107 { - } - - class E107 { - Integer i; - } - - class F107 extends B107 { - Double d; - } - - association [1] F107 <-> E107 [1..*]; - association [*] B107 -> C107 [0..1]; - association [1] C107 <-> D107 [1]; - association [1..*] E107 <-> C107 [*]; - association [1] F107 <- D107 [1..*]; - - - enum G108 {F11, F12;} - - class B108 { - F108 e; - } - - class C108 { - B108 b108; - } - - class D108 extends C108 { - } - - class E108 { - Integer i; - } - - class F108 extends B108 { - Double d; - } - - association [1] F108 <-> E108 [1..*]; - association [*] B108 -> C108 [0..1]; - association [1] C108 <-> D108 [1]; - association [1..*] E108 <-> C108 [*]; - association [1] F108 <- D108 [1..*]; - - - enum G109 {F11, F12;} - - class B109 { - F109 e; - } - - class C109 { - B109 b109; - } - - class D109 extends C109 { - } - - class E109 { - Integer i; - } - - class F109 extends B109 { - Double d; - } - - association [1] F109 <-> E109 [1..*]; - association [*] B109 -> C109 [0..1]; - association [1] C109 <-> D109 [1]; - association [1..*] E109 <-> C109 [*]; - association [1] F109 <- D109 [1..*]; - - - enum G110 {F11, F12;} - - class B110 { - F110 e; - } - - class C110 { - B110 b110; - } - - class D110 extends C110 { - } - - class E110 { - Integer i; - } - - class F110 extends B110 { - Double d; - } - - association [1] F110 <-> E110 [1..*]; - association [*] B110 -> C110 [0..1]; - association [1] C110 <-> D110 [1]; - association [1..*] E110 <-> C110 [*]; - association [1] F110 <- D110 [1..*]; - - - enum G111 {F11, F12;} - - class B111 { - F111 e; - } - - class C111 { - B111 b111; - } - - class D111 extends C111 { - } - - class E111 { - Integer i; - } - - class F111 extends B111 { - Double d; - } - - association [1] F111 <-> E111 [1..*]; - association [*] B111 -> C111 [0..1]; - association [1] C111 <-> D111 [1]; - association [1..*] E111 <-> C111 [*]; - association [1] F111 <- D111 [1..*]; - - - enum G112 {F11, F12;} - - class B112 { - F112 e; - } - - class C112 { - B112 b112; - } - - class D112 extends C112 { - } - - class E112 { - Integer i; - } - - class F112 extends B112 { - Double d; - } - - association [1] F112 <-> E112 [1..*]; - association [*] B112 -> C112 [0..1]; - association [1] C112 <-> D112 [1]; - association [1..*] E112 <-> C112 [*]; - association [1] F112 <- D112 [1..*]; - - - enum G113 {F11, F12;} - - class B113 { - F113 e; - } - - class C113 { - B113 b113; - } - - class D113 extends C113 { - } - - class E113 { - Integer i; - } - - class F113 extends B113 { - Double d; - } - - association [1] F113 <-> E113 [1..*]; - association [*] B113 -> C113 [0..1]; - association [1] C113 <-> D113 [1]; - association [1..*] E113 <-> C113 [*]; - association [1] F113 <- D113 [1..*]; - - - enum G114 {F11, F12;} - - class B114 { - F114 e; - } - - class C114 { - B114 b114; - } - - class D114 extends C114 { - } - - class E114 { - Integer i; - } - - class F114 extends B114 { - Double d; - } - - association [1] F114 <-> E114 [1..*]; - association [*] B114 -> C114 [0..1]; - association [1] C114 <-> D114 [1]; - association [1..*] E114 <-> C114 [*]; - association [1] F114 <- D114 [1..*]; - - - enum G115 {F11, F12;} - - class B115 { - F115 e; - } - - class C115 { - B115 b115; - } - - class D115 extends C115 { - } - - class E115 { - Integer i; - } - - class F115 extends B115 { - Double d; - } - - association [1] F115 <-> E115 [1..*]; - association [*] B115 -> C115 [0..1]; - association [1] C115 <-> D115 [1]; - association [1..*] E115 <-> C115 [*]; - association [1] F115 <- D115 [1..*]; - - - enum G116 {F11, F12;} - - class B116 { - F116 e; - } - - class C116 { - B116 b116; - } - - class D116 extends C116 { - } - - class E116 { - Integer i; - } - - class F116 extends B116 { - Double d; - } - - association [1] F116 <-> E116 [1..*]; - association [*] B116 -> C116 [0..1]; - association [1] C116 <-> D116 [1]; - association [1..*] E116 <-> C116 [*]; - association [1] F116 <- D116 [1..*]; - - - enum G117 {F11, F12;} - - class B117 { - F117 e; - } - - class C117 { - B117 b117; - } - - class D117 extends C117 { - } - - class E117 { - Integer i; - } - - class F117 extends B117 { - Double d; - } - - association [1] F117 <-> E117 [1..*]; - association [*] B117 -> C117 [0..1]; - association [1] C117 <-> D117 [1]; - association [1..*] E117 <-> C117 [*]; - association [1] F117 <- D117 [1..*]; - - - enum G118 {F11, F12;} - - class B118 { - F118 e; - } - - class C118 { - B118 b118; - } - - class D118 extends C118 { - } - - class E118 { - Integer i; - } - - class F118 extends B118 { - Double d; - } - - association [1] F118 <-> E118 [1..*]; - association [*] B118 -> C118 [0..1]; - association [1] C118 <-> D118 [1]; - association [1..*] E118 <-> C118 [*]; - association [1] F118 <- D118 [1..*]; - - - enum G119 {F11, F12;} - - class B119 { - F119 e; - } - - class C119 { - B119 b119; - } - - class D119 extends C119 { - } - - class E119 { - Integer i; - } - - class F119 extends B119 { - Double d; - } - - association [1] F119 <-> E119 [1..*]; - association [*] B119 -> C119 [0..1]; - association [1] C119 <-> D119 [1]; - association [1..*] E119 <-> C119 [*]; - association [1] F119 <- D119 [1..*]; - - - enum G120 {F11, F12;} - - class B120 { - F120 e; - } - - class C120 { - B120 b120; - } - - class D120 extends C120 { - } - - class E120 { - Integer i; - } - - class F120 extends B120 { - Double d; - } - - association [1] F120 <-> E120 [1..*]; - association [*] B120 -> C120 [0..1]; - association [1] C120 <-> D120 [1]; - association [1..*] E120 <-> C120 [*]; - association [1] F120 <- D120 [1..*]; - - - enum G121 {F11, F12;} - - class B121 { - F121 e; - } - - class C121 { - B121 b121; - } - - class D121 extends C121 { - } - - class E121 { - Integer i; - } - - class F121 extends B121 { - Double d; - } - - association [1] F121 <-> E121 [1..*]; - association [*] B121 -> C121 [0..1]; - association [1] C121 <-> D121 [1]; - association [1..*] E121 <-> C121 [*]; - association [1] F121 <- D121 [1..*]; - - - enum G122 {F11, F12;} - - class B122 { - F122 e; - } - - class C122 { - B122 b122; - } - - class D122 extends C122 { - } - - class E122 { - Integer i; - } - - class F122 extends B122 { - Double d; - } - - association [1] F122 <-> E122 [1..*]; - association [*] B122 -> C122 [0..1]; - association [1] C122 <-> D122 [1]; - association [1..*] E122 <-> C122 [*]; - association [1] F122 <- D122 [1..*]; - - - enum G123 {F11, F12;} - - class B123 { - F123 e; - } - - class C123 { - B123 b123; - } - - class D123 extends C123 { - } - - class E123 { - Integer i; - } - - class F123 extends B123 { - Double d; - } - - association [1] F123 <-> E123 [1..*]; - association [*] B123 -> C123 [0..1]; - association [1] C123 <-> D123 [1]; - association [1..*] E123 <-> C123 [*]; - association [1] F123 <- D123 [1..*]; - - - enum G124 {F11, F12;} - - class B124 { - F124 e; - } - - class C124 { - B124 b124; - } - - class D124 extends C124 { - } - - class E124 { - Integer i; - } - - class F124 extends B124 { - Double d; - } - - association [1] F124 <-> E124 [1..*]; - association [*] B124 -> C124 [0..1]; - association [1] C124 <-> D124 [1]; - association [1..*] E124 <-> C124 [*]; - association [1] F124 <- D124 [1..*]; - - - enum G125 {F11, F12;} - - class B125 { - F125 e; - } - - class C125 { - B125 b125; - } - - class D125 extends C125 { - } - - class E125 { - Integer i; - } - - class F125 extends B125 { - Double d; - } - - association [1] F125 <-> E125 [1..*]; - association [*] B125 -> C125 [0..1]; - association [1] C125 <-> D125 [1]; - association [1..*] E125 <-> C125 [*]; - association [1] F125 <- D125 [1..*]; - - - enum G126 {F11, F12;} - - class B126 { - F126 e; - } - - class C126 { - B126 b126; - } - - class D126 extends C126 { - } - - class E126 { - Integer i; - } - - class F126 extends B126 { - Double d; - } - - association [1] F126 <-> E126 [1..*]; - association [*] B126 -> C126 [0..1]; - association [1] C126 <-> D126 [1]; - association [1..*] E126 <-> C126 [*]; - association [1] F126 <- D126 [1..*]; - - - enum G127 {F11, F12;} - - class B127 { - F127 e; - } - - class C127 { - B127 b127; - } - - class D127 extends C127 { - } - - class E127 { - Integer i; - } - - class F127 extends B127 { - Double d; - } - - association [1] F127 <-> E127 [1..*]; - association [*] B127 -> C127 [0..1]; - association [1] C127 <-> D127 [1]; - association [1..*] E127 <-> C127 [*]; - association [1] F127 <- D127 [1..*]; - - - enum G128 {F11, F12;} - - class B128 { - F128 e; - } - - class C128 { - B128 b128; - } - - class D128 extends C128 { - } - - class E128 { - Integer i; - } - - class F128 extends B128 { - Double d; - } - - association [1] F128 <-> E128 [1..*]; - association [*] B128 -> C128 [0..1]; - association [1] C128 <-> D128 [1]; - association [1..*] E128 <-> C128 [*]; - association [1] F128 <- D128 [1..*]; - - - enum G129 {F11, F12;} - - class B129 { - F129 e; - } - - class C129 { - B129 b129; - } - - class D129 extends C129 { - } - - class E129 { - Integer i; - } - - class F129 extends B129 { - Double d; - } - - association [1] F129 <-> E129 [1..*]; - association [*] B129 -> C129 [0..1]; - association [1] C129 <-> D129 [1]; - association [1..*] E129 <-> C129 [*]; - association [1] F129 <- D129 [1..*]; - - - enum G130 {F11, F12;} - - class B130 { - F130 e; - } - - class C130 { - B130 b130; - } - - class D130 extends C130 { - } - - class E130 { - Integer i; - } - - class F130 extends B130 { - Double d; - } - - association [1] F130 <-> E130 [1..*]; - association [*] B130 -> C130 [0..1]; - association [1] C130 <-> D130 [1]; - association [1..*] E130 <-> C130 [*]; - association [1] F130 <- D130 [1..*]; - - - enum G131 {F11, F12;} - - class B131 { - F131 e; - } - - class C131 { - B131 b131; - } - - class D131 extends C131 { - } - - class E131 { - Integer i; - } - - class F131 extends B131 { - Double d; - } - - association [1] F131 <-> E131 [1..*]; - association [*] B131 -> C131 [0..1]; - association [1] C131 <-> D131 [1]; - association [1..*] E131 <-> C131 [*]; - association [1] F131 <- D131 [1..*]; - - - enum G132 {F11, F12;} - - class B132 { - F132 e; - } - - class C132 { - B132 b132; - } - - class D132 extends C132 { - } - - class E132 { - Integer i; - } - - class F132 extends B132 { - Double d; - } - - association [1] F132 <-> E132 [1..*]; - association [*] B132 -> C132 [0..1]; - association [1] C132 <-> D132 [1]; - association [1..*] E132 <-> C132 [*]; - association [1] F132 <- D132 [1..*]; - - - enum G133 {F11, F12;} - - class B133 { - F133 e; - } - - class C133 { - B133 b133; - } - - class D133 extends C133 { - } - - class E133 { - Integer i; - } - - class F133 extends B133 { - Double d; - } - - association [1] F133 <-> E133 [1..*]; - association [*] B133 -> C133 [0..1]; - association [1] C133 <-> D133 [1]; - association [1..*] E133 <-> C133 [*]; - association [1] F133 <- D133 [1..*]; - - - enum G134 {F11, F12;} - - class B134 { - F134 e; - } - - class C134 { - B134 b134; - } - - class D134 extends C134 { - } - - class E134 { - Integer i; - } - - class F134 extends B134 { - Double d; - } - - association [1] F134 <-> E134 [1..*]; - association [*] B134 -> C134 [0..1]; - association [1] C134 <-> D134 [1]; - association [1..*] E134 <-> C134 [*]; - association [1] F134 <- D134 [1..*]; - - - enum G135 {F11, F12;} - - class B135 { - F135 e; - } - - class C135 { - B135 b135; - } - - class D135 extends C135 { - } - - class E135 { - Integer i; - } - - class F135 extends B135 { - Double d; - } - - association [1] F135 <-> E135 [1..*]; - association [*] B135 -> C135 [0..1]; - association [1] C135 <-> D135 [1]; - association [1..*] E135 <-> C135 [*]; - association [1] F135 <- D135 [1..*]; - - - enum G136 {F11, F12;} - - class B136 { - F136 e; - } - - class C136 { - B136 b136; - } - - class D136 extends C136 { - } - - class E136 { - Integer i; - } - - class F136 extends B136 { - Double d; - } - - association [1] F136 <-> E136 [1..*]; - association [*] B136 -> C136 [0..1]; - association [1] C136 <-> D136 [1]; - association [1..*] E136 <-> C136 [*]; - association [1] F136 <- D136 [1..*]; - - - enum G137 {F11, F12;} - - class B137 { - F137 e; - } - - class C137 { - B137 b137; - } - - class D137 extends C137 { - } - - class E137 { - Integer i; - } - - class F137 extends B137 { - Double d; - } - - association [1] F137 <-> E137 [1..*]; - association [*] B137 -> C137 [0..1]; - association [1] C137 <-> D137 [1]; - association [1..*] E137 <-> C137 [*]; - association [1] F137 <- D137 [1..*]; - - - enum G138 {F11, F12;} - - class B138 { - F138 e; - } - - class C138 { - B138 b138; - } - - class D138 extends C138 { - } - - class E138 { - Integer i; - } - - class F138 extends B138 { - Double d; - } - - association [1] F138 <-> E138 [1..*]; - association [*] B138 -> C138 [0..1]; - association [1] C138 <-> D138 [1]; - association [1..*] E138 <-> C138 [*]; - association [1] F138 <- D138 [1..*]; - - - enum G139 {F11, F12;} - - class B139 { - F139 e; - } - - class C139 { - B139 b139; - } - - class D139 extends C139 { - } - - class E139 { - Integer i; - } - - class F139 extends B139 { - Double d; - } - - association [1] F139 <-> E139 [1..*]; - association [*] B139 -> C139 [0..1]; - association [1] C139 <-> D139 [1]; - association [1..*] E139 <-> C139 [*]; - association [1] F139 <- D139 [1..*]; - - - enum G140 {F11, F12;} - - class B140 { - F140 e; - } - - class C140 { - B140 b140; - } - - class D140 extends C140 { - } - - class E140 { - Integer i; - } - - class F140 extends B140 { - Double d; - } - - association [1] F140 <-> E140 [1..*]; - association [*] B140 -> C140 [0..1]; - association [1] C140 <-> D140 [1]; - association [1..*] E140 <-> C140 [*]; - association [1] F140 <- D140 [1..*]; - - - enum G141 {F11, F12;} - - class B141 { - F141 e; - } - - class C141 { - B141 b141; - } - - class D141 extends C141 { - } - - class E141 { - Integer i; - } - - class F141 extends B141 { - Double d; - } - - association [1] F141 <-> E141 [1..*]; - association [*] B141 -> C141 [0..1]; - association [1] C141 <-> D141 [1]; - association [1..*] E141 <-> C141 [*]; - association [1] F141 <- D141 [1..*]; - - - enum G142 {F11, F12;} - - class B142 { - F142 e; - } - - class C142 { - B142 b142; - } - - class D142 extends C142 { - } - - class E142 { - Integer i; - } - - class F142 extends B142 { - Double d; - } - - association [1] F142 <-> E142 [1..*]; - association [*] B142 -> C142 [0..1]; - association [1] C142 <-> D142 [1]; - association [1..*] E142 <-> C142 [*]; - association [1] F142 <- D142 [1..*]; - - - enum G143 {F11, F12;} - - class B143 { - F143 e; - } - - class C143 { - B143 b143; - } - - class D143 extends C143 { - } - - class E143 { - Integer i; - } - - class F143 extends B143 { - Double d; - } - - association [1] F143 <-> E143 [1..*]; - association [*] B143 -> C143 [0..1]; - association [1] C143 <-> D143 [1]; - association [1..*] E143 <-> C143 [*]; - association [1] F143 <- D143 [1..*]; - - - enum G144 {F11, F12;} - - class B144 { - F144 e; - } - - class C144 { - B144 b144; - } - - class D144 extends C144 { - } - - class E144 { - Integer i; - } - - class F144 extends B144 { - Double d; - } - - association [1] F144 <-> E144 [1..*]; - association [*] B144 -> C144 [0..1]; - association [1] C144 <-> D144 [1]; - association [1..*] E144 <-> C144 [*]; - association [1] F144 <- D144 [1..*]; - - - enum G145 {F11, F12;} - - class B145 { - F145 e; - } - - class C145 { - B145 b145; - } - - class D145 extends C145 { - } - - class E145 { - Integer i; - } - - class F145 extends B145 { - Double d; - } - - association [1] F145 <-> E145 [1..*]; - association [*] B145 -> C145 [0..1]; - association [1] C145 <-> D145 [1]; - association [1..*] E145 <-> C145 [*]; - association [1] F145 <- D145 [1..*]; - - - enum G146 {F11, F12;} - - class B146 { - F146 e; - } - - class C146 { - B146 b146; - } - - class D146 extends C146 { - } - - class E146 { - Integer i; - } - - class F146 extends B146 { - Double d; - } - - association [1] F146 <-> E146 [1..*]; - association [*] B146 -> C146 [0..1]; - association [1] C146 <-> D146 [1]; - association [1..*] E146 <-> C146 [*]; - association [1] F146 <- D146 [1..*]; - - - enum G147 {F11, F12;} - - class B147 { - F147 e; - } - - class C147 { - B147 b147; - } - - class D147 extends C147 { - } - - class E147 { - Integer i; - } - - class F147 extends B147 { - Double d; - } - - association [1] F147 <-> E147 [1..*]; - association [*] B147 -> C147 [0..1]; - association [1] C147 <-> D147 [1]; - association [1..*] E147 <-> C147 [*]; - association [1] F147 <- D147 [1..*]; - - - enum G148 {F11, F12;} - - class B148 { - F148 e; - } - - class C148 { - B148 b148; - } - - class D148 extends C148 { - } - - class E148 { - Integer i; - } - - class F148 extends B148 { - Double d; - } - - association [1] F148 <-> E148 [1..*]; - association [*] B148 -> C148 [0..1]; - association [1] C148 <-> D148 [1]; - association [1..*] E148 <-> C148 [*]; - association [1] F148 <- D148 [1..*]; - - - enum G149 {F11, F12;} - - class B149 { - F149 e; - } - - class C149 { - B149 b149; - } - - class D149 extends C149 { - } - - class E149 { - Integer i; - } - - class F149 extends B149 { - Double d; - } - - association [1] F149 <-> E149 [1..*]; - association [*] B149 -> C149 [0..1]; - association [1] C149 <-> D149 [1]; - association [1..*] E149 <-> C149 [*]; - association [1] F149 <- D149 [1..*]; - - - enum G150 {F11, F12;} - - class B150 { - F150 e; - } - - class C150 { - B150 b150; - } - - class D150 extends C150 { - } - - class E150 { - Integer i; - } - - class F150 extends B150 { - Double d; - } - - association [1] F150 <-> E150 [1..*]; - association [*] B150 -> C150 [0..1]; - association [1] C150 <-> D150 [1]; - association [1..*] E150 <-> C150 [*]; - association [1] F150 <- D150 [1..*]; - - - enum G151 {F11, F12;} - - class B151 { - F151 e; - } - - class C151 { - B151 b151; - } - - class D151 extends C151 { - } - - class E151 { - Integer i; - } - - class F151 extends B151 { - Double d; - } - - association [1] F151 <-> E151 [1..*]; - association [*] B151 -> C151 [0..1]; - association [1] C151 <-> D151 [1]; - association [1..*] E151 <-> C151 [*]; - association [1] F151 <- D151 [1..*]; - - - enum G152 {F11, F12;} - - class B152 { - F152 e; - } - - class C152 { - B152 b152; - } - - class D152 extends C152 { - } - - class E152 { - Integer i; - } - - class F152 extends B152 { - Double d; - } - - association [1] F152 <-> E152 [1..*]; - association [*] B152 -> C152 [0..1]; - association [1] C152 <-> D152 [1]; - association [1..*] E152 <-> C152 [*]; - association [1] F152 <- D152 [1..*]; - - - enum G153 {F11, F12;} - - class B153 { - F153 e; - } - - class C153 { - B153 b153; - } - - class D153 extends C153 { - } - - class E153 { - Integer i; - } - - class F153 extends B153 { - Double d; - } - - association [1] F153 <-> E153 [1..*]; - association [*] B153 -> C153 [0..1]; - association [1] C153 <-> D153 [1]; - association [1..*] E153 <-> C153 [*]; - association [1] F153 <- D153 [1..*]; - - - enum G154 {F11, F12;} - - class B154 { - F154 e; - } - - class C154 { - B154 b154; - } - - class D154 extends C154 { - } - - class E154 { - Integer i; - } - - class F154 extends B154 { - Double d; - } - - association [1] F154 <-> E154 [1..*]; - association [*] B154 -> C154 [0..1]; - association [1] C154 <-> D154 [1]; - association [1..*] E154 <-> C154 [*]; - association [1] F154 <- D154 [1..*]; - - - enum G155 {F11, F12;} - - class B155 { - F155 e; - } - - class C155 { - B155 b155; - } - - class D155 extends C155 { - } - - class E155 { - Integer i; - } - - class F155 extends B155 { - Double d; - } - - association [1] F155 <-> E155 [1..*]; - association [*] B155 -> C155 [0..1]; - association [1] C155 <-> D155 [1]; - association [1..*] E155 <-> C155 [*]; - association [1] F155 <- D155 [1..*]; - - - enum G156 {F11, F12;} - - class B156 { - F156 e; - } - - class C156 { - B156 b156; - } - - class D156 extends C156 { - } - - class E156 { - Integer i; - } - - class F156 extends B156 { - Double d; - } - - association [1] F156 <-> E156 [1..*]; - association [*] B156 -> C156 [0..1]; - association [1] C156 <-> D156 [1]; - association [1..*] E156 <-> C156 [*]; - association [1] F156 <- D156 [1..*]; - - - enum G157 {F11, F12;} - - class B157 { - F157 e; - } - - class C157 { - B157 b157; - } - - class D157 extends C157 { - } - - class E157 { - Integer i; - } - - class F157 extends B157 { - Double d; - } - - association [1] F157 <-> E157 [1..*]; - association [*] B157 -> C157 [0..1]; - association [1] C157 <-> D157 [1]; - association [1..*] E157 <-> C157 [*]; - association [1] F157 <- D157 [1..*]; - - - enum G158 {F11, F12;} - - class B158 { - F158 e; - } - - class C158 { - B158 b158; - } - - class D158 extends C158 { - } - - class E158 { - Integer i; - } - - class F158 extends B158 { - Double d; - } - - association [1] F158 <-> E158 [1..*]; - association [*] B158 -> C158 [0..1]; - association [1] C158 <-> D158 [1]; - association [1..*] E158 <-> C158 [*]; - association [1] F158 <- D158 [1..*]; - - - enum G159 {F11, F12;} - - class B159 { - F159 e; - } - - class C159 { - B159 b159; - } - - class D159 extends C159 { - } - - class E159 { - Integer i; - } - - class F159 extends B159 { - Double d; - } - - association [1] F159 <-> E159 [1..*]; - association [*] B159 -> C159 [0..1]; - association [1] C159 <-> D159 [1]; - association [1..*] E159 <-> C159 [*]; - association [1] F159 <- D159 [1..*]; - - - enum G160 {F11, F12;} - - class B160 { - F160 e; - } - - class C160 { - B160 b160; - } - - class D160 extends C160 { - } - - class E160 { - Integer i; - } - - class F160 extends B160 { - Double d; - } - - association [1] F160 <-> E160 [1..*]; - association [*] B160 -> C160 [0..1]; - association [1] C160 <-> D160 [1]; - association [1..*] E160 <-> C160 [*]; - association [1] F160 <- D160 [1..*]; - - - enum G161 {F11, F12;} - - class B161 { - F161 e; - } - - class C161 { - B161 b161; - } - - class D161 extends C161 { - } - - class E161 { - Integer i; - } - - class F161 extends B161 { - Double d; - } - - association [1] F161 <-> E161 [1..*]; - association [*] B161 -> C161 [0..1]; - association [1] C161 <-> D161 [1]; - association [1..*] E161 <-> C161 [*]; - association [1] F161 <- D161 [1..*]; - - - enum G162 {F11, F12;} - - class B162 { - F162 e; - } - - class C162 { - B162 b162; - } - - class D162 extends C162 { - } - - class E162 { - Integer i; - } - - class F162 extends B162 { - Double d; - } - - association [1] F162 <-> E162 [1..*]; - association [*] B162 -> C162 [0..1]; - association [1] C162 <-> D162 [1]; - association [1..*] E162 <-> C162 [*]; - association [1] F162 <- D162 [1..*]; - - - enum G163 {F11, F12;} - - class B163 { - F163 e; - } - - class C163 { - B163 b163; - } - - class D163 extends C163 { - } - - class E163 { - Integer i; - } - - class F163 extends B163 { - Double d; - } - - association [1] F163 <-> E163 [1..*]; - association [*] B163 -> C163 [0..1]; - association [1] C163 <-> D163 [1]; - association [1..*] E163 <-> C163 [*]; - association [1] F163 <- D163 [1..*]; - - - enum G164 {F11, F12;} - - class B164 { - F164 e; - } - - class C164 { - B164 b164; - } - - class D164 extends C164 { - } - - class E164 { - Integer i; - } - - class F164 extends B164 { - Double d; - } - - association [1] F164 <-> E164 [1..*]; - association [*] B164 -> C164 [0..1]; - association [1] C164 <-> D164 [1]; - association [1..*] E164 <-> C164 [*]; - association [1] F164 <- D164 [1..*]; - - - enum G165 {F11, F12;} - - class B165 { - F165 e; - } - - class C165 { - B165 b165; - } - - class D165 extends C165 { - } - - class E165 { - Integer i; - } - - class F165 extends B165 { - Double d; - } - - association [1] F165 <-> E165 [1..*]; - association [*] B165 -> C165 [0..1]; - association [1] C165 <-> D165 [1]; - association [1..*] E165 <-> C165 [*]; - association [1] F165 <- D165 [1..*]; - - - enum G166 {F11, F12;} - - class B166 { - F166 e; - } - - class C166 { - B166 b166; - } - - class D166 extends C166 { - } - - class E166 { - Integer i; - } - - class F166 extends B166 { - Double d; - } - - association [1] F166 <-> E166 [1..*]; - association [*] B166 -> C166 [0..1]; - association [1] C166 <-> D166 [1]; - association [1..*] E166 <-> C166 [*]; - association [1] F166 <- D166 [1..*]; - - - enum G167 {F11, F12;} - - class B167 { - F167 e; - } - - class C167 { - B167 b167; - } - - class D167 extends C167 { - } - - class E167 { - Integer i; - } - - class F167 extends B167 { - Double d; - } - - association [1] F167 <-> E167 [1..*]; - association [*] B167 -> C167 [0..1]; - association [1] C167 <-> D167 [1]; - association [1..*] E167 <-> C167 [*]; - association [1] F167 <- D167 [1..*]; - - - enum G168 {F11, F12;} - - class B168 { - F168 e; - } - - class C168 { - B168 b168; - } - - class D168 extends C168 { - } - - class E168 { - Integer i; - } - - class F168 extends B168 { - Double d; - } - - association [1] F168 <-> E168 [1..*]; - association [*] B168 -> C168 [0..1]; - association [1] C168 <-> D168 [1]; - association [1..*] E168 <-> C168 [*]; - association [1] F168 <- D168 [1..*]; - - - enum G169 {F11, F12;} - - class B169 { - F169 e; - } - - class C169 { - B169 b169; - } - - class D169 extends C169 { - } - - class E169 { - Integer i; - } - - class F169 extends B169 { - Double d; - } - - association [1] F169 <-> E169 [1..*]; - association [*] B169 -> C169 [0..1]; - association [1] C169 <-> D169 [1]; - association [1..*] E169 <-> C169 [*]; - association [1] F169 <- D169 [1..*]; - - - enum G170 {F11, F12;} - - class B170 { - F170 e; - } - - class C170 { - B170 b170; - } - - class D170 extends C170 { - } - - class E170 { - Integer i; - } - - class F170 extends B170 { - Double d; - } - - association [1] F170 <-> E170 [1..*]; - association [*] B170 -> C170 [0..1]; - association [1] C170 <-> D170 [1]; - association [1..*] E170 <-> C170 [*]; - association [1] F170 <- D170 [1..*]; - - - enum G171 {F11, F12;} - - class B171 { - F171 e; - } - - class C171 { - B171 b171; - } - - class D171 extends C171 { - } - - class E171 { - Integer i; - } - - class F171 extends B171 { - Double d; - } - - association [1] F171 <-> E171 [1..*]; - association [*] B171 -> C171 [0..1]; - association [1] C171 <-> D171 [1]; - association [1..*] E171 <-> C171 [*]; - association [1] F171 <- D171 [1..*]; - - - enum G172 {F11, F12;} - - class B172 { - F172 e; - } - - class C172 { - B172 b172; - } - - class D172 extends C172 { - } - - class E172 { - Integer i; - } - - class F172 extends B172 { - Double d; - } - - association [1] F172 <-> E172 [1..*]; - association [*] B172 -> C172 [0..1]; - association [1] C172 <-> D172 [1]; - association [1..*] E172 <-> C172 [*]; - association [1] F172 <- D172 [1..*]; - - - enum G173 {F11, F12;} - - class B173 { - F173 e; - } - - class C173 { - B173 b173; - } - - class D173 extends C173 { - } - - class E173 { - Integer i; - } - - class F173 extends B173 { - Double d; - } - - association [1] F173 <-> E173 [1..*]; - association [*] B173 -> C173 [0..1]; - association [1] C173 <-> D173 [1]; - association [1..*] E173 <-> C173 [*]; - association [1] F173 <- D173 [1..*]; - - - enum G174 {F11, F12;} - - class B174 { - F174 e; - } - - class C174 { - B174 b174; - } - - class D174 extends C174 { - } - - class E174 { - Integer i; - } - - class F174 extends B174 { - Double d; - } - - association [1] F174 <-> E174 [1..*]; - association [*] B174 -> C174 [0..1]; - association [1] C174 <-> D174 [1]; - association [1..*] E174 <-> C174 [*]; - association [1] F174 <- D174 [1..*]; - - - enum G175 {F11, F12;} - - class B175 { - F175 e; - } - - class C175 { - B175 b175; - } - - class D175 extends C175 { - } - - class E175 { - Integer i; - } - - class F175 extends B175 { - Double d; - } - - association [1] F175 <-> E175 [1..*]; - association [*] B175 -> C175 [0..1]; - association [1] C175 <-> D175 [1]; - association [1..*] E175 <-> C175 [*]; - association [1] F175 <- D175 [1..*]; - - - enum G176 {F11, F12;} - - class B176 { - F176 e; - } - - class C176 { - B176 b176; - } - - class D176 extends C176 { - } - - class E176 { - Integer i; - } - - class F176 extends B176 { - Double d; - } - - association [1] F176 <-> E176 [1..*]; - association [*] B176 -> C176 [0..1]; - association [1] C176 <-> D176 [1]; - association [1..*] E176 <-> C176 [*]; - association [1] F176 <- D176 [1..*]; - - - enum G177 {F11, F12;} - - class B177 { - F177 e; - } - - class C177 { - B177 b177; - } - - class D177 extends C177 { - } - - class E177 { - Integer i; - } - - class F177 extends B177 { - Double d; - } - - association [1] F177 <-> E177 [1..*]; - association [*] B177 -> C177 [0..1]; - association [1] C177 <-> D177 [1]; - association [1..*] E177 <-> C177 [*]; - association [1] F177 <- D177 [1..*]; - - - enum G178 {F11, F12;} - - class B178 { - F178 e; - } - - class C178 { - B178 b178; - } - - class D178 extends C178 { - } - - class E178 { - Integer i; - } - - class F178 extends B178 { - Double d; - } - - association [1] F178 <-> E178 [1..*]; - association [*] B178 -> C178 [0..1]; - association [1] C178 <-> D178 [1]; - association [1..*] E178 <-> C178 [*]; - association [1] F178 <- D178 [1..*]; - - - enum G179 {F11, F12;} - - class B179 { - F179 e; - } - - class C179 { - B179 b179; - } - - class D179 extends C179 { - } - - class E179 { - Integer i; - } - - class F179 extends B179 { - Double d; - } - - association [1] F179 <-> E179 [1..*]; - association [*] B179 -> C179 [0..1]; - association [1] C179 <-> D179 [1]; - association [1..*] E179 <-> C179 [*]; - association [1] F179 <- D179 [1..*]; - } From e4946b471ab18d19fe1d891ef7ae0578712e04fc Mon Sep 17 00:00:00 2001 From: Lukas Kronast Date: Fri, 4 Jul 2025 15:23:07 +0200 Subject: [PATCH 08/17] adjust times for pipeline --- .../monticore/cddiff/syndiff/PerformanceTest.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java index 5976df24f..65d8c5281 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java @@ -12,27 +12,27 @@ import java.util.stream.Stream; public class PerformanceTest extends SynDiffTestBasis { - + @BeforeAll public static void init() { dir = "src/test/resources/de/monticore/cddiff/syndiff/Performance/"; } - + public static Stream performanceData() { return Stream.of(Arguments.of("5/CD1.cd", "5/CD2.cd", 1), Arguments.of("10/CD1.cd", "10/CD2.cd", 1), Arguments.of("15/CD1.cd", "15/CD2.cd", 1), Arguments.of("20/CD1.cd", "20/CD2.cd", 1), - Arguments.of("25/CD1.cd", "25/CD2.cd", 1), Arguments.of("100/CD1.cd", "100/CD2.cd", 2), + Arguments.of("25/CD1.cd", "25/CD2.cd", 1), Arguments.of("100/CD1.cd", "100/CD2.cd", 5), Arguments.of("500/CD1.cd", "500/CD2.cd", 120)); } - + @ParameterizedTest @MethodSource("performanceData") public void testPerformance(String srcPath, String tgtPath, int timeoutSec) { parseModels(srcPath, tgtPath); - + Duration timeout = Duration.ofSeconds(timeoutSec); Assertions.assertTimeout(timeout, () -> new Syn2SemDiff(src, tgt)); - + } - + } From fa86c78627db14b0838f93da608650cad139e0c3 Mon Sep 17 00:00:00 2001 From: Lukas Kronast Date: Fri, 4 Jul 2025 15:28:41 +0200 Subject: [PATCH 09/17] linting --- .../de/monticore/cddiff/syndiff/PerformanceTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java index 65d8c5281..119987c8b 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/PerformanceTest.java @@ -12,27 +12,27 @@ import java.util.stream.Stream; public class PerformanceTest extends SynDiffTestBasis { - + @BeforeAll public static void init() { dir = "src/test/resources/de/monticore/cddiff/syndiff/Performance/"; } - + public static Stream performanceData() { return Stream.of(Arguments.of("5/CD1.cd", "5/CD2.cd", 1), Arguments.of("10/CD1.cd", "10/CD2.cd", 1), Arguments.of("15/CD1.cd", "15/CD2.cd", 1), Arguments.of("20/CD1.cd", "20/CD2.cd", 1), Arguments.of("25/CD1.cd", "25/CD2.cd", 1), Arguments.of("100/CD1.cd", "100/CD2.cd", 5), Arguments.of("500/CD1.cd", "500/CD2.cd", 120)); } - + @ParameterizedTest @MethodSource("performanceData") public void testPerformance(String srcPath, String tgtPath, int timeoutSec) { parseModels(srcPath, tgtPath); - + Duration timeout = Duration.ofSeconds(timeoutSec); Assertions.assertTimeout(timeout, () -> new Syn2SemDiff(src, tgt)); - + } - + } From 77dfd121c2d78396987b056b46afaa4acf4a66c3 Mon Sep 17 00:00:00 2001 From: Lukas Kronast Date: Mon, 18 Aug 2025 11:55:16 +0200 Subject: [PATCH 10/17] testing after fixes --- .../cddiff/syndiff/Syn2SemDiffTest.java | 52 +++++++++---------- .../cddiff/syndiff/SyntaxDiffTest.java | 1 + 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java index d2e4150d1..74a8f8ffe 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java @@ -28,10 +28,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class Syn2SemDiffTest extends SynDiffTestBasis { - + private static final String cddiffDir = "src/test/resources/de/monticore/cddiff/"; private static final String validationDir = "src/test/resources/validation/"; - + public static Stream emptyWitnesses() { return Stream.of(Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", false, false), Arguments.of(cddiffDir, @@ -91,30 +91,30 @@ public static Stream emptyWitnesses() { Arguments.of(validationDir, "cd4analysis/MyExampleV1.cd", "cd4analysis/MyExampleV2.cd", true, false)); } - + @ParameterizedTest @MethodSource("emptyWitnesses") public void testEmptyWitnesses(String baseDir, String srcPath, String tgtPath, boolean staDiff, boolean reduction) { dir = baseDir; parseModels(srcPath, tgtPath); - + if (reduction) { ReductionTrafo trafo = new ReductionTrafo(); trafo.transform(src, tgt); } - + Syn2SemDiff syn2semdiff = new Syn2SemDiff(src, tgt); List witnesses = syn2semdiff.generateODs(staDiff); - + assertTrue(witnesses.isEmpty()); } - + public static Stream witnesses() { return Stream.of( - //Arguments.of("syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", SIMPLE_CLOSED_WORLD, true), - //Arguments.of(validationDir, "cddiff/LibraryV5.cd", "cddiff/LibraryV4.cd", STA_CLOSED_WORLD, false), - //Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd", SIMPLE_CLOSED_WORLD, true), + Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", SIMPLE_CLOSED_WORLD, true), + Arguments.of(validationDir, "cddiff/LibraryV5.cd", "cddiff/LibraryV4.cd", STA_CLOSED_WORLD, false), + Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd", SIMPLE_CLOSED_WORLD, true), Arguments.of(cddiffDir, "syndiff/SyntaxDiff/AddedDeletedAssocs/CD31.cd", "syndiff/SyntaxDiff/AddedDeletedAssocs/CD32.cd", SIMPLE_CLOSED_WORLD, false), Arguments .of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", @@ -174,31 +174,31 @@ public static Stream witnesses() { "cd4analysis/MyCompanyV2.cd", "cd4analysis/MyCompanyV1.cd", STA_CLOSED_WORLD, false)); } - + @ParameterizedTest @MethodSource("witnesses") public void testWitnesses(String baseDir, String srcPath, String tgtPath, CDSemantics semantics, boolean reduction) { dir = baseDir; parseModels(srcPath, tgtPath); - + if (reduction) { ReductionTrafo trafo = new ReductionTrafo(); trafo.transform(src, tgt); } - + Syn2SemDiff syn2semdiff = new Syn2SemDiff(src, tgt); List witnesses = syn2semdiff.generateODs(semantics.equals(STA_CLOSED_WORLD) || semantics.equals(STA_OPEN_WORLD)); - + assertFalse(witnesses.isEmpty()); - + checkDiffWitnesses(semantics, src, tgt, witnesses); } - + public static Stream witnessesReduction() { return Stream.of( - // Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd"), + Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd"), Arguments.of(validationDir, "Performance/5A.cd", "Performance/5B.cd"), Arguments.of( validationDir, "Performance/10A.cd", "Performance/10B.cd"), Arguments.of(validationDir, "Performance/15A.cd", "Performance/15B.cd"), Arguments.of(validationDir, @@ -221,32 +221,32 @@ public static Stream witnessesReduction() { "Employees/Employees8.cd"), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd")); } - + @ParameterizedTest @MethodSource("witnessesReduction") public void testWitnessesReduction(String baseDir, String srcPath, String tgtPath) { dir = baseDir; parseModels(srcPath, tgtPath); - + ASTCDCompilationUnit srcOriginal = src.deepClone(); ASTCDCompilationUnit tgtOriginal = tgt.deepClone(); - + // reduction-based ReductionTrafo trafo = new ReductionTrafo(); trafo.transform(src, tgt); - + Syn2SemDiff syn2semdiff = new Syn2SemDiff(src, tgt); List witnesses = syn2semdiff.generateODs(true); - + Assertions.assertFalse(witnesses.isEmpty()); - + checkDiffWitnesses(CDSemantics.STA_CLOSED_WORLD, src, tgt, witnesses); - + CD4CodeMill.scopesGenitorDelegator().createFromAST(srcOriginal); CD4CodeMill.scopesGenitorDelegator().createFromAST(tgtOriginal); checkDiffWitnesses(CDSemantics.STA_OPEN_WORLD, srcOriginal, tgtOriginal, witnesses); } - + protected void checkDiffWitnesses(CDSemantics semantics, ASTCDCompilationUnit cd1, ASTCDCompilationUnit cd2, Collection witnesses) { for (ASTODArtifact od : witnesses) { @@ -256,5 +256,5 @@ protected void checkDiffWitnesses(CDSemantics semantics, ASTCDCompilationUnit cd } } } - + } diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java index 72e2939b5..f662ee1b7 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java @@ -12,6 +12,7 @@ import de.monticore.cddiff.syn2semdiff.Syn2SemDiff; import de.monticore.odbasis._ast.ASTODArtifact; import de.monticore.odvalidity.OD2CDMatcher; +import de.se_rwth.commons.logging.Log; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; From f35e644be6994d3831f72080785e782a62d850d1 Mon Sep 17 00:00:00 2001 From: Max Philip Stachon Date: Tue, 19 Aug 2025 17:42:33 +0200 Subject: [PATCH 11/17] minor fix in Syn2SemDiff --- .../cddiff/syn2semdiff/Syn2SemDiff.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/Syn2SemDiff.java b/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/Syn2SemDiff.java index b676f2cfe..66672bccc 100644 --- a/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/Syn2SemDiff.java +++ b/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/Syn2SemDiff.java @@ -203,15 +203,21 @@ else if (astodArtifact.isPresent() && diffLimit == 0) { } comment.append(System.lineSeparator()).append("// is/are added in ").append(attribute.a .getSymbol().getInternalQualifiedName()); - Optional astodArtifact = generateArtifact(attribute.a, comment); - if (astodArtifact.isPresent() && diffLimit != 0 && artifactList.size() < diffLimit) { - artifactList.add(astodArtifact.get()); - if (artifactList.size() == diffLimit) { - return artifactList; + + Optional srcClass = syntaxDiff.getMatchedClasses().stream().filter(p -> p.b + .equals(attribute.a)).map(p -> p.a).findFirst(); + + if (srcClass.isPresent()) { + Optional astodArtifact = generateArtifact(srcClass.get(), comment); + if (astodArtifact.isPresent() && diffLimit != 0 && artifactList.size() < diffLimit) { + artifactList.add(astodArtifact.get()); + if (artifactList.size() == diffLimit) { + return artifactList; + } + } + else if (astodArtifact.isPresent() && diffLimit == 0) { + artifactList.add(astodArtifact.get()); } - } - else if (astodArtifact.isPresent() && diffLimit == 0) { - artifactList.add(astodArtifact.get()); } } } From 82555a373956a6cb5c604552c765f8b1979500f6 Mon Sep 17 00:00:00 2001 From: Max Philip Stachon Date: Tue, 19 Aug 2025 18:21:00 +0200 Subject: [PATCH 12/17] fix SyntaxDiffTest.testMaCoCo2 --- .../cddiff/syndiff/Syn2SemDiffTest.java | 168 +++++++++--------- .../cddiff/syndiff/SyntaxDiffTest.java | 136 +++++++------- 2 files changed, 154 insertions(+), 150 deletions(-) diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java index 74a8f8ffe..3f5823b2f 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java @@ -28,10 +28,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class Syn2SemDiffTest extends SynDiffTestBasis { - + private static final String cddiffDir = "src/test/resources/de/monticore/cddiff/"; private static final String validationDir = "src/test/resources/validation/"; - + public static Stream emptyWitnesses() { return Stream.of(Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", false, false), Arguments.of(cddiffDir, @@ -91,114 +91,118 @@ public static Stream emptyWitnesses() { Arguments.of(validationDir, "cd4analysis/MyExampleV1.cd", "cd4analysis/MyExampleV2.cd", true, false)); } - + @ParameterizedTest @MethodSource("emptyWitnesses") public void testEmptyWitnesses(String baseDir, String srcPath, String tgtPath, boolean staDiff, boolean reduction) { dir = baseDir; parseModels(srcPath, tgtPath); - + if (reduction) { ReductionTrafo trafo = new ReductionTrafo(); trafo.transform(src, tgt); } - + Syn2SemDiff syn2semdiff = new Syn2SemDiff(src, tgt); List witnesses = syn2semdiff.generateODs(staDiff); - + assertTrue(witnesses.isEmpty()); } - + public static Stream witnesses() { - return Stream.of( - Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", SIMPLE_CLOSED_WORLD, true), - Arguments.of(validationDir, "cddiff/LibraryV5.cd", "cddiff/LibraryV4.cd", STA_CLOSED_WORLD, false), - Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd", SIMPLE_CLOSED_WORLD, true), - Arguments.of(cddiffDir, "syndiff/SyntaxDiff/AddedDeletedAssocs/CD31.cd", - "syndiff/SyntaxDiff/AddedDeletedAssocs/CD32.cd", SIMPLE_CLOSED_WORLD, false), Arguments - .of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", - "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", SIMPLE_CLOSED_WORLD, true), - Arguments.of(cddiffDir, "syndiff/TypeDiff/DeletedAttribute/CD11.cd", - "syndiff/TypeDiff/DeletedAttribute/CD12.cd", SIMPLE_CLOSED_WORLD, false), Arguments.of( + return Stream.of(Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", + "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", SIMPLE_CLOSED_WORLD, true), Arguments.of( + validationDir, "cddiff/LibraryV5.cd", "cddiff/LibraryV4.cd", STA_CLOSED_WORLD, false), + Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd", + SIMPLE_CLOSED_WORLD, true), Arguments.of(cddiffDir, + "syndiff/SyntaxDiff/AddedDeletedAssocs/CD31.cd", + "syndiff/SyntaxDiff/AddedDeletedAssocs/CD32.cd", SIMPLE_CLOSED_WORLD, false), + Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", + "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", SIMPLE_CLOSED_WORLD, true), Arguments.of( cddiffDir, "syndiff/TypeDiff/DeletedAttribute/CD11.cd", - "syndiff/TypeDiff/DeletedAttribute/CD12.cd", SIMPLE_CLOSED_WORLD, true), Arguments - .of(cddiffDir, "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD31.cd", - "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD32.cd", SIMPLE_CLOSED_WORLD, - false), Arguments.of(cddiffDir, - "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD31.cd", - "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD32.cd", - SIMPLE_CLOSED_WORLD, true), Arguments.of(cddiffDir, - "syndiff/TypeDiff/RemovedAttributeNoDiff/CD21.cd", - "syndiff/TypeDiff/RemovedAttributeNoDiff/CD22.cd", + "syndiff/TypeDiff/DeletedAttribute/CD12.cd", SIMPLE_CLOSED_WORLD, false), Arguments + .of(cddiffDir, "syndiff/TypeDiff/DeletedAttribute/CD11.cd", + "syndiff/TypeDiff/DeletedAttribute/CD12.cd", SIMPLE_CLOSED_WORLD, true), + Arguments.of(cddiffDir, "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD31.cd", + "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD32.cd", SIMPLE_CLOSED_WORLD, false), + Arguments.of(cddiffDir, "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD31.cd", + "syndiff/TypeDiff/RemovedAddedAttributeDiff/CD32.cd", SIMPLE_CLOSED_WORLD, true), + Arguments.of(cddiffDir, "syndiff/TypeDiff/RemovedAttributeNoDiff/CD21.cd", + "syndiff/TypeDiff/RemovedAttributeNoDiff/CD22.cd", SIMPLE_CLOSED_WORLD, true), Arguments + .of(cddiffDir, "syndiff/SyntaxDiff/MaCoCo_v1.cd", "syndiff/SyntaxDiff/MaCoCo_v2.cd", + SIMPLE_CLOSED_WORLD, false), Arguments.of(cddiffDir, + "syndiff/SyntaxDiff/SS1.cd", "syndiff/SyntaxDiff/SS2.cd", + SIMPLE_CLOSED_WORLD, false), Arguments.of(cddiffDir, + "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin1.cd", + SIMPLE_CLOSED_WORLD, false), Arguments.of(cddiffDir, + "DigitalTwins/DigitalTwin1.cd", "DigitalTwins/DigitalTwin2.cd", SIMPLE_CLOSED_WORLD, true), Arguments.of(cddiffDir, - "syndiff/SyntaxDiff/MaCoCo_v1.cd", - "syndiff/SyntaxDiff/MaCoCo_v2.cd", SIMPLE_CLOSED_WORLD, false), - Arguments.of(cddiffDir, "syndiff/SyntaxDiff/SS1.cd", "syndiff/SyntaxDiff/SS2.cd", - SIMPLE_CLOSED_WORLD, false), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", - "DigitalTwins/DigitalTwin1.cd", SIMPLE_CLOSED_WORLD, false), Arguments.of(cddiffDir, - "DigitalTwins/DigitalTwin1.cd", "DigitalTwins/DigitalTwin2.cd", - SIMPLE_CLOSED_WORLD, true), Arguments.of(cddiffDir, - "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin3.cd", - SIMPLE_CLOSED_WORLD, true), Arguments.of(cddiffDir, - "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", - SIMPLE_CLOSED_WORLD, true), Arguments.of(cddiffDir, - "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin1.cd", - SIMPLE_OPEN_WORLD, false), Arguments.of(cddiffDir, - "DigitalTwins/DigitalTwin1.cd", "DigitalTwins/DigitalTwin2.cd", - SIMPLE_OPEN_WORLD, true), Arguments.of(cddiffDir, - "DigitalTwins/DigitalTwin2.cd", - "DigitalTwins/DigitalTwin3.cd", SIMPLE_OPEN_WORLD, true), - Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", - SIMPLE_OPEN_WORLD, true), Arguments.of(cddiffDir, "Employees/Employees1.cd", - "Employees/Employees2.cd", SIMPLE_CLOSED_WORLD, false), Arguments.of(cddiffDir, - "Employees/Employees2.cd", "Employees/Employees1.cd", SIMPLE_CLOSED_WORLD, - false), Arguments.of(cddiffDir, "Employees/Employees7.cd", - "Employees/Employees8.cd", STA_CLOSED_WORLD, true), Arguments.of(cddiffDir, - "Employees/Employees7.cd", "Employees/Employees8.cd", STA_CLOSED_WORLD, - false), Arguments.of(cddiffDir, "Employees/Employees8.cd", - "Employees/Employees7.cd", STA_CLOSED_WORLD, false), Arguments.of( - validationDir, "cddiff/LibraryV2.cd", "cddiff/LibraryV3.cd", - STA_CLOSED_WORLD, true), Arguments.of(validationDir, - "cddiff/LibraryV4.cd", "cddiff/LibraryV5.cd", - STA_CLOSED_WORLD, true), Arguments.of(validationDir, - "cddiff/LibraryV3.cd", "cddiff/LibraryV2.cd", + "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin3.cd", + SIMPLE_CLOSED_WORLD, true), Arguments.of(cddiffDir, + "DigitalTwins/DigitalTwin3.cd", + "DigitalTwins/DigitalTwin2.cd", SIMPLE_CLOSED_WORLD, true), + Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin1.cd", + SIMPLE_OPEN_WORLD, false), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin1.cd", + "DigitalTwins/DigitalTwin2.cd", SIMPLE_OPEN_WORLD, true), Arguments.of(cddiffDir, + "DigitalTwins/DigitalTwin2.cd", "DigitalTwins/DigitalTwin3.cd", + SIMPLE_OPEN_WORLD, true), Arguments.of(cddiffDir, + "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", + SIMPLE_OPEN_WORLD, true), Arguments.of(cddiffDir, "Employees/Employees1.cd", + "Employees/Employees2.cd", SIMPLE_CLOSED_WORLD, false), Arguments.of( + cddiffDir, "Employees/Employees2.cd", "Employees/Employees1.cd", + SIMPLE_CLOSED_WORLD, false), Arguments.of(cddiffDir, + "Employees/Employees7.cd", "Employees/Employees8.cd", + STA_CLOSED_WORLD, true), Arguments.of(cddiffDir, + "Employees/Employees7.cd", "Employees/Employees8.cd", + STA_CLOSED_WORLD, false), Arguments.of(cddiffDir, + "Employees/Employees8.cd", "Employees/Employees7.cd", STA_CLOSED_WORLD, false), Arguments.of(validationDir, "cddiff/LibraryV2.cd", "cddiff/LibraryV3.cd", - STA_CLOSED_WORLD, false), Arguments.of( - validationDir, "cddiff/LibraryV4.cd", - "cddiff/LibraryV5.cd", STA_CLOSED_WORLD, false), - Arguments.of(validationDir, "cd4analysis/ManagementV1.cd", "cd4analysis/ManagementV2.cd", - STA_CLOSED_WORLD, true), Arguments.of(validationDir, "cd4analysis/MyCompanyV1.cd", - "cd4analysis/MyCompanyV2.cd", STA_CLOSED_WORLD, true), Arguments.of(validationDir, - "cd4analysis/MyCompanyV2.cd", "cd4analysis/MyCompanyV1.cd", STA_CLOSED_WORLD, - false)); + STA_CLOSED_WORLD, true), Arguments.of(validationDir, + "cddiff/LibraryV4.cd", "cddiff/LibraryV5.cd", + STA_CLOSED_WORLD, true), Arguments.of( + validationDir, "cddiff/LibraryV3.cd", + "cddiff/LibraryV2.cd", STA_CLOSED_WORLD, + false), Arguments.of(validationDir, + "cddiff/LibraryV2.cd", + "cddiff/LibraryV3.cd", STA_CLOSED_WORLD, + false), Arguments.of(validationDir, + "cddiff/LibraryV4.cd", + "cddiff/LibraryV5.cd", + STA_CLOSED_WORLD, false), Arguments + .of(validationDir, + "cd4analysis/ManagementV1.cd", + "cd4analysis/ManagementV2.cd", + STA_CLOSED_WORLD, true), + Arguments.of(validationDir, "cd4analysis/MyCompanyV1.cd", "cd4analysis/MyCompanyV2.cd", + STA_CLOSED_WORLD, true), Arguments.of(validationDir, "cd4analysis/MyCompanyV2.cd", + "cd4analysis/MyCompanyV1.cd", STA_CLOSED_WORLD, false)); } - + @ParameterizedTest @MethodSource("witnesses") public void testWitnesses(String baseDir, String srcPath, String tgtPath, CDSemantics semantics, boolean reduction) { dir = baseDir; parseModels(srcPath, tgtPath); - + if (reduction) { ReductionTrafo trafo = new ReductionTrafo(); trafo.transform(src, tgt); } - + Syn2SemDiff syn2semdiff = new Syn2SemDiff(src, tgt); List witnesses = syn2semdiff.generateODs(semantics.equals(STA_CLOSED_WORLD) || semantics.equals(STA_OPEN_WORLD)); - + assertFalse(witnesses.isEmpty()); - + checkDiffWitnesses(semantics, src, tgt, witnesses); } - + public static Stream witnessesReduction() { - return Stream.of( - Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd"), + return Stream.of(Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd"), Arguments.of(validationDir, "Performance/5A.cd", "Performance/5B.cd"), Arguments.of( validationDir, "Performance/10A.cd", "Performance/10B.cd"), Arguments.of(validationDir, "Performance/15A.cd", "Performance/15B.cd"), Arguments.of(validationDir, @@ -221,32 +225,32 @@ public static Stream witnessesReduction() { "Employees/Employees8.cd"), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd")); } - + @ParameterizedTest @MethodSource("witnessesReduction") public void testWitnessesReduction(String baseDir, String srcPath, String tgtPath) { dir = baseDir; parseModels(srcPath, tgtPath); - + ASTCDCompilationUnit srcOriginal = src.deepClone(); ASTCDCompilationUnit tgtOriginal = tgt.deepClone(); - + // reduction-based ReductionTrafo trafo = new ReductionTrafo(); trafo.transform(src, tgt); - + Syn2SemDiff syn2semdiff = new Syn2SemDiff(src, tgt); List witnesses = syn2semdiff.generateODs(true); - + Assertions.assertFalse(witnesses.isEmpty()); - + checkDiffWitnesses(CDSemantics.STA_CLOSED_WORLD, src, tgt, witnesses); - + CD4CodeMill.scopesGenitorDelegator().createFromAST(srcOriginal); CD4CodeMill.scopesGenitorDelegator().createFromAST(tgtOriginal); checkDiffWitnesses(CDSemantics.STA_OPEN_WORLD, srcOriginal, tgtOriginal, witnesses); } - + protected void checkDiffWitnesses(CDSemantics semantics, ASTCDCompilationUnit cd1, ASTCDCompilationUnit cd2, Collection witnesses) { for (ASTODArtifact od : witnesses) { @@ -256,5 +260,5 @@ protected void checkDiffWitnesses(CDSemantics semantics, ASTCDCompilationUnit cd } } } - + } diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java index f662ee1b7..5a2231dfb 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/SyntaxDiffTest.java @@ -31,40 +31,40 @@ import static org.junit.jupiter.api.Assertions.fail; public class SyntaxDiffTest extends SynDiffTestBasis { - + @BeforeAll public static void init() { dir = "src/test/resources/de/monticore/cddiff/"; } - + @Test public void testMember1() { parseModels("syndiff/MemberDiff/Source1.cd", "syndiff/MemberDiff/Target1.cd"); - + ASTCDClass cNew = CDTestHelper.getClass("A", src.getCDDefinition()); ASTCDClass cOld = CDTestHelper.getClass("A", tgt.getCDDefinition()); - + Assertions.assertNotNull(cNew); Assertions.assertNotNull(cOld); - + ASTNode attributeNew = CDTestHelper.getAttribute(cNew, "a"); ASTNode attributeOld = CDTestHelper.getAttribute(cOld, "a"); - + CDMemberDiff attrDiff = new CDMemberDiff(attributeNew, attributeOld); - + assertEquals(new HashSet<>(attrDiff.getBaseDiff()), Set.of(DiffTypes.CHANGED_ATTRIBUTE_TYPE, DiffTypes.CHANGED_ATTRIBUTE_MODIFIER)); } - + @Test public void testDTs() { parseModels("DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin1.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - + new AssertSynDiff(synDiff).assertAddedClasses(4).assertMatchedClasses(4).assertAddedAssocs(2) .assertChangedAssocs(3).assertMatchedAssocs(3).assertChangedTypes(2).assertRemainingEmpty(); - + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.ADDED_CLASS, 1L); expectedDiffTypes.put(DiffTypes.ADDED_ASSOCIATION, 1L); @@ -73,21 +73,21 @@ public void testDTs() { expectedDiffTypes.put(DiffTypes.ADDED_INHERITANCE, 1L); expectedDiffTypes.put(DiffTypes.CHANGED_TYPE_EXTENDS, 1L); expectedDiffTypes.put(DiffTypes.CHANGED_CLASS_MODIFIER, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testSyntaxDiff1() { parseModels("syndiff/SyntaxDiff/Source1.cd", "syndiff/SyntaxDiff/Target1.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - + new AssertSynDiff(synDiff).assertAddedClasses(1).assertDeletedClasses(1).assertMatchedClasses(3) .assertChangedTypes(5).assertAddedAssocs(2).assertDeletedAssocs(2).assertChangedAssocs(2) .assertMatchedAssocs(2).assertAddedEnums(1).assertDeletedEnums(1).assertMatchedEnums(1) .assertRemainingEmpty(); - + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); expectedDiffTypes.put(DiffTypes.DELETED_ENUM, 1L); @@ -107,20 +107,20 @@ public void testSyntaxDiff1() { expectedDiffTypes.put(DiffTypes.CHANGED_CLASS_NAME, 1L); expectedDiffTypes.put(DiffTypes.CHANGED_CLASS_MODIFIER, 1L); expectedDiffTypes.put(DiffTypes.INHERITED_ATTRIBUTE, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testSyntaxDiff2() { parseModels("syndiff/SyntaxDiff/Source2.cd", "syndiff/SyntaxDiff/Target2.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - + new AssertSynDiff(synDiff).assertAddedClasses(2).assertDeletedClasses(2).assertMatchedClasses(2) .assertAddedAssocs(1).assertDeletedAssocs(1).assertMatchedAssocs(1).assertAddedEnums(1) .assertDeletedEnums(1).assertMatchedEnums(1).assertRemainingEmpty(); - + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.ADDED_CLASS, 1L); expectedDiffTypes.put(DiffTypes.ADDED_ASSOCIATION, 1L); @@ -130,20 +130,20 @@ public void testSyntaxDiff2() { expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); expectedDiffTypes.put(DiffTypes.DELETED_INHERITANCE, 1L); expectedDiffTypes.put(DiffTypes.DELETED_ENUM, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testSyntaxDiff3() { parseModels("syndiff/SyntaxDiff/TechStoreV2.cd", "syndiff/SyntaxDiff/TechStoreV1.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - + new AssertSynDiff(synDiff).assertDeletedClasses(2).assertMatchedClasses(11).assertChangedTypes( 3).assertAddedAssocs(4).assertDeletedAssocs(2).assertChangedAssocs(5).assertMatchedAssocs(6) .assertMatchedEnums(1).assertRemainingEmpty(); - + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); expectedDiffTypes.put(DiffTypes.DELETED_INHERITANCE, 1L); @@ -159,114 +159,114 @@ public void testSyntaxDiff3() { expectedDiffTypes.put(DiffTypes.CHANGED_ASSOCIATION_CLASS, 2L); expectedDiffTypes.put(DiffTypes.CHANGED_ATTRIBUTE_TYPE, 1L); expectedDiffTypes.put(DiffTypes.CHANGED_CLASS_NAME, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testSyntaxDiff4() { parseModels("syndiff/SyntaxDiff/TechStoreV9.cd", "syndiff/SyntaxDiff/TechStoreV10.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - + new AssertSynDiff(synDiff).assertMatchedClasses(2).assertDeletedAssocs(1) .assertRemainingEmpty(); - + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testSyntaxDiff5() { parseModels("syndiff/SyntaxDiff/TechStoreV11.cd", "syndiff/SyntaxDiff/TechStoreV12.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - + new AssertSynDiff(synDiff).assertChangedTypes(3).assertMatchedClasses(3).assertRemainingEmpty(); - + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.ADDED_ATTRIBUTE, 1L); expectedDiffTypes.put(DiffTypes.INHERITED_ATTRIBUTE, 2L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); } - + @Test public void testMaCoCo() { CDDiffUtil.setUseJavaTypes(true); parseMaCoCo("syndiff/SyntaxDiff/MaCoCo_v1.cd", "syndiff/SyntaxDiff/MaCoCo_v2.cd"); - + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); - + new AssertSynDiff(synDiff).assertAddedClasses(1).assertAddedEnums(1).assertAddedAssocs(1) .assertMatchedAssocs(91).assertMatchedClasses(94).assertMatchedEnums(45) .assertRemainingEmpty(); - + Map expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.ADDED_CLASS, 1L); expectedDiffTypes.put(DiffTypes.ADDED_ENUM, 1L); expectedDiffTypes.put(DiffTypes.ADDED_ASSOCIATION, 1L); expectedDiffTypes.put(DiffTypes.ADDED_INHERITANCE, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); - + // Conformance Checking without stereotype mapping constitutes a refinement check boolean conform = new CDConformanceChecker(Set.of(CDConfParameter.STEREOTYPE_MAPPING, CDConfParameter.NAME_MAPPING, CDConfParameter.SRC_TARGET_ASSOC_MAPPING, CDConfParameter.ALLOW_CARD_RESTRICTION)).checkConformance(src, tgt, "incarnates"); - + assertTrue(conform); - + // Syn2SemDiff produces correct diff-witnesses Syn2SemDiff semDiff = new Syn2SemDiff(src, tgt); OD2CDMatcher matcher = new OD2CDMatcher(); List ods = semDiff.generateODs(false); - + assertFalse(ods.isEmpty()); assertTrue(semDiff.generateODs(false).stream().allMatch(od -> matcher.checkIfDiffWitness( CDSemantics.SIMPLE_CLOSED_WORLD, src, tgt, od))); - + synDiff = new CDSyntaxDiff(tgt, src, List.of()); new AssertSynDiff(synDiff).assertDeletedClasses(1).assertDeletedEnums(1).assertDeletedAssocs(1) .assertMatchedAssocs(91).assertMatchedClasses(94).assertMatchedEnums(45) .assertRemainingEmpty(); - + expectedDiffTypes = new HashMap<>(); expectedDiffTypes.put(DiffTypes.DELETED_CLASS, 1L); expectedDiffTypes.put(DiffTypes.DELETED_ENUM, 1L); expectedDiffTypes.put(DiffTypes.DELETED_ASSOCIATION, 1L); expectedDiffTypes.put(DiffTypes.DELETED_INHERITANCE, 1L); - + assertEquals(expectedDiffTypes, getDiffTypesCount(synDiff)); - + // Conformance Checking without stereotype mapping constitutes a refinement check conform = new CDConformanceChecker(Set.of(CDConfParameter.STEREOTYPE_MAPPING, CDConfParameter.NAME_MAPPING, CDConfParameter.SRC_TARGET_ASSOC_MAPPING, CDConfParameter.ALLOW_CARD_RESTRICTION)).checkConformance(tgt, src, "incarnates"); - + assertFalse(conform); - + // Syn2SemDiff produces correct diff-witnesses semDiff = new Syn2SemDiff(tgt, src); ods = semDiff.generateODs(false); - + assertTrue(ods.isEmpty()); assertTrue(Log.getFindings().isEmpty()); } - + @Test public void testMaCoCo2() { CDDiffUtil.setUseJavaTypes(true); - parseModels("MaCoCo_Failing_1.cd", "MaCoCo_Failing_2.cd"); - + parseMaCoCo("syndiff/SyntaxDiff/MaCoCo_Failing_1.cd", "syndiff/SyntaxDiff/MaCoCo_Failing_2.cd"); + CDSyntaxDiff synDiff = new CDSyntaxDiff(src, tgt, List.of()); SyntaxDiffPrinter sb = new SyntaxDiffPrinter(synDiff); Log.println(sb.printDiff()); - + assertEquals(1, synDiff.changedTypes().size()); - + assertTrue(synDiff.getAddedClasses().isEmpty()); assertTrue(synDiff.getDeletedClasses().isEmpty()); assertTrue(synDiff.getAddedInterfaces().isEmpty()); @@ -276,21 +276,21 @@ public void testMaCoCo2() { assertTrue(synDiff.getAddedAssocs().isEmpty()); assertTrue(synDiff.getDeletedAssocs().isEmpty()); assertTrue(synDiff.getChangedAssocs().isEmpty()); - + // Syn2SemDiff produces correct diff-witnesses Syn2SemDiff semDiff = new Syn2SemDiff(src, tgt); OD2CDMatcher matcher = new OD2CDMatcher(); List ods = semDiff.generateODs(false); - + assertFalse(ods.isEmpty()); assertTrue(semDiff.generateODs(false).stream().allMatch(od -> matcher.checkIfDiffWitness( CDSemantics.SIMPLE_CLOSED_WORLD, src, tgt, od))); - + synDiff = new CDSyntaxDiff(tgt, src, List.of()); sb = new SyntaxDiffPrinter(synDiff); - + assertEquals(1, synDiff.changedTypes().size()); - + assertTrue(synDiff.getAddedClasses().isEmpty()); assertTrue(synDiff.getDeletedClasses().isEmpty()); assertTrue(synDiff.getAddedInterfaces().isEmpty()); @@ -300,16 +300,16 @@ public void testMaCoCo2() { assertTrue(synDiff.getAddedAssocs().isEmpty()); assertTrue(synDiff.getDeletedAssocs().isEmpty()); assertTrue(synDiff.getChangedAssocs().isEmpty()); - + Log.println(sb.printDiff()); // Syn2SemDiff produces no diff-witnesses semDiff = new Syn2SemDiff(tgt, src); ods = semDiff.generateODs(false); - + assertTrue(ods.isEmpty()); assertTrue(Log.getFindings().isEmpty()); } - + public void parseMaCoCo(String concrete, String ref) { try { Optional src = CD4CodeMill.parser().parseCDCompilationUnit(dir @@ -325,11 +325,11 @@ public void parseMaCoCo(String concrete, String ref) { fail(String.format("Parsing src: '%s', tgt: '%s'.", src.isPresent() ? "success" : "failure", tgt.isPresent() ? "success" : "failure")); } - + } catch (IOException e) { fail(e.getMessage()); } } - + } From 24b5fc860df6df379328bd32318cd6d91848b3ff Mon Sep 17 00:00:00 2001 From: Max Philip Stachon Date: Fri, 22 Aug 2025 13:20:16 +0200 Subject: [PATCH 13/17] fix OD-generation for deleted associations in Syn2SemDiff --- .../de/monticore/cddiff/syn2semdiff/Syn2SemDiff.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/Syn2SemDiff.java b/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/Syn2SemDiff.java index 66672bccc..7c332dd46 100644 --- a/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/Syn2SemDiff.java +++ b/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/Syn2SemDiff.java @@ -8,6 +8,7 @@ import de.monticore.cdbasis._ast.ASTCDClass; import de.monticore.cdbasis._ast.ASTCDCompilationUnit; import de.monticore.cdbasis._ast.ASTCDType; +import de.monticore.cddiff.CDDiffUtil; import de.monticore.cddiff.ow2cw.ReductionTrafo; import de.monticore.cddiff.syn2semdiff.datastructures.*; import de.monticore.cddiff.syn2semdiff.helpers.ODGenHelper; @@ -204,8 +205,15 @@ else if (astodArtifact.isPresent() && diffLimit == 0) { comment.append(System.lineSeparator()).append("// is/are added in ").append(attribute.a .getSymbol().getInternalQualifiedName()); - Optional srcClass = syntaxDiff.getMatchedClasses().stream().filter(p -> p.b - .equals(attribute.a)).map(p -> p.a).findFirst(); + Optional srcClass; + + if (CDDiffUtil.getAllTypesFromCD(syntaxDiff.getSrcCD()).contains(attribute.a)) { + srcClass = Optional.of(attribute.a); + } + else { + srcClass = syntaxDiff.getMatchedClasses().stream().filter(p -> p.b.equals( + attribute.a)).map(p -> p.a).findFirst(); + } if (srcClass.isPresent()) { Optional astodArtifact = generateArtifact(srcClass.get(), comment); From a27ccf35d27be5f5ba83301a9064473e9e43a853 Mon Sep 17 00:00:00 2001 From: Presiyan Date: Tue, 26 Aug 2025 09:52:03 +0200 Subject: [PATCH 14/17] Mid fix --- .../syn2semdiff/odgen/Syn2SemDiffHelper.java | 500 +++++++++--------- .../cddiff/syndiff/Syn2SemDiffTest.java | 163 +++--- 2 files changed, 332 insertions(+), 331 deletions(-) diff --git a/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/odgen/Syn2SemDiffHelper.java b/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/odgen/Syn2SemDiffHelper.java index 09f10880c..a3478f6b7 100644 --- a/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/odgen/Syn2SemDiffHelper.java +++ b/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/odgen/Syn2SemDiffHelper.java @@ -43,93 +43,93 @@ * is also implemented in this class. */ public class Syn2SemDiffHelper { - + public Syn2SemDiffHelper(CDSynDiffMatches matches) { this.matches = matches; } - + private CDSynDiffMatches matches; - + /** * Map with all possible associations (as AssocStructs) for classes from srcCD where the given * class serves as source. The non-instantiatable classes and associations are removed after the * function findOverlappingAssocs(). */ private ArrayListMultimap srcMap; - + /** * Map with all possible associations (as AssocStructs) for classes from trgCd where the given * class serves as target. The non-instantiatable classes and associations are removed after the * function findOverlappingAssocs(). */ private ArrayListMultimap tgtMap; - + /** * Map with all subclasses of a class from srcCD. This is used to reduce the complexity for * computing the underlying inheritance tree. */ private ArrayListMultimap srcSubMap; - + /** * Map with all subclasses of a class from trgCD. This is used to reduce the complexity for * computing the underlying inheritance tree. */ private ArrayListMultimap tgtSubMap; - + /** * Set with all classes that are not instantiatable in srcCD. Those are classes that cannot exist * because of overlapping. The second possibility is that the class has an attribute and a * relation to the same class, e.g., int age and -> (age) Age. */ private Set notInstClassesSrc; - + /** * Set with all classes that are not instantiatable in trgCD. Those are classes that cannot exist * because of overlapping. The second possibility is that the class has an attribute and a * relation to the same class, e.g., int age and -> (age) Age. */ private Set notInstClassesTgt; - + /** * This is a copy of the srcCD so that it can be accessed from all classes for semantic * difference. */ private ASTCDCompilationUnit srcCD; - + /** * This is a copy of the trgCD so that it can be accessed from all classes for semantic * difference. */ private ASTCDCompilationUnit tgtCD; - + /** * Those are the matched classes from the analysis of the syntax. This way some functionalities * were moved to this helper class. */ private List> matchedClasses; - + /** * Those are the matched interfaces from the analysis of the syntax. This way some functionalities * were moved to this helper class. */ private List> matchedInterfaces; - + /** * Those are the added associations from the analysis of the syntax. This way some functionalities * were moved to this helper class. */ private List addedAssocs; - + /** * Those are the deleted associations from the analysis of the syntax. This way some * functionalities were moved to this helper class. */ private List deletedAssocs; - + private BooleanMatchingStrategy matcher; private List diffs; private List matchingStrategies; - + // CHECKED public boolean isAttContainedInClass(ASTCDAttribute attribute, ASTCDType astcdClass) { int indexAttribute = attribute.getMCType().printType().lastIndexOf("."); @@ -157,74 +157,74 @@ else if (indexCurrent != -1 && indexAttribute != -1 && (att.getName().equals(att } return false; } - + public void setMatchedClasses(List> matchedClasses) { this.matchedClasses = matchedClasses; } - + public List> getMatchedClasses() { return matchedClasses; } - + public void setDiffs(List diffs) { this.diffs = diffs; } - + public List getDiffs() { return diffs; } - + public ArrayListMultimap getSrcMap() { return srcMap; } - + public ArrayListMultimap getTgtMap() { return tgtMap; } - + public ASTCDCompilationUnit getSrcCD() { return srcCD; } - + public void setSrcCD(ASTCDCompilationUnit srcCD) { this.srcCD = srcCD; } - + public ASTCDCompilationUnit getTgtCD() { return tgtCD; } - + public void setTgtCD(ASTCDCompilationUnit tgtCD) { this.tgtCD = tgtCD; } - + public Set getNotInstClassesSrc() { return notInstClassesSrc; } - + public Set getNotInstClassesTgt() { return notInstClassesTgt; } - + public ArrayListMultimap getSrcSubMap() { return srcSubMap; } - + public ArrayListMultimap getTgtSubMap() { return tgtSubMap; } - + public void setNotInstClassesSrc(Set notInstClassesSrc) { this.notInstClassesSrc = notInstClassesSrc; } - + public void setNotInstClassesTgt(Set notInstClassesTgt) { this.notInstClassesTgt = notInstClassesTgt; } - + public void updateSrc(ASTCDType astcdClass) { notInstClassesSrc.add(astcdClass); } - + public void updateTgt(ASTCDType astcdClass) { notInstClassesTgt.add(astcdClass); } - + public void setDeletedAssocs(List deletedAssocs) { this.deletedAssocs = deletedAssocs; } - + public void setAddedAssocs(List addedAssocs) { this.addedAssocs = addedAssocs; } - + public List> getMatchedInterfaces() { return matchedInterfaces; } - + public void setMatchedInterfaces(List> matchedInterfaces) { this.matchedInterfaces = matchedInterfaces; } - + public void setMatchingStrategies(List matchingStrategies) { this.matchingStrategies = matchingStrategies; } - + public boolean isSubclassWithSuper(ASTCDType superClass, ASTCDType subClass) { return isSuperOf(superClass.getSymbol().getInternalQualifiedName(), subClass.getSymbol() .getInternalQualifiedName(), srcCD); } - + /** * Get all needed associations from the src/tgtMap that use the given class as target. The * associations are strictly unidirectional. Needed associations - the cardinality must be at @@ -239,14 +239,14 @@ public List getOtherAssocs(ASTCDType astcdClass, boolean isSource, boolean makeConditionStrict) { List list = new ArrayList<>(); ArrayListMultimap map = isSource ? srcMap : tgtMap; - + for (ASTCDType classToCheck : map.keySet()) { if (classToCheck != astcdClass) { for (AssocStruct assocStruct : map.get(classToCheck)) { Pair connectedTypes; connectedTypes = Syn2SemDiffHelper.getConnectedTypes(assocStruct.getAssociation(), isSource ? srcCD : tgtCD); - + if (assocStruct.getSide().equals(ClassSide.Left) && !assocStruct.getDirection().equals( AssocDirection.BiDirectional) && (makeConditionStrict || assocStruct.getAssociation() .getLeft().getCDCardinality().isOne() || assocStruct.getAssociation().getLeft() @@ -265,7 +265,7 @@ else if (assocStruct.getSide().equals(ClassSide.Right) && !assocStruct.getDirect } return list; } - + /** * Get all needed associations (including superclasses) from the src/tgtMap that use the given * class as target. The associations are strictly unidirectional. Needed associations - the @@ -278,26 +278,26 @@ public List getAllOtherAssocs(ASTCDType astcdClass, boolean isSourc List list = new ArrayList<>(); Set superTypes = CDDiffUtil.getAllSuperTypes(astcdClass, isSource ? srcCD .getCDDefinition() : tgtCD.getCDDefinition()); - + for (ASTCDType astcdClass1 : superTypes) { list.addAll(getOtherAssocs(astcdClass1, isSource, false)); } - + return list; } - + public List getAllOtherAssocsSpecCase(ASTCDType astcdClass, boolean isSource) { List list = new ArrayList<>(); Set superTypes = CDDiffUtil.getAllSuperTypes(astcdClass, isSource ? srcCD .getCDDefinition() : tgtCD.getCDDefinition()); - + for (ASTCDType astcdClass1 : superTypes) { list.addAll(getOtherAssocs(astcdClass1, isSource, true)); } - + return list; } - + /** * Find matched type in srcCD. * @@ -315,7 +315,7 @@ else if (astcdType instanceof ASTCDInterface) { return Optional.empty(); } } - + /** * Find matched type in tgtCD. * @@ -333,7 +333,7 @@ else if (astcdType instanceof ASTCDInterface) { return Optional.empty(); } } - + public Optional findMatchedClass(ASTCDClass astcdClass) { for (Pair pair : matchedClasses) { if (pair.a.equals(astcdClass)) { @@ -342,7 +342,7 @@ public Optional findMatchedClass(ASTCDClass astcdClass) { } return Optional.empty(); } - + public Optional findMatchedSrc(ASTCDClass astcdClass) { for (Pair pair : matchedClasses) { if (pair.b.equals(astcdClass)) { @@ -351,7 +351,7 @@ public Optional findMatchedSrc(ASTCDClass astcdClass) { } return Optional.empty(); } - + public Optional findMatchedTypeSrc(ASTCDInterface astcdInterface) { for (Pair pair : matchedInterfaces) { if (pair.b.equals(astcdInterface)) { @@ -360,7 +360,7 @@ public Optional findMatchedTypeSrc(ASTCDInterface astcdInterface) { } return Optional.empty(); } - + public Optional findMatchedTypeTgt(ASTCDInterface astcdInterface) { for (Pair pair : matchedInterfaces) { if (pair.a.equals(astcdInterface)) { @@ -369,7 +369,7 @@ public Optional findMatchedTypeTgt(ASTCDInterface astcdInterface) { } return Optional.empty(); } - + public static AssocDirection getDirection(ASTCDAssociation association) { if (association.getCDAssocDir() == null) { return AssocDirection.Unspecified; @@ -384,7 +384,7 @@ public static AssocDirection getDirection(ASTCDAssociation association) { return AssocDirection.LeftToRight; } } - + /** * When merging associations, the role names of the bidirectional association are used instead of * the role names of the unidirectional. @@ -416,7 +416,7 @@ else if (association.getSide().equals(ClassSide.Right) && superAssoc.getSide().e } } } - + /** * Merge the cardinalities and the direction of two associations. * @@ -447,7 +447,7 @@ public static void mergeAssocs(AssocStruct association, AssocStruct superAssoc) .requireNonNull(cardinalityLeft))); } } - + /** * Modified version of the function inConflict in CDAssociationHelper. In the map, all association * that can be created from a class are saved in the values for this class (key). Because of that @@ -461,7 +461,7 @@ public static void mergeAssocs(AssocStruct association, AssocStruct superAssoc) public static boolean isInConflict(AssocStruct association, AssocStruct superAssociation) { ASTCDAssociation srcAssoc = association.getAssociation(); ASTCDAssociation targetAssoc = superAssociation.getAssociation(); - + if (association.getSide().equals(ClassSide.Left) && superAssociation.getSide().equals( ClassSide.Left)) { return matchRoleNames(srcAssoc.getRight(), targetAssoc.getRight()); @@ -478,10 +478,10 @@ public static boolean isInConflict(AssocStruct association, AssocStruct superAss ClassSide.Right)) { return matchRoleNames(srcAssoc.getLeft(), targetAssoc.getLeft()); } - + return false; } - + /** * Given the two associations, get the role name that causes the conflict * @@ -492,7 +492,7 @@ public static boolean isInConflict(AssocStruct association, AssocStruct superAss public static ASTCDRole getConflict(AssocStruct association, AssocStruct superAssociation) { ASTCDAssociation srcAssoc = association.getAssociation(); ASTCDAssociation targetAssoc = superAssociation.getAssociation(); - + if (association.getSide().equals(ClassSide.Left) && superAssociation.getSide().equals( ClassSide.Left) && matchRoleNames(srcAssoc.getRight(), targetAssoc.getRight())) { return srcAssoc.getRight().getCDRole(); @@ -509,7 +509,7 @@ else if (association.getSide().equals(ClassSide.Right) && superAssociation.getSi return srcAssoc.getLeft().getCDRole(); } } - + /** * Merge the directions of two associations * @@ -520,20 +520,20 @@ else if (association.getSide().equals(ClassSide.Right) && superAssociation.getSi public static ASTCDAssocDir mergeAssocDir(AssocStruct association, AssocStruct superAssociation) { AssocDirection dir1 = association.getDirection(); AssocDirection dir2 = superAssociation.getDirection(); - + if (dir1.equals(AssocDirection.BiDirectional) || dir2.equals(AssocDirection.BiDirectional)) { return CD4CodeMill.cDBiDirBuilder().build(); } - + ClassSide side1 = association.getSide(); ClassSide side2 = superAssociation.getSide(); - + boolean sameLogicalDirection = (dir1 == dir2 && side1 == side2) || (dir1 == AssocDirection.LeftToRight && dir2 == AssocDirection.RightToLeft && side1 == ClassSide.Left && side2 == ClassSide.Right) || (dir1 == AssocDirection.RightToLeft && dir2 == AssocDirection.LeftToRight && side1 == ClassSide.Right && side2 == ClassSide.Left); - + if (sameLogicalDirection) { switch (dir1) { case LeftToRight: @@ -542,10 +542,10 @@ public static ASTCDAssocDir mergeAssocDir(AssocStruct association, AssocStruct s return CD4CodeMill.cDRightToLeftDirBuilder().build(); } } - + return CD4CodeMill.cDBiDirBuilder().build(); } - + /** * Group corresponding cardinalities * @@ -583,7 +583,7 @@ else if (association.getSide().equals(ClassSide.Right) && superAssociation.getSi .getAssociation().getLeft().getCDCardinality())); } } - + /** * Transform the internal cardinality to original * @@ -604,7 +604,7 @@ else if (assocCardinality.equals(AssocCardinality.AtLeastOne)) { return new ASTCDCardMult(); } } - + /** * Check if the associations allow 0 objects from target class * @@ -616,15 +616,15 @@ public static boolean areZeroAssocs(AssocStruct association, AssocStruct superAs ASTCDCardinality assocCardinality = association.getSide().equals(ClassSide.Left) ? association .getAssociation().getRight().getCDCardinality() : association.getAssociation().getLeft() .getCDCardinality(); - + ASTCDCardinality superAssocCardinality = superAssociation.getSide().equals(ClassSide.Left) ? superAssociation.getAssociation().getRight().getCDCardinality() : superAssociation .getAssociation().getLeft().getCDCardinality(); - + return (assocCardinality.isMult() || assocCardinality.isOpt()) && (superAssocCardinality .isMult() || superAssocCardinality.isOpt()); } - + public boolean isAdded(AssocStruct assocStruct, AssocStruct assocStruct2, ASTCDType astcdClass, Set set) { for (DeleteStruct deleteStruct : set) { @@ -637,7 +637,7 @@ public boolean isAdded(AssocStruct assocStruct, AssocStruct assocStruct2, ASTCDT } return false; } - + /** * Similar to the function above, but the now the classes must be the target of the association. * @@ -663,7 +663,7 @@ public Optional allSubClassesAreTgtSrcTgt(AssocStruct matchedAssocStr } return Optional.empty(); } - + /** * Check if all matched subclasses in tgtCD/srcCD of a class from srcCD/tgtCD have the same * association or a subassociation. @@ -676,12 +676,12 @@ public Optional allSubClassesHaveIt(AssocStruct association, ASTCDTyp boolean isSource) { List subClasses = isSource ? tgtSubMap.get(type) : srcSubMap.get(type); List subTypes = getTypes(subClasses, isSource); - + for (ASTCDType subClass : subTypes) { boolean isContained = false; List assocList = isSource ? srcMap.get(subClass) : getAllOtherAssocs(subClass, false); - + for (AssocStruct assocStruct : assocList) { if (isSource) { if (sameAssociationTypeSrcTgt(assocStruct, association)) { @@ -696,14 +696,14 @@ public Optional allSubClassesHaveIt(AssocStruct association, ASTCDTyp } } } - + if (!isContained) { return Optional.ofNullable(subClass); } } return Optional.empty(); } - + /** * Check if all matched subclasses in srcCD of a class from trgCD are target of the same * association. @@ -729,7 +729,7 @@ public Optional allSubClassesAreTargetTgtSrc(AssocStruct tgtAssoc, AS } return Optional.empty(); } - + /** * Check if the classes are in an inheritance relation. For this, the matched classes in * srcCD/tgtCD of the tgtClass/srcClass are compared with isSuper() to the srcClass. @@ -743,7 +743,7 @@ public boolean compareTypes(ASTCDType type1, ASTCDType type2, boolean isSource) type2); Optional type1Matched = isSource ? findMatchedTypeTgt(type1) : findMatchedTypeSrc( type1); - + return typeToMatch.filter(astcdType -> isSuperOf(astcdType.getSymbol() .getInternalQualifiedName(), type1.getSymbol().getInternalQualifiedName(), (ICD4CodeArtifactScope) (isSource ? srcCD.getEnclosingScope() : tgtCD.getEnclosingScope()))) @@ -752,7 +752,7 @@ public boolean compareTypes(ASTCDType type1, ASTCDType type2, boolean isSource) type1Matched.get())) : (typeToMatch.isPresent() && srcSubMap.get(type1).contains( typeToMatch.get()))); } - + /** * Check if the srcType has the given association from srcCD. * @@ -768,7 +768,7 @@ public boolean classHasAssociationSrcSrc(AssocStruct association, ASTCDType srcT } return false; } - + /** * Check if the srcType has the given association from tgtCD. * @@ -784,7 +784,7 @@ public boolean classHasAssociationTgtSrc(AssocStruct tgtStruct, ASTCDType srcTyp } return false; } - + public boolean classHasAssociationTgtSrcRev(AssocStruct tgtStruct, ASTCDType srcType) { for (AssocStruct assocStruct1 : srcMap.get(srcType)) { if (sameAssociationTypeSrcTgtRev(assocStruct1, tgtStruct)) { @@ -793,7 +793,7 @@ public boolean classHasAssociationTgtSrcRev(AssocStruct tgtStruct, ASTCDType src } return false; } - + /** * Check if the tgtType has the given association from srcCD. * @@ -809,7 +809,7 @@ public boolean classHasAssociationSrcTgt(AssocStruct assocStruct, ASTCDType tgtT } return false; } - + /** * Check if the srcType is target of the given association from srcCD. * @@ -825,7 +825,7 @@ public boolean classIsTarget(AssocStruct association, ASTCDType srcType) { } return false; } - + /** * Check if the tgtType is target of the given association from srcCD. * @@ -841,7 +841,7 @@ public boolean classIsTgtSrcTgt(AssocStruct association, ASTCDType tgtType) { } return false; } - + /** * Check if the srcType is target of the given association from tgtCD. * @@ -857,7 +857,7 @@ public boolean classIsTargetTgtSrc(AssocStruct association, ASTCDType srcType) { } return false; } - + public boolean classIsTargetTgtSrcRev(AssocStruct association, ASTCDType srcType) { for (AssocStruct assocStruct : getAllOtherAssocs(srcType, true)) { if (sameAssociationTypeSrcTgtRev(assocStruct, association)) { @@ -866,10 +866,10 @@ public boolean classIsTargetTgtSrcRev(AssocStruct association, ASTCDType srcType } return false; } - + public List getTypes(List types, boolean isSource) { List resultTypes = new ArrayList<>(); - + for (ASTCDType astcdType : types) { if (astcdType instanceof ASTCDClass) { Optional matched = isSource ? findMatchedSrc((ASTCDClass) astcdType) @@ -884,7 +884,7 @@ else if (astcdType instanceof ASTCDInterface) { } return resultTypes; } - + /** * Check if two associations are exactly the same. * @@ -907,7 +907,7 @@ public boolean sameAssociation(ASTCDAssociation association, ASTCDAssociation as } return false; } - + /** * Check if the target classes of the two associations are in an inheritance relation * @@ -942,7 +942,7 @@ else if (association.getSide().equals(ClassSide.Right) && superAssociation.getSi (ICD4CodeArtifactScope) compilationUnit.getEnclosingScope()); } } - + public boolean inheritanceTgt(AssocStruct assocStruct, AssocStruct assocStruct1) { if (assocStruct.getSide().equals(ClassSide.Left) && assocStruct1.getSide().equals( ClassSide.Left)) { @@ -964,7 +964,7 @@ else if (assocStruct.getSide().equals(ClassSide.Right) && assocStruct1.getSide() getConnectedTypes(assocStruct.getAssociation(), srcCD).a, false); } } - + /** * Get all attributes that need to be added from inheritance structure to an object of a given * type @@ -983,7 +983,7 @@ public Pair> getAllAttr(ASTCDType astcdClass) { } return new Pair<>(astcdClass, attributes); } - + public Pair> getAllAttrTgt(ASTCDType astcdClass) { List attributes = new ArrayList<>(); Set classes = getAllSuper(astcdClass, (ICD4CodeArtifactScope) tgtCD @@ -995,7 +995,7 @@ public Pair> getAllAttrTgt(ASTCDType astcdClass) } return new Pair<>(astcdClass, attributes); } - + /** * Check if the srcAssoc has the same type as the srcAssoc1 - direction, role names and the * cardinalities of srcAssoc are sub-intervals of the cardinalities of srcAssoc1. @@ -1014,7 +1014,7 @@ public boolean sameAssociationType(AssocStruct srcAssocSub, AssocStruct srcAssoc return compareAssociations(srcAssocSuper, srcAssocSub, false); } } - + private boolean compareAssociations(AssocStruct superAssoc, AssocStruct subAssoc, boolean sameSides) { // Compare role names, cardinality, and direction for both sides (left and right) @@ -1044,7 +1044,7 @@ private boolean compareAssociations(AssocStruct superAssoc, AssocStruct subAssoc .getAssociation().getLeft() .getCDCardinality())); } - + /** * Check if the srcAssoc has the same type as the tgtAssoc - direction, role names and the * cardinalities of srcAssoc are sub-intervals of the cardinalities of tgtAssoc. @@ -1062,7 +1062,7 @@ public boolean sameAssociationTypeSrcTgt(AssocStruct srcAssocSub, AssocStruct tg .equals(ClassSide.Right); boolean isRightLeft = srcAssocSub.getSide().equals(ClassSide.Right) && tgtAssocSuper.getSide() .equals(ClassSide.Left); - + if (isLeftLeft || isRightRight) { return matchRoleNames(srcAssocSub.getAssociation().getLeft(), tgtAssocSuper.getAssociation() .getLeft()) && matchRoleNames(srcAssocSub.getAssociation().getRight(), tgtAssocSuper @@ -1072,11 +1072,11 @@ public boolean sameAssociationTypeSrcTgt(AssocStruct srcAssocSub, AssocStruct tg tgtCD).a, true) && compareTypes(getConnectedTypes(srcAssocSub .getAssociation(), srcCD).b, getConnectedTypes(tgtAssocSuper .getAssociation(), tgtCD).b, true) && isContainedIn(cardToEnum( - srcAssocSub.getAssociation().getLeft().getCDCardinality()), - cardToEnum(tgtAssocSuper.getAssociation().getLeft() + tgtAssocSuper.getAssociation().getLeft().getCDCardinality()), + cardToEnum(srcAssocSub.getAssociation().getLeft() .getCDCardinality())) && isContainedIn(cardToEnum( - srcAssocSub.getAssociation().getRight() - .getCDCardinality()), cardToEnum(tgtAssocSuper + tgtAssocSuper.getAssociation().getRight() + .getCDCardinality()), cardToEnum(srcAssocSub .getAssociation().getRight() .getCDCardinality())); } @@ -1089,18 +1089,18 @@ else if (isLeftRight || isRightLeft) { tgtCD).b, true) && compareTypes(getConnectedTypes(srcAssocSub .getAssociation(), srcCD).b, getConnectedTypes(tgtAssocSuper .getAssociation(), tgtCD).a, true) && isContainedIn(cardToEnum( - srcAssocSub.getAssociation().getLeft().getCDCardinality()), - cardToEnum(tgtAssocSuper.getAssociation().getRight() + tgtAssocSuper.getAssociation().getLeft().getCDCardinality()), + cardToEnum(srcAssocSub.getAssociation().getRight() .getCDCardinality())) && isContainedIn(cardToEnum( - srcAssocSub.getAssociation().getRight() - .getCDCardinality()), cardToEnum(tgtAssocSuper + tgtAssocSuper.getAssociation().getRight() + .getCDCardinality()), cardToEnum(srcAssocSub .getAssociation().getLeft() .getCDCardinality())); } - + return false; } - + public boolean sameAssociationTypeSrcTgtRev(AssocStruct srcAssocSub, AssocStruct tgtAssocSuper) { boolean isLeftLeft = srcAssocSub.getSide().equals(ClassSide.Left) && tgtAssocSuper.getSide() .equals(ClassSide.Left); @@ -1110,7 +1110,7 @@ public boolean sameAssociationTypeSrcTgtRev(AssocStruct srcAssocSub, AssocStruct .equals(ClassSide.Right); boolean isRightLeft = srcAssocSub.getSide().equals(ClassSide.Right) && tgtAssocSuper.getSide() .equals(ClassSide.Left); - + if (isLeftRight || isRightLeft) { return matchRoleNames(srcAssocSub.getAssociation().getLeft(), tgtAssocSuper.getAssociation() .getLeft()) && matchRoleNames(srcAssocSub.getAssociation().getRight(), tgtAssocSuper @@ -1120,11 +1120,11 @@ public boolean sameAssociationTypeSrcTgtRev(AssocStruct srcAssocSub, AssocStruct tgtCD).a, true) && compareTypes(getConnectedTypes(srcAssocSub .getAssociation(), srcCD).b, getConnectedTypes(tgtAssocSuper .getAssociation(), tgtCD).b, true) && isContainedIn(cardToEnum( - srcAssocSub.getAssociation().getLeft().getCDCardinality()), - cardToEnum(tgtAssocSuper.getAssociation().getLeft() + tgtAssocSuper.getAssociation().getLeft().getCDCardinality()), + cardToEnum(srcAssocSub.getAssociation().getLeft() .getCDCardinality())) && isContainedIn(cardToEnum( - srcAssocSub.getAssociation().getRight() - .getCDCardinality()), cardToEnum(tgtAssocSuper + tgtAssocSuper.getAssociation().getRight() + .getCDCardinality()), cardToEnum(srcAssocSub .getAssociation().getRight() .getCDCardinality())); } @@ -1137,18 +1137,18 @@ else if (isLeftLeft || isRightRight) { tgtCD).b, true) && compareTypes(getConnectedTypes(srcAssocSub .getAssociation(), srcCD).b, getConnectedTypes(tgtAssocSuper .getAssociation(), tgtCD).a, true) && isContainedIn(cardToEnum( - srcAssocSub.getAssociation().getLeft().getCDCardinality()), - cardToEnum(tgtAssocSuper.getAssociation().getRight() + tgtAssocSuper.getAssociation().getLeft().getCDCardinality()), + cardToEnum(srcAssocSub.getAssociation().getRight() .getCDCardinality())) && isContainedIn(cardToEnum( - srcAssocSub.getAssociation().getRight() - .getCDCardinality()), cardToEnum(tgtAssocSuper + tgtAssocSuper.getAssociation().getRight() + .getCDCardinality()), cardToEnum(srcAssocSub .getAssociation().getLeft() .getCDCardinality())); } - + return false; } - + /** * Given the following two cardinalities, find their intersection * @@ -1202,7 +1202,7 @@ else if (cardinalityB.equals(AssocCardinality.Multiple) || cardinalityB.equals( } return null; } - + /** * This is the same function from CDDefinition, but it compares the classes based on the qualified * name of the class. @@ -1214,7 +1214,7 @@ public List getCDAssociationsListForType(ASTCDType type, boole List result = new ArrayList<>(); List associationsList = isSource ? srcCD.getCDDefinition() .getCDAssociationsList() : tgtCD.getCDDefinition().getCDAssociationsList(); - + for (ASTCDAssociation association : associationsList) { if (association.getLeftQualifiedName().getQName().equals(type.getSymbol() .getInternalQualifiedName()) && association.getCDAssocDir() @@ -1228,7 +1228,7 @@ else if (association.getRightQualifiedName().getQName().equals(type.getSymbol() } return result; } - + /** * Compute what associations can be used from a class (associations that were from the class and * superAssociations). For each class and each possible association we save the direction and also @@ -1244,28 +1244,28 @@ public void setMaps() { findNonInstantiableClasses(); checkRoleNameConflicts(); } - + private void processSourceTypes() { List srcTypes = getTypes(srcCD); for (ASTCDType astcdClass : srcTypes) { processAssociations(astcdClass, getCDAssociationsListForType(astcdClass, true), true); } } - + private void processTargetTypes() { List tgtTypes = getTypes(tgtCD); for (ASTCDType astcdClass : tgtTypes) { processAssociations(astcdClass, getCDAssociationsListForType(astcdClass, false), false); } } - + private List getTypes(ASTCDCompilationUnit compilationUnit) { List types = new ArrayList<>(); types.addAll(compilationUnit.getCDDefinition().getCDClassesList()); types.addAll(compilationUnit.getCDDefinition().getCDInterfacesList()); return types; } - + private void processAssociations(ASTCDType astcdClass, List associations, boolean isSource) { for (ASTCDAssociation astcdAssociation : associations) { @@ -1273,10 +1273,10 @@ private void processAssociations(ASTCDType astcdClass, List as : tgtCD); if (pair.a == null) continue; - + ASTCDAssociation copyAssoc = createVirtualAssociation(astcdAssociation); updateAssociationRoles(copyAssoc, astcdAssociation); - + if (isSource) { handleAssociationMapping(astcdClass, astcdAssociation, pair, copyAssoc, srcMap); } @@ -1285,14 +1285,14 @@ private void processAssociations(ASTCDType astcdClass, List as } } } - + private ASTCDAssociation createVirtualAssociation(ASTCDAssociation original) { ASTCDAssociation copyAssoc = original.deepClone(); copyAssoc.setName(" "); ensureCardinalities(copyAssoc); return copyAssoc; } - + private void ensureCardinalities(ASTCDAssociation assoc) { if (!assoc.getLeft().isPresentCDCardinality()) { assoc.getLeft().setCDCardinality(CD4CodeMill.cDCardMultBuilder().build()); @@ -1304,14 +1304,14 @@ private void ensureCardinalities(ASTCDAssociation assoc) { assoc.getLeft().setCDCardinality(CD4CodeMill.cDCardOneBuilder().build()); } } - + private void updateAssociationRoles(ASTCDAssociation copyAssoc, ASTCDAssociation original) { copyAssoc.getLeft().setCDRole(CD4CodeMill.cDRoleBuilder().setName(CDDiffUtil.inferRole(original .getLeft())).build()); copyAssoc.getRight().setCDRole(CD4CodeMill.cDRoleBuilder().setName(CDDiffUtil.inferRole(original .getRight())).build()); } - + private void handleAssociationMapping(ASTCDType astcdClass, ASTCDAssociation original, Pair pair, ASTCDAssociation copyAssoc, ArrayListMultimap map) { @@ -1326,7 +1326,7 @@ else if (pair.b.getSymbol().getInternalQualifiedName().equals(astcdClass.getSymb false, null)); } } - + private AssocStruct createAssocStruct(ASTCDAssociation assoc, ASTCDAssociation original, ASTCDType astcdType, ASTCDType connectedType, ClassSide side, Boolean isSuperAssoc, ASTCDType superClass) { @@ -1336,34 +1336,34 @@ private AssocStruct createAssocStruct(ASTCDAssociation assoc, ASTCDAssociation o } return new AssocStruct(assoc, direction, side, true, superClass, connectedType, original); } - + private AssocDirection determineAssocDirection(ASTCDAssociation assoc, ClassSide side) { if (assoc.getCDAssocDir().isBidirectional()) { return AssocDirection.BiDirectional; } return side == ClassSide.Left ? AssocDirection.LeftToRight : AssocDirection.RightToLeft; } - + private void inheritAssociations(ASTCDCompilationUnit compilationUnit, boolean isSource) { List types = getTypes(compilationUnit); for (ASTCDType astcdClass : types) { Set superTypes = CDDiffUtil.getAllSuperTypes(astcdClass, compilationUnit .getCDDefinition()); superTypes.remove(astcdClass); - + for (ASTCDType superClass : superTypes) { List associations = getCDAssociationsListForType(superClass, isSource); for (ASTCDAssociation assoc : associations) { Pair pair = getConnectedTypes(assoc, compilationUnit); if (pair.a == null) continue; - + processInheritedAssociation(astcdClass, assoc, superClass, pair, isSource); } } } } - + private void processInheritedAssociation(ASTCDType subClass, ASTCDAssociation assoc, ASTCDType superClass, Pair pair, boolean isSource) { ArrayListMultimap map = isSource ? srcMap : tgtMap; @@ -1380,14 +1380,14 @@ private void processInheritedAssociation(ASTCDType subClass, ASTCDAssociation as superClass)); } } - + private ASTCDAssociation createInheritedAssoc(ASTCDAssociation original, ASTCDType subClass, ClassSide side) { ASTCDAssociation assoc = original.deepClone(); assoc.setName(" "); updateAssociationRoles(assoc, original); ensureCardinalities(assoc); - + if (side == ClassSide.Left) { assoc.getLeft().setMCQualifiedType(createQualifiedType(subClass)); } @@ -1396,17 +1396,17 @@ private ASTCDAssociation createInheritedAssoc(ASTCDAssociation original, ASTCDTy } return assoc; } - + private ASTMCQualifiedType createQualifiedType(ASTCDType type) { return CD4CodeMill.mCQualifiedTypeBuilder().setMCQualifiedName(MCQualifiedNameFacade .createQualifiedName(type.getSymbol().getInternalQualifiedName())).build(); } - + private void findNonInstantiableClasses() { findDuplicateAttributes(srcCD, notInstClassesSrc, true); findDuplicateAttributes(tgtCD, notInstClassesTgt, false); } - + private void findDuplicateAttributes(ASTCDCompilationUnit compilationUnit, Set notInstClasses, boolean isSource) { for (ASTCDClass astcdClass : compilationUnit.getCDDefinition().getCDClassesList()) { @@ -1424,12 +1424,12 @@ private void findDuplicateAttributes(ASTCDCompilationUnit compilationUnit, } } } - + private void checkRoleNameConflicts() { checkRoleNameConflicts(srcCD, notInstClassesSrc, true); checkRoleNameConflicts(tgtCD, notInstClassesTgt, false); } - + private void checkRoleNameConflicts(ASTCDCompilationUnit compilationUnit, Set notInstClasses, boolean isSource) { for (ASTCDClass astcdClass : compilationUnit.getCDDefinition().getCDClassesList()) { @@ -1443,7 +1443,7 @@ private void checkRoleNameConflicts(ASTCDCompilationUnit compilationUnit, } } } - + /** Compute the subtypes for each type in the diagrams. */ public void setSubMaps() { srcSubMap = ArrayListMultimap.create(); @@ -1453,13 +1453,13 @@ public void setSubMaps() { srcSubMap.put(astcdClass, subClass); } } - + for (ASTCDClass astcdClass : tgtCD.getCDDefinition().getCDClassesList()) { for (ASTCDClass subClass : getSpannedInheritance(tgtCD, astcdClass)) { tgtSubMap.put(astcdClass, subClass); } } - + List interfaces = srcCD.getCDDefinition().getCDInterfacesList(); for (ASTCDInterface astcdInterface : interfaces) { for (ASTCDClass astcdClass : srcCD.getCDDefinition().getCDClassesList()) { @@ -1479,13 +1479,13 @@ public void setSubMaps() { } } } - + // Helper method to process interfaces and classes for superclass relationship private void processInterfacesAndClasses(ASTCDCompilationUnit cdUnit, ArrayListMultimap subMap) { List interfaces = cdUnit.getCDDefinition().getCDInterfacesList(); List classes = cdUnit.getCDDefinition().getCDClassesList(); - + for (ASTCDInterface astcdInterface : interfaces) { for (ASTCDClass astcdClass : classes) { if (CDInheritanceHelper.isSuperOf(astcdInterface.getSymbol().getInternalQualifiedName(), @@ -1495,14 +1495,14 @@ private void processInterfacesAndClasses(ASTCDCompilationUnit cdUnit, } } } - + private boolean sameRoleNameAndClass(String roleName, ASTCDClass astcdClass, boolean isSource) { String roleName1 = roleName.substring(0, 1).toUpperCase() + roleName.substring(1); - + // Determine which map and CD to use based on whether it's source or target ArrayListMultimap mapToUse = isSource ? srcMap : tgtMap; ASTCDCompilationUnit cdToUse = isSource ? srcCD : tgtCD; - + for (AssocStruct assocStruct : mapToUse.get(astcdClass)) { if (assocStruct.getSide().equals(ClassSide.Left)) { if (CDDiffUtil.inferRole(assocStruct.getAssociation().getRight()).equals(roleName) @@ -1521,7 +1521,7 @@ && getConnectedTypes(assocStruct.getAssociation(), cdToUse).a.getName().equals( } return false; } - + /** * Get the classes that are connected with the association. The function returns null if the * associated objects aren't classes. @@ -1542,7 +1542,7 @@ public static Pair getConnectedTypes(ASTCDAssociation asso Log.error("Could not resolve types of :" + CD4CodeMill.prettyPrint(association, false)); return new Pair<>(null, null); } - + /** * Compute the types that extend a given class. * @@ -1563,7 +1563,7 @@ public static List getSpannedInheritance(ASTCDCompilationUnit compil subclasses.remove(astcdClass); return subclasses; } - + /** * Check if the first cardinality is contained in the second cardinality. * @@ -1588,7 +1588,7 @@ else if (cardinality1.equals(AssocCardinality.AtLeastOne)) { return false; } } - + public static AssocCardinality cardToEnum(ASTCDCardinality cardinality) { if (cardinality.isOne()) { return AssocCardinality.One; @@ -1603,7 +1603,7 @@ else if (cardinality.isAtLeastOne()) { return AssocCardinality.Multiple; } } - + /** * Get the minimal non-abstract subclass(strict subclass) of a given type. The minimal subclass is * the subclass with the least amount of attributes and associations(ingoing and outgoing). @@ -1615,11 +1615,11 @@ else if (cardinality.isAtLeastOne()) { public Optional minSubClass(ASTCDType baseClass, boolean isSource) { ArrayListMultimap subMap = isSource ? srcSubMap : tgtSubMap; Set notInstClasses = isSource ? notInstClassesSrc : notInstClassesTgt; - + List subClasses = subMap.get(baseClass); int lowestCount = Integer.MAX_VALUE; ASTCDClass subclassWithLowestCount = null; - + for (ASTCDClass subclass : subClasses) { if (!subclass.getModifier().isAbstract() && !notInstClasses.contains(subclass)) { int attributeCount; @@ -1632,23 +1632,23 @@ public Optional minSubClass(ASTCDType baseClass, boolean isSource) { int associationCount = getAssociationCount(subclass, isSource); int otherAssocsCount = getAllOtherAssocs(subclass, isSource).size(); int totalCount = attributeCount + associationCount + otherAssocsCount; - + if (totalCount < lowestCount) { lowestCount = totalCount; subclassWithLowestCount = subclass; } } } - + return Optional.ofNullable(subclassWithLowestCount); } - + public int getAssociationCount(ASTCDType astcdClass, boolean isSource) { int count = 0; // Determine which map and CD to use based on whether it's source or target ArrayListMultimap mapToUse = isSource ? srcMap : tgtMap; ASTCDCompilationUnit cdToUse = isSource ? srcCD : tgtCD; - + for (AssocStruct assocStruct : mapToUse.get(astcdClass)) { if (assocStruct.getSide().equals(ClassSide.Left)) { if ((assocStruct.getAssociation().getRight().getCDCardinality().isAtLeastOne() @@ -1671,7 +1671,7 @@ public int getAssociationCount(ASTCDType astcdClass, boolean isSource) { } return count; } - + /** * Check if the directions match in reverse. * @@ -1697,7 +1697,7 @@ public boolean matchDirectionInReverse(AssocStruct srcStruct, AssocDirection.RightToLeft) && tgtStruct.a.getDirection().equals( AssocDirection.LeftToRight))); } - + public static boolean matchDirection(AssocStruct srcStruct, Pair tgtStruct) { if (((srcStruct.getSide().equals(ClassSide.Left) && tgtStruct.b.equals(ClassSide.Left)) @@ -1715,7 +1715,7 @@ public static boolean matchDirection(AssocStruct srcStruct, AssocDirection.RightToLeft) && tgtStruct.a.getDirection().equals( AssocDirection.LeftToRight))); } - + public boolean sameAssocStruct(AssocStruct srcStruct, AssocStruct tgtStruct) { return CDDiffUtil.inferRole(srcStruct.getAssociation().getLeft()).equals(CDDiffUtil.inferRole( tgtStruct.getAssociation().getLeft())) && CDDiffUtil.inferRole(srcStruct.getAssociation() @@ -1725,7 +1725,7 @@ && matchDirection(srcStruct, new Pair<>(tgtStruct, tgtStruct.getSide())) && matc && matchRoleNames(srcStruct.getAssociation().getRight(), tgtStruct.getAssociation() .getRight()); } - + public boolean sameAssocStructInReverse(AssocStruct struct, AssocStruct tgtStruct) { return CDDiffUtil.inferRole(struct.getAssociation().getLeft()).equals(CDDiffUtil.inferRole( tgtStruct.getAssociation().getRight())) && CDDiffUtil.inferRole(struct.getAssociation() @@ -1734,7 +1734,7 @@ && matchDirectionInReverse(struct, new Pair<>(tgtStruct, tgtStruct.getSide())) && matchRoleNames(struct.getAssociation().getLeft(), tgtStruct.getAssociation().getRight()) && matchRoleNames(struct.getAssociation().getRight(), tgtStruct.getAssociation().getLeft()); } - + /** * Compare associations. If for a pair of associations one of them is a subassociation and a loop * association, the other one is marked so that it won't be looked at for generation of object @@ -1753,7 +1753,7 @@ public void reduceMaps() { } } } - + public boolean sameAssociationSpec(ASTCDAssociation association, ASTCDAssociation association2) { Pair cardinalities = getCardinality(association2); Pair conncected1 = getConnectedTypes(association, srcCD); @@ -1769,12 +1769,12 @@ && cardToEnum(association.getRight().getCDCardinality()).equals(cardToEnum( } return false; } - + public boolean isLoopStruct(AssocStruct assocStruct) { Pair pair = getConnectedTypes(assocStruct.getAssociation(), srcCD); return pair.a.equals(pair.b); } - + /** * Delete all associations that use the given type as target. * @@ -1785,9 +1785,9 @@ public void deleteOtherSide(ASTCDType astcdType, boolean isSource) { // Select the map and CD to use based on whether it's source or target ArrayListMultimap mapToUse = isSource ? srcMap : tgtMap; ASTCDCompilationUnit cdToUse = isSource ? srcCD : tgtCD; - + List>> toDelete = new ArrayList<>(); - + for (ASTCDType toCheck : mapToUse.keySet()) { if (toCheck != astcdType) { List toDeleteStructs = new ArrayList<>(); @@ -1806,7 +1806,7 @@ else if (struct.getSide().equals(ClassSide.Right) && getConnectedTypes(struct toDelete.add(new Pair<>(toCheck, toDeleteStructs)); } } - + // Remove the structures from the map for (Pair> pair : toDelete) { for (AssocStruct struct : pair.b) { @@ -1814,7 +1814,7 @@ else if (struct.getSide().equals(ClassSide.Right) && getConnectedTypes(struct } } } - + /** * Delete the association from the other associated type. * @@ -1826,7 +1826,7 @@ public void deleteAssocOtherSide(AssocStruct assocStruct, boolean isSource) { // Select the appropriate map and CD based on the isSource flag ArrayListMultimap mapToUse = isSource ? srcMap : tgtMap; ASTCDCompilationUnit cdToUse = isSource ? srcCD : tgtCD; - + if (assocStruct.getSide().equals(ClassSide.Left)) { // Get the associated types on the right side ASTCDType connectedTypeB = getConnectedTypes(assocStruct.getAssociation(), cdToUse).b; @@ -1857,7 +1857,7 @@ && sameAssocStruct(assocStruct, struct)) { } } } - + /** * This function is used when the object diagrams are derived under simple semantics. The function * changes the stereotype to contain only the base type of the object without the superclasses. @@ -1881,7 +1881,7 @@ public void makeSimpleSem(List list) { } } } - + /** * Get the cardinalities of an association. * @@ -1897,7 +1897,7 @@ public Pair getCardinality(ASTCDAssociation else { left = association.getLeft().getCDCardinality(); } - + if (!association.getRight().isPresentCDCardinality()) { right = new ASTCDCardMult(); } @@ -1906,7 +1906,7 @@ public Pair getCardinality(ASTCDAssociation } return new Pair<>(left, right); } - + /** * Get the matching AssocStructs for a given pair. The id 'unmodifiedAssoc' is used to identify * the association in the map. @@ -1928,7 +1928,7 @@ public Pair getStructsForAssocDiff(ASTCDAssociation sr else if (getAssocStructByUnmod(srcCLasses.b, srcAssoc, true).isPresent()) { srcStruct = getAssocStructByUnmod(srcCLasses.b, srcAssoc, true).get(); } - + if (!reversed && getAssocStructByUnmod(tgtCLasses.a, tgtAssoc, false).isPresent()) { tgtStruct = getAssocStructByUnmod(tgtCLasses.a, tgtAssoc, false).get(); } @@ -1937,7 +1937,7 @@ else if (getAssocStructByUnmod(tgtCLasses.b, tgtAssoc, false).isPresent()) { } return new Pair<>(srcStruct, tgtStruct); } - + /** * Get the matching AssocStructs for a given association in srcCD/tgtCD. * @@ -1951,7 +1951,7 @@ public Optional getAssocStructByUnmod(ASTCDType astcdType, // Select the appropriate map and CD based on the isSource flag ArrayListMultimap mapToUse = isSource ? srcMap : tgtMap; ASTCDCompilationUnit cdToUse = isSource ? srcCD : tgtCD; - + // Iterate through the AssocStructs for the given ASTCDType for (AssocStruct struct : mapToUse.get(astcdType)) { if (sameAssociation(struct.getUnmodifiedAssoc(), association, cdToUse)) { @@ -1960,7 +1960,7 @@ public Optional getAssocStructByUnmod(ASTCDType astcdType, } return Optional.empty(); } - + /** * Check if the superclasses of the given one are the same in the source and target diagram. * @@ -1999,7 +1999,7 @@ public boolean hasDiffSuper(ASTCDType astcdType) { } return false; } - + /** * Delete associations from srcMap with a specific role name * @@ -2034,7 +2034,7 @@ public void deleteAssocsFromSrc(ASTCDType astcdClass, ASTCDRole role) { } } } - + public boolean isOtherSideNeeded(AssocStruct assocStruct) { if (assocStruct.getSide().equals(ClassSide.Left) && (assocStruct.getAssociation().getRight() .getCDCardinality().isOne() || assocStruct.getAssociation().getRight().getCDCardinality() @@ -2045,7 +2045,7 @@ public boolean isOtherSideNeeded(AssocStruct assocStruct) { .getCDCardinality().isOne() || assocStruct.getAssociation().getLeft().getCDCardinality() .isAtLeastOne()); } - + /** * Check for all compositions if a subcomponent cannot be instantiated. If this is the case, the * composite class cannot be instantiated either. @@ -2067,7 +2067,7 @@ && minSubClass(pair.b, true).isEmpty())) { } } } - + for (ASTCDType astcdType : tgtMap.keySet()) { for (ASTCDAssociation association : getCDAssociationsListForType(astcdType, false)) { Pair pair = Syn2SemDiffHelper.getConnectedTypes(association, tgtCD); @@ -2085,7 +2085,7 @@ && minSubClass(pair.b, false).isEmpty())) { } } } - + /** * Delete associations from trgMap with a specific role name * @@ -2120,7 +2120,7 @@ public void deleteAssocsFromTgt(ASTCDType astcdClass, ASTCDRole role) { } } } - + public List deletedAssocsForClass(ASTCDType astcdClass) { List list = new ArrayList<>(); for (ASTCDAssociation association : deletedAssocs) { @@ -2129,7 +2129,7 @@ public List deletedAssocsForClass(ASTCDType astcdClass) { } return list; } - + /** * Search for an association in srcCD that can't be matched with an association in tgtCD. * @@ -2192,12 +2192,12 @@ else if ((matchingStrategies.isEmpty() || matchingStrategies.contains( } return list; } - + public boolean containedInList(AssocStruct srcStruct, AssocStruct tgtAssocStruct) { return diffs.stream().anyMatch(obj -> obj.getSrcElem() == srcStruct.getUnmodifiedAssoc() && obj .getTgtElem() == tgtAssocStruct.getUnmodifiedAssoc()); } - + /** * Search for an association in tgtCD that can't be matched with an association in srcCD. * @@ -2248,7 +2248,7 @@ else if ((matchingStrategies.isEmpty() || matchingStrategies.contains( } return list; } - + public List addedAssocsForClass(ASTCDType astcdClass) { List list = new ArrayList<>(); for (ASTCDAssociation association : addedAssocs) { @@ -2257,7 +2257,7 @@ public List addedAssocsForClass(ASTCDType astcdClass) { } return list; } - + /** * Get two non-abstract subclasses for a given pair. * @@ -2319,7 +2319,7 @@ else if (possibleClassToUseForRightSideBasedOnRightTgt != null && srcSubMap.get( } return null; } - + public static ASTCDClass getCDClass(ASTCDCompilationUnit compilationUnit, String className) { for (ASTCDClass astcdClass : compilationUnit.getCDDefinition().getCDClassesList()) { if (astcdClass.getSymbol().getInternalQualifiedName().equals(className)) { @@ -2328,7 +2328,7 @@ public static ASTCDClass getCDClass(ASTCDCompilationUnit compilationUnit, String } return null; } - + /** * Check what the changes to the stereotype of a class are. * @@ -2350,7 +2350,7 @@ public Pair stereotypeChange(ASTCDClass newClass, ASTCDClass o } return new Pair<>(abstractChange, singletonChange); } - + /** * Sort the associations for a given type so that pairs aren't duplicated. * @@ -2424,13 +2424,13 @@ else if (assocStruct.getSide().equals(ClassSide.Right) && assocStruct1.getSide() } return new OverlappingAssocsDirect(directOverlappingAssocs, directOverlappingNoRelation); } - + public OverlappingAssocsDirect computeDirectForTypeNew(ASTCDType astcdType, ArrayListMultimap map, ASTCDCompilationUnit compilationUnit) { - + Set> directOverlappingAssocs = new HashSet<>(); Set> directOverlappingNoRelation = new HashSet<>(); - + List assocStructs = map.get(astcdType); for (AssocStruct assoc1 : assocStructs) { for (AssocStruct assoc2 : assocStructs) { @@ -2440,17 +2440,17 @@ public OverlappingAssocsDirect computeDirectForTypeNew(ASTCDType astcdType, compilationUnit); Pair types2 = getConnectedTypes(assoc2.getAssociation(), compilationUnit); - + if (areTypesValid(types1, types2)) { AssocStruct sub = assoc1; AssocStruct sup = assoc2; - + if (isSwappable(assoc1, assoc2, types1, types2)) { sub = assoc2; sup = assoc1; } updateAssocUsage(sub, sup, compilationUnit); - + directOverlappingAssocs.add(new Pair<>(sub, sup)); } } @@ -2459,17 +2459,17 @@ public OverlappingAssocsDirect computeDirectForTypeNew(ASTCDType astcdType, } return new OverlappingAssocsDirect(directOverlappingAssocs, directOverlappingNoRelation); } - + private boolean pairExists(Set> set, AssocStruct a, AssocStruct b) { return set.stream().anyMatch(pair -> (pair.a == b && pair.b == a)); } - + private boolean areTypesValid(Pair pair1, Pair pair2) { return pair1.a != null && pair1.b != null && pair2.a != null && pair2.b != null; } - + private boolean isSwappable(AssocStruct assoc1, AssocStruct assoc2, Pair pair1, Pair pair2) { return assoc1.getSide().equals(ClassSide.Left) && assoc2.getSide().equals(ClassSide.Left) @@ -2480,7 +2480,7 @@ private boolean isSwappable(AssocStruct assoc1, AssocStruct assoc2, pair2.a) || assoc1.getSide().equals(ClassSide.Right) && assoc2.getSide().equals( ClassSide.Left) && pair1.a.equals(pair2.b) && pair1.b.equals(pair2.a); } - + private void updateAssocUsage(AssocStruct sub, AssocStruct sup, ASTCDCompilationUnit compilationUnit) { setOtherSideUsage(sub, AssocType.SUB, compilationUnit); @@ -2492,7 +2492,7 @@ private void updateAssocUsage(AssocStruct sub, AssocStruct sup, sup.setUsedAs(AssocType.SUPER); } } - + /** * Get the pairs of duplicated associations for a given type * @@ -2523,7 +2523,7 @@ public List> getPairsForType(ASTCDType astcdType, } return list; } - + public void setOtherSideUsage(AssocStruct assocStruct, AssocType assocType, ASTCDCompilationUnit compilationUnit) { if (assocStruct.getDirection().equals(AssocDirection.BiDirectional)) { @@ -2553,34 +2553,34 @@ && sameAssocStruct(assocStruct, struct)) { } } } - + public void filterMatched() { matchedClasses.removeIf(pair -> !pair.a.getSymbol().getInternalQualifiedName().equals(pair.b .getSymbol().getInternalQualifiedName())); - + matchedInterfaces.removeIf(pair -> !pair.a.getSymbol().getInternalQualifiedName().equals(pair.b .getSymbol().getInternalQualifiedName())); } - + public void setMatcher() { matcher = new CachedMatches<>(matches.getAssocMatches()); } - + public List>> sortDiffs( List> input) { Map> resultMap = new HashMap<>(); - + for (Pair pair : input) { ASTCDClass cdClass = pair.a; AssocStruct assocStruct = pair.b; - + resultMap.computeIfAbsent(cdClass, key -> new ArrayList<>()).add(assocStruct); } - + return resultMap.entrySet().stream().map(entry -> new Pair<>(entry.getKey(), entry.getValue())) .collect(Collectors.toList()); } - + public Optional>> getPair( List>> list, ASTCDClass astcdClass) { for (Pair> pair : list) { @@ -2590,7 +2590,7 @@ public Optional>> getPair( } return Optional.empty(); } - + /** * This function is used to treat duplicated associations BEFORE the overlapping associations. * This was needed as otherwise overlapping associations would be treated twice and eventually @@ -2605,22 +2605,22 @@ public void findDuplicatedAssocs() { Set tgtToDelete = new HashSet<>(); Set> tgtAssocsToDelete = new HashSet<>(); Set tgtAssocsToMergeWithDelete = new HashSet<>(); - + // Process source associations processAssociationMap(srcMap, srcCD, srcAssocsToMergeWithDelete, srcAssocsToDelete, srcToDelete, true); - + // Process target associations processAssociationMap(tgtMap, tgtCD, tgtAssocsToMergeWithDelete, tgtAssocsToDelete, tgtToDelete, false); - + // Handle deletions and merges for src handleDeletionsAndMerges(srcToDelete, srcAssocsToMergeWithDelete, srcAssocsToDelete, true); - + // Handle deletions and merges for tgt handleDeletionsAndMerges(tgtToDelete, tgtAssocsToMergeWithDelete, tgtAssocsToDelete, false); } - + // Helper method to process associations private void processAssociationMap(ArrayListMultimap assocMap, ASTCDCompilationUnit cdType, Set assocsToMergeWithDelete, @@ -2645,7 +2645,7 @@ else if (isDeletable(association, superAssoc, isSrc)) { } } } - + // Determine if association is mergable private boolean isMergable(AssocStruct association, AssocStruct superAssoc, ASTCDType astcdClass, Set assocsToMergeWithDelete, boolean isSrc) { @@ -2654,14 +2654,14 @@ private boolean isMergable(AssocStruct association, AssocStruct superAssoc, ASTC || isInConflict(association, superAssoc) && inInheritanceRelation(association, superAssoc, isSrc ? srcCD : tgtCD); } - + // Determine if association is deletable private boolean isDeletable(AssocStruct association, AssocStruct superAssoc, boolean isSrc) { return isInConflict(association, superAssoc) && !inInheritanceRelation(association, superAssoc, isSrc ? srcCD : tgtCD) && !getConnectedTypes(association.getAssociation(), isSrc ? srcCD : tgtCD).equals(getConnectedTypes(superAssoc.getAssociation(), isSrc ? srcCD : tgtCD)); } - + // Handle deletions and merges for src or tgt private void handleDeletionsAndMerges(Set toDelete, Set assocsToMergeWithDelete, Set> assocsToDelete, @@ -2686,7 +2686,7 @@ private void handleDeletionsAndMerges(Set toDelete, removeAssociations(assocsToMergeWithDelete, isSrc); deleteAssociations(assocsToDelete, isSrc); } - + // Delete a class and its subclasses private void deleteClassAndSubclasses(ASTCDType astcdClass, boolean isSrc) { if (isSrc) { @@ -2706,7 +2706,7 @@ private void deleteClassAndSubclasses(ASTCDType astcdClass, boolean isSrc) { } } } - + // Remove associations private void removeAssociations(Set assocsToMergeWithDelete, boolean isSrc) { for (DeleteStruct pair : assocsToMergeWithDelete) { @@ -2718,7 +2718,7 @@ private void removeAssociations(Set assocsToMergeWithDelete, boole } } } - + // Delete associations private void deleteAssociations(Set> assocsToDelete, boolean isSrc) { for (Pair pair : assocsToDelete) { @@ -2730,7 +2730,7 @@ private void deleteAssociations(Set> assocsToDelete, } } } - + /** * Get a non-abstract class for changed type. * @@ -2747,7 +2747,7 @@ public Optional getClassForDiff(ASTCDClass astcdClass, } return Optional.empty(); } - + /** * Check if an attribute is conatined in a class in tgtCD. * @@ -2781,7 +2781,7 @@ else if (indexCurrent != -1 && indexAttribute != -1 && (att.getName().equals(att } return false; } - + /** * Delete associations from subclasses in tgtCD. * @@ -2803,7 +2803,7 @@ public void deleteAssocFromSubTgt(AssocStruct assocStruct, ASTCDType astcdType) } } } - + /** * Delete associations from subclasses in srcCD. * @@ -2823,7 +2823,7 @@ public void deleteAssocsFromSubSrc(AssocStruct assocStruct, ASTCDType astcdType) } } } - + public List>> transform( List> list) { List>> result = new ArrayList<>(); @@ -2832,7 +2832,7 @@ public List>> transform( } return result; } - + /** * Sort the added and deleted attributes for a given type. This reduces the number of generated * diff-witnesses. @@ -2842,7 +2842,7 @@ public List>> transform( public void sortTypeDiff(TypeDiffStruct typeDiffStruct) { List>> added = new ArrayList<>(); List>> deleted = new ArrayList<>(); - + if (typeDiffStruct.getAddedAttributes() != null && !typeDiffStruct.getAddedAttributes() .isEmpty()) { added.addAll(typeDiffStruct.getAddedAttributes()); @@ -2851,33 +2851,33 @@ public void sortTypeDiff(TypeDiffStruct typeDiffStruct) { .isEmpty()) { deleted.addAll(typeDiffStruct.getDeletedAttributes()); } - + Map classAttributeMap = new HashMap<>(); - + for (Pair> pair : added) { ASTCDClass clazz = pair.a; List attribute = pair.b; - + if (!classAttributeMap.containsKey(clazz)) { classAttributeMap.put(clazz, new AddedDeletedAtt()); } classAttributeMap.get(clazz).getAddedAttributes().addAll(attribute); } - + for (Pair> pair : deleted) { ASTCDClass clazz = pair.a; List attribute = pair.b; - + if (!classAttributeMap.containsKey(clazz)) { classAttributeMap.put(clazz, new AddedDeletedAtt()); } classAttributeMap.get(clazz).getDeletedAttributes().addAll(attribute); } - + List>> addedNew = new ArrayList<>(); List>> deletedNew = new ArrayList<>(); List> addedDeleted = new ArrayList<>(); - + // Remove AddedDeletedAtt if no deleted attributes are present for (Map.Entry astcdClass : classAttributeMap.entrySet()) { if (astcdClass.getValue().getDeletedAttributes().isEmpty()) { @@ -2895,5 +2895,5 @@ else if (astcdClass.getValue().getAddedAttributes().isEmpty()) { typeDiffStruct.setAddedAttributes(addedNew); typeDiffStruct.setDeletedAttributes(deletedNew); } - + } diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java index 3f5823b2f..a2202e9f8 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java @@ -1,6 +1,7 @@ /* (c) https://github.com/MontiCore/monticore */ package de.monticore.cddiff.syndiff; +import de.monticore.cd4analysis._prettyprint.CD4AnalysisFullPrettyPrinter; import de.monticore.cd4code.CD4CodeMill; import de.monticore.cdbasis._ast.ASTCDCompilationUnit; import de.monticore.cddiff.alloycddiff.CDSemantics; @@ -10,7 +11,6 @@ import de.monticore.odbasis._ast.ASTODArtifact; import de.monticore.odvalidity.OD2CDMatcher; import de.monticore.prettyprint.IndentPrinter; -import de.se_rwth.commons.logging.Log; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; @@ -28,88 +28,86 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class Syn2SemDiffTest extends SynDiffTestBasis { - + private static final String cddiffDir = "src/test/resources/de/monticore/cddiff/"; private static final String validationDir = "src/test/resources/validation/"; - + public static Stream emptyWitnesses() { - return Stream.of(Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", - "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", false, false), Arguments.of(cddiffDir, - "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", - "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, false), Arguments.of(cddiffDir, - "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", - "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, false), Arguments.of(cddiffDir, - "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", - "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", false, false), Arguments.of( - cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", - "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, true), Arguments.of( - cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", - "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, true), Arguments.of( - cddiffDir, "syndiff/TypeDiff/ChangedAttribute/CD71.cd", - "syndiff/TypeDiff/ChangedAttribute/CD71.cd", false, false), - Arguments.of(cddiffDir, "syndiff/TypeDiff/ChangedAttribute/CD71.cd", - "syndiff/TypeDiff/ChangedAttribute/CD71.cd", false, true), Arguments.of(cddiffDir, - "syndiff/TypeDiff/RemovedAttributeNoDiff/CD21.cd", - "syndiff/TypeDiff/RemovedAttributeNoDiff/CD22.cd", false, false), Arguments.of( - cddiffDir, "syndiff/SyntaxDiff/MaCoCo_v2.cd", "syndiff/SyntaxDiff/MaCoCo_v1.cd", - false, false), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", - "DigitalTwins/DigitalTwin3.cd", false, false), Arguments.of(cddiffDir, - "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", false, - false), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", - "DigitalTwins/DigitalTwin1.cd", true, true), Arguments.of(cddiffDir, - "Employees/Employees2.cd", "Employees/Employees1.cd", true, - true), Arguments.of(cddiffDir, "Employees/Employees2.cd", - "Employees/Employees1.cd", false, true), Arguments.of( - cddiffDir, "Employees/Employees8.cd", - "Employees/Employees7.cd", true, true), Arguments.of( - validationDir, "cddiff/LibraryV3.cd", - "cddiff/LibraryV2.cd", true, true), Arguments.of( - validationDir, "cddiff/LibraryV5.cd", - "cddiff/LibraryV4.cd", true, true), Arguments - .of(validationDir, - "cd4analysis/ManagementV2.cd", - "cd4analysis/ManagementV1.cd", true, - true), Arguments.of(validationDir, - "cd4analysis/MyCompanyV2.cd", - "cd4analysis/MyCompanyV1.cd", true, - true), Arguments.of(validationDir, - "cd4analysis/MyExampleV2.cd", - "cd4analysis/MyExampleV1.cd", - true, true), Arguments.of( - validationDir, - "cd4analysis/MyExampleV1.cd", - "cd4analysis/MyExampleV2.cd", - true, true), Arguments.of( - validationDir, - "cd4analysis/ManagementV2.cd", - "cd4analysis/ManagementV1.cd", - true, false), Arguments - .of(validationDir, - "cd4analysis/MyExampleV2.cd", - "cd4analysis/MyExampleV1.cd", - true, false), - Arguments.of(validationDir, "cd4analysis/MyExampleV1.cd", "cd4analysis/MyExampleV2.cd", - true, false)); + return Stream.of( +// Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", +// "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", false, false), Arguments.of(cddiffDir, +// "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", +// "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, false), Arguments.of(cddiffDir, +// "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", +// "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, false), Arguments.of(cddiffDir, +// "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", +// "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", false, false), Arguments.of( +// cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", +// "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, true), Arguments.of( +// cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", +// "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, true), Arguments.of( +// cddiffDir, "syndiff/TypeDiff/ChangedAttribute/CD71.cd", +// "syndiff/TypeDiff/ChangedAttribute/CD71.cd", false, false), +// Arguments.of(cddiffDir, "syndiff/TypeDiff/ChangedAttribute/CD71.cd", +// "syndiff/TypeDiff/ChangedAttribute/CD71.cd", false, true), Arguments.of(cddiffDir, +// "syndiff/TypeDiff/RemovedAttributeNoDiff/CD21.cd", +// "syndiff/TypeDiff/RemovedAttributeNoDiff/CD22.cd", false, false), Arguments.of( +// cddiffDir, "syndiff/SyntaxDiff/MaCoCo_v2.cd", "syndiff/SyntaxDiff/MaCoCo_v1.cd", +// false, false), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", +// "DigitalTwins/DigitalTwin3.cd", false, false), Arguments.of(cddiffDir, +// "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", false, +// false), +// Arguments.of(cddiffDir, "Employees/Employees2.cd", +// "Employees/Employees1.cd", true, true), + Arguments.of(cddiffDir, + "Employees/Employees2.cd", "Employees/Employees1.cd", false, + true), Arguments.of(cddiffDir, "Employees/Employees8.cd", + "Employees/Employees7.cd", true, true), Arguments.of( + validationDir, "cddiff/LibraryV3.cd", + "cddiff/LibraryV2.cd", true, true) +// , Arguments.of( +// validationDir, "cddiff/LibraryV5.cd", +// "cddiff/LibraryV4.cd", true, true), Arguments.of( +// validationDir, "cd4analysis/ManagementV2.cd", +// "cd4analysis/ManagementV1.cd", true, true), +// Arguments.of(validationDir, "cd4analysis/MyCompanyV2.cd", "cd4analysis/MyCompanyV1.cd", +// true, true), Arguments.of(validationDir, "cd4analysis/MyExampleV2.cd", +// "cd4analysis/MyExampleV1.cd", true, true), Arguments.of(validationDir, +// "cd4analysis/MyExampleV1.cd", "cd4analysis/MyExampleV2.cd", true, true), +// Arguments.of(validationDir, "cd4analysis/ManagementV2.cd", "cd4analysis/ManagementV1.cd", +// true, false), Arguments.of(validationDir, "cd4analysis/MyExampleV2.cd", +// "cd4analysis/MyExampleV1.cd", true, false), Arguments.of(validationDir, +// "cd4analysis/MyExampleV1.cd", "cd4analysis/MyExampleV2.cd", true, false) + ); } - + @ParameterizedTest @MethodSource("emptyWitnesses") public void testEmptyWitnesses(String baseDir, String srcPath, String tgtPath, boolean staDiff, boolean reduction) { dir = baseDir; parseModels(srcPath, tgtPath); - + if (reduction) { ReductionTrafo trafo = new ReductionTrafo(); trafo.transform(src, tgt); } - + Syn2SemDiff syn2semdiff = new Syn2SemDiff(src, tgt); List witnesses = syn2semdiff.generateODs(staDiff); - + + System.out.println("size is: " + witnesses.size()); + for (ASTODArtifact od : witnesses) { + System.out.println(new OD2CDMatcher().checkIfDiffWitness(STA_CLOSED_WORLD, src, tgt, od)); + if (!new OD2CDMatcher().checkIfDiffWitness(STA_CLOSED_WORLD, src, tgt, od)) { + System.out.println(new OD4ReportFullPrettyPrinter(new IndentPrinter()).prettyprint(od)); + Assertions.fail(); + } + } + assertTrue(witnesses.isEmpty()); } - + public static Stream witnesses() { return Stream.of(Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", SIMPLE_CLOSED_WORLD, true), Arguments.of( @@ -179,28 +177,28 @@ public static Stream witnesses() { STA_CLOSED_WORLD, true), Arguments.of(validationDir, "cd4analysis/MyCompanyV2.cd", "cd4analysis/MyCompanyV1.cd", STA_CLOSED_WORLD, false)); } - + @ParameterizedTest @MethodSource("witnesses") public void testWitnesses(String baseDir, String srcPath, String tgtPath, CDSemantics semantics, boolean reduction) { dir = baseDir; parseModels(srcPath, tgtPath); - + if (reduction) { ReductionTrafo trafo = new ReductionTrafo(); trafo.transform(src, tgt); } - + Syn2SemDiff syn2semdiff = new Syn2SemDiff(src, tgt); List witnesses = syn2semdiff.generateODs(semantics.equals(STA_CLOSED_WORLD) || semantics.equals(STA_OPEN_WORLD)); - + assertFalse(witnesses.isEmpty()); - + checkDiffWitnesses(semantics, src, tgt, witnesses); } - + public static Stream witnessesReduction() { return Stream.of(Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd"), Arguments.of(validationDir, "Performance/5A.cd", "Performance/5B.cd"), Arguments.of( @@ -225,40 +223,43 @@ public static Stream witnessesReduction() { "Employees/Employees8.cd"), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd")); } - + @ParameterizedTest @MethodSource("witnessesReduction") public void testWitnessesReduction(String baseDir, String srcPath, String tgtPath) { dir = baseDir; parseModels(srcPath, tgtPath); - + ASTCDCompilationUnit srcOriginal = src.deepClone(); ASTCDCompilationUnit tgtOriginal = tgt.deepClone(); - + // reduction-based ReductionTrafo trafo = new ReductionTrafo(); trafo.transform(src, tgt); - + Syn2SemDiff syn2semdiff = new Syn2SemDiff(src, tgt); List witnesses = syn2semdiff.generateODs(true); - + Assertions.assertFalse(witnesses.isEmpty()); - + checkDiffWitnesses(CDSemantics.STA_CLOSED_WORLD, src, tgt, witnesses); - + CD4CodeMill.scopesGenitorDelegator().createFromAST(srcOriginal); CD4CodeMill.scopesGenitorDelegator().createFromAST(tgtOriginal); checkDiffWitnesses(CDSemantics.STA_OPEN_WORLD, srcOriginal, tgtOriginal, witnesses); } - + protected void checkDiffWitnesses(CDSemantics semantics, ASTCDCompilationUnit cd1, ASTCDCompilationUnit cd2, Collection witnesses) { + System.out.println(new CD4AnalysisFullPrettyPrinter(new IndentPrinter()).prettyprint(cd1)); + System.out.println(new CD4AnalysisFullPrettyPrinter(new IndentPrinter()).prettyprint(cd2)); + //System.out.println(witnesses.size()); for (ASTODArtifact od : witnesses) { if (!new OD2CDMatcher().checkIfDiffWitness(semantics, cd1, cd2, od)) { - Log.println(new OD4ReportFullPrettyPrinter(new IndentPrinter()).prettyprint(od)); + System.out.println(new OD4ReportFullPrettyPrinter(new IndentPrinter()).prettyprint(od)); Assertions.fail(); } } } - + } From d082e9d54b223990d44e70c683287e9bc060f1f3 Mon Sep 17 00:00:00 2001 From: Max Stachon Date: Tue, 26 Aug 2025 12:04:44 +0200 Subject: [PATCH 15/17] minor fix in OD2CDMatcher --- .../syn2semdiff/odgen/Syn2SemDiffHelper.java | 468 +++++++++--------- .../odvalidity/AssociationsMatcher.java | 2 +- .../de/monticore/odvalidity/ClassMatcher.java | 24 +- .../de/monticore/odvalidity/OD2CDMatcher.java | 2 +- .../odvalidity/STAObjectMatcher.java | 4 +- .../{Semantic.java => SemanticsHelper.java} | 2 +- .../cddiff/syndiff/Syn2SemDiffTest.java | 139 +++--- 7 files changed, 319 insertions(+), 322 deletions(-) rename cddiff/src/main/java/de/monticore/odvalidity/{Semantic.java => SemanticsHelper.java} (95%) diff --git a/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/odgen/Syn2SemDiffHelper.java b/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/odgen/Syn2SemDiffHelper.java index a3478f6b7..c7019dc3f 100644 --- a/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/odgen/Syn2SemDiffHelper.java +++ b/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/odgen/Syn2SemDiffHelper.java @@ -43,93 +43,93 @@ * is also implemented in this class. */ public class Syn2SemDiffHelper { - + public Syn2SemDiffHelper(CDSynDiffMatches matches) { this.matches = matches; } - + private CDSynDiffMatches matches; - + /** * Map with all possible associations (as AssocStructs) for classes from srcCD where the given * class serves as source. The non-instantiatable classes and associations are removed after the * function findOverlappingAssocs(). */ private ArrayListMultimap srcMap; - + /** * Map with all possible associations (as AssocStructs) for classes from trgCd where the given * class serves as target. The non-instantiatable classes and associations are removed after the * function findOverlappingAssocs(). */ private ArrayListMultimap tgtMap; - + /** * Map with all subclasses of a class from srcCD. This is used to reduce the complexity for * computing the underlying inheritance tree. */ private ArrayListMultimap srcSubMap; - + /** * Map with all subclasses of a class from trgCD. This is used to reduce the complexity for * computing the underlying inheritance tree. */ private ArrayListMultimap tgtSubMap; - + /** * Set with all classes that are not instantiatable in srcCD. Those are classes that cannot exist * because of overlapping. The second possibility is that the class has an attribute and a * relation to the same class, e.g., int age and -> (age) Age. */ private Set notInstClassesSrc; - + /** * Set with all classes that are not instantiatable in trgCD. Those are classes that cannot exist * because of overlapping. The second possibility is that the class has an attribute and a * relation to the same class, e.g., int age and -> (age) Age. */ private Set notInstClassesTgt; - + /** * This is a copy of the srcCD so that it can be accessed from all classes for semantic * difference. */ private ASTCDCompilationUnit srcCD; - + /** * This is a copy of the trgCD so that it can be accessed from all classes for semantic * difference. */ private ASTCDCompilationUnit tgtCD; - + /** * Those are the matched classes from the analysis of the syntax. This way some functionalities * were moved to this helper class. */ private List> matchedClasses; - + /** * Those are the matched interfaces from the analysis of the syntax. This way some functionalities * were moved to this helper class. */ private List> matchedInterfaces; - + /** * Those are the added associations from the analysis of the syntax. This way some functionalities * were moved to this helper class. */ private List addedAssocs; - + /** * Those are the deleted associations from the analysis of the syntax. This way some * functionalities were moved to this helper class. */ private List deletedAssocs; - + private BooleanMatchingStrategy matcher; private List diffs; private List matchingStrategies; - + // CHECKED public boolean isAttContainedInClass(ASTCDAttribute attribute, ASTCDType astcdClass) { int indexAttribute = attribute.getMCType().printType().lastIndexOf("."); @@ -157,74 +157,74 @@ else if (indexCurrent != -1 && indexAttribute != -1 && (att.getName().equals(att } return false; } - + public void setMatchedClasses(List> matchedClasses) { this.matchedClasses = matchedClasses; } - + public List> getMatchedClasses() { return matchedClasses; } - + public void setDiffs(List diffs) { this.diffs = diffs; } - + public List getDiffs() { return diffs; } - + public ArrayListMultimap getSrcMap() { return srcMap; } - + public ArrayListMultimap getTgtMap() { return tgtMap; } - + public ASTCDCompilationUnit getSrcCD() { return srcCD; } - + public void setSrcCD(ASTCDCompilationUnit srcCD) { this.srcCD = srcCD; } - + public ASTCDCompilationUnit getTgtCD() { return tgtCD; } - + public void setTgtCD(ASTCDCompilationUnit tgtCD) { this.tgtCD = tgtCD; } - + public Set getNotInstClassesSrc() { return notInstClassesSrc; } - + public Set getNotInstClassesTgt() { return notInstClassesTgt; } - + public ArrayListMultimap getSrcSubMap() { return srcSubMap; } - + public ArrayListMultimap getTgtSubMap() { return tgtSubMap; } - + public void setNotInstClassesSrc(Set notInstClassesSrc) { this.notInstClassesSrc = notInstClassesSrc; } - + public void setNotInstClassesTgt(Set notInstClassesTgt) { this.notInstClassesTgt = notInstClassesTgt; } - + public void updateSrc(ASTCDType astcdClass) { notInstClassesSrc.add(astcdClass); } - + public void updateTgt(ASTCDType astcdClass) { notInstClassesTgt.add(astcdClass); } - + public void setDeletedAssocs(List deletedAssocs) { this.deletedAssocs = deletedAssocs; } - + public void setAddedAssocs(List addedAssocs) { this.addedAssocs = addedAssocs; } - + public List> getMatchedInterfaces() { return matchedInterfaces; } - + public void setMatchedInterfaces(List> matchedInterfaces) { this.matchedInterfaces = matchedInterfaces; } - + public void setMatchingStrategies(List matchingStrategies) { this.matchingStrategies = matchingStrategies; } - + public boolean isSubclassWithSuper(ASTCDType superClass, ASTCDType subClass) { return isSuperOf(superClass.getSymbol().getInternalQualifiedName(), subClass.getSymbol() .getInternalQualifiedName(), srcCD); } - + /** * Get all needed associations from the src/tgtMap that use the given class as target. The * associations are strictly unidirectional. Needed associations - the cardinality must be at @@ -239,14 +239,14 @@ public List getOtherAssocs(ASTCDType astcdClass, boolean isSource, boolean makeConditionStrict) { List list = new ArrayList<>(); ArrayListMultimap map = isSource ? srcMap : tgtMap; - + for (ASTCDType classToCheck : map.keySet()) { if (classToCheck != astcdClass) { for (AssocStruct assocStruct : map.get(classToCheck)) { Pair connectedTypes; connectedTypes = Syn2SemDiffHelper.getConnectedTypes(assocStruct.getAssociation(), isSource ? srcCD : tgtCD); - + if (assocStruct.getSide().equals(ClassSide.Left) && !assocStruct.getDirection().equals( AssocDirection.BiDirectional) && (makeConditionStrict || assocStruct.getAssociation() .getLeft().getCDCardinality().isOne() || assocStruct.getAssociation().getLeft() @@ -265,7 +265,7 @@ else if (assocStruct.getSide().equals(ClassSide.Right) && !assocStruct.getDirect } return list; } - + /** * Get all needed associations (including superclasses) from the src/tgtMap that use the given * class as target. The associations are strictly unidirectional. Needed associations - the @@ -278,26 +278,26 @@ public List getAllOtherAssocs(ASTCDType astcdClass, boolean isSourc List list = new ArrayList<>(); Set superTypes = CDDiffUtil.getAllSuperTypes(astcdClass, isSource ? srcCD .getCDDefinition() : tgtCD.getCDDefinition()); - + for (ASTCDType astcdClass1 : superTypes) { list.addAll(getOtherAssocs(astcdClass1, isSource, false)); } - + return list; } - + public List getAllOtherAssocsSpecCase(ASTCDType astcdClass, boolean isSource) { List list = new ArrayList<>(); Set superTypes = CDDiffUtil.getAllSuperTypes(astcdClass, isSource ? srcCD .getCDDefinition() : tgtCD.getCDDefinition()); - + for (ASTCDType astcdClass1 : superTypes) { list.addAll(getOtherAssocs(astcdClass1, isSource, true)); } - + return list; } - + /** * Find matched type in srcCD. * @@ -315,7 +315,7 @@ else if (astcdType instanceof ASTCDInterface) { return Optional.empty(); } } - + /** * Find matched type in tgtCD. * @@ -333,7 +333,7 @@ else if (astcdType instanceof ASTCDInterface) { return Optional.empty(); } } - + public Optional findMatchedClass(ASTCDClass astcdClass) { for (Pair pair : matchedClasses) { if (pair.a.equals(astcdClass)) { @@ -342,7 +342,7 @@ public Optional findMatchedClass(ASTCDClass astcdClass) { } return Optional.empty(); } - + public Optional findMatchedSrc(ASTCDClass astcdClass) { for (Pair pair : matchedClasses) { if (pair.b.equals(astcdClass)) { @@ -351,7 +351,7 @@ public Optional findMatchedSrc(ASTCDClass astcdClass) { } return Optional.empty(); } - + public Optional findMatchedTypeSrc(ASTCDInterface astcdInterface) { for (Pair pair : matchedInterfaces) { if (pair.b.equals(astcdInterface)) { @@ -360,7 +360,7 @@ public Optional findMatchedTypeSrc(ASTCDInterface astcdInterface) { } return Optional.empty(); } - + public Optional findMatchedTypeTgt(ASTCDInterface astcdInterface) { for (Pair pair : matchedInterfaces) { if (pair.a.equals(astcdInterface)) { @@ -369,7 +369,7 @@ public Optional findMatchedTypeTgt(ASTCDInterface astcdInterface) { } return Optional.empty(); } - + public static AssocDirection getDirection(ASTCDAssociation association) { if (association.getCDAssocDir() == null) { return AssocDirection.Unspecified; @@ -384,7 +384,7 @@ public static AssocDirection getDirection(ASTCDAssociation association) { return AssocDirection.LeftToRight; } } - + /** * When merging associations, the role names of the bidirectional association are used instead of * the role names of the unidirectional. @@ -416,7 +416,7 @@ else if (association.getSide().equals(ClassSide.Right) && superAssoc.getSide().e } } } - + /** * Merge the cardinalities and the direction of two associations. * @@ -447,7 +447,7 @@ public static void mergeAssocs(AssocStruct association, AssocStruct superAssoc) .requireNonNull(cardinalityLeft))); } } - + /** * Modified version of the function inConflict in CDAssociationHelper. In the map, all association * that can be created from a class are saved in the values for this class (key). Because of that @@ -461,7 +461,7 @@ public static void mergeAssocs(AssocStruct association, AssocStruct superAssoc) public static boolean isInConflict(AssocStruct association, AssocStruct superAssociation) { ASTCDAssociation srcAssoc = association.getAssociation(); ASTCDAssociation targetAssoc = superAssociation.getAssociation(); - + if (association.getSide().equals(ClassSide.Left) && superAssociation.getSide().equals( ClassSide.Left)) { return matchRoleNames(srcAssoc.getRight(), targetAssoc.getRight()); @@ -478,10 +478,10 @@ public static boolean isInConflict(AssocStruct association, AssocStruct superAss ClassSide.Right)) { return matchRoleNames(srcAssoc.getLeft(), targetAssoc.getLeft()); } - + return false; } - + /** * Given the two associations, get the role name that causes the conflict * @@ -492,7 +492,7 @@ public static boolean isInConflict(AssocStruct association, AssocStruct superAss public static ASTCDRole getConflict(AssocStruct association, AssocStruct superAssociation) { ASTCDAssociation srcAssoc = association.getAssociation(); ASTCDAssociation targetAssoc = superAssociation.getAssociation(); - + if (association.getSide().equals(ClassSide.Left) && superAssociation.getSide().equals( ClassSide.Left) && matchRoleNames(srcAssoc.getRight(), targetAssoc.getRight())) { return srcAssoc.getRight().getCDRole(); @@ -509,7 +509,7 @@ else if (association.getSide().equals(ClassSide.Right) && superAssociation.getSi return srcAssoc.getLeft().getCDRole(); } } - + /** * Merge the directions of two associations * @@ -520,20 +520,20 @@ else if (association.getSide().equals(ClassSide.Right) && superAssociation.getSi public static ASTCDAssocDir mergeAssocDir(AssocStruct association, AssocStruct superAssociation) { AssocDirection dir1 = association.getDirection(); AssocDirection dir2 = superAssociation.getDirection(); - + if (dir1.equals(AssocDirection.BiDirectional) || dir2.equals(AssocDirection.BiDirectional)) { return CD4CodeMill.cDBiDirBuilder().build(); } - + ClassSide side1 = association.getSide(); ClassSide side2 = superAssociation.getSide(); - + boolean sameLogicalDirection = (dir1 == dir2 && side1 == side2) || (dir1 == AssocDirection.LeftToRight && dir2 == AssocDirection.RightToLeft && side1 == ClassSide.Left && side2 == ClassSide.Right) || (dir1 == AssocDirection.RightToLeft && dir2 == AssocDirection.LeftToRight && side1 == ClassSide.Right && side2 == ClassSide.Left); - + if (sameLogicalDirection) { switch (dir1) { case LeftToRight: @@ -542,10 +542,10 @@ public static ASTCDAssocDir mergeAssocDir(AssocStruct association, AssocStruct s return CD4CodeMill.cDRightToLeftDirBuilder().build(); } } - + return CD4CodeMill.cDBiDirBuilder().build(); } - + /** * Group corresponding cardinalities * @@ -583,7 +583,7 @@ else if (association.getSide().equals(ClassSide.Right) && superAssociation.getSi .getAssociation().getLeft().getCDCardinality())); } } - + /** * Transform the internal cardinality to original * @@ -604,7 +604,7 @@ else if (assocCardinality.equals(AssocCardinality.AtLeastOne)) { return new ASTCDCardMult(); } } - + /** * Check if the associations allow 0 objects from target class * @@ -616,15 +616,15 @@ public static boolean areZeroAssocs(AssocStruct association, AssocStruct superAs ASTCDCardinality assocCardinality = association.getSide().equals(ClassSide.Left) ? association .getAssociation().getRight().getCDCardinality() : association.getAssociation().getLeft() .getCDCardinality(); - + ASTCDCardinality superAssocCardinality = superAssociation.getSide().equals(ClassSide.Left) ? superAssociation.getAssociation().getRight().getCDCardinality() : superAssociation .getAssociation().getLeft().getCDCardinality(); - + return (assocCardinality.isMult() || assocCardinality.isOpt()) && (superAssocCardinality .isMult() || superAssocCardinality.isOpt()); } - + public boolean isAdded(AssocStruct assocStruct, AssocStruct assocStruct2, ASTCDType astcdClass, Set set) { for (DeleteStruct deleteStruct : set) { @@ -637,7 +637,7 @@ public boolean isAdded(AssocStruct assocStruct, AssocStruct assocStruct2, ASTCDT } return false; } - + /** * Similar to the function above, but the now the classes must be the target of the association. * @@ -663,7 +663,7 @@ public Optional allSubClassesAreTgtSrcTgt(AssocStruct matchedAssocStr } return Optional.empty(); } - + /** * Check if all matched subclasses in tgtCD/srcCD of a class from srcCD/tgtCD have the same * association or a subassociation. @@ -676,12 +676,12 @@ public Optional allSubClassesHaveIt(AssocStruct association, ASTCDTyp boolean isSource) { List subClasses = isSource ? tgtSubMap.get(type) : srcSubMap.get(type); List subTypes = getTypes(subClasses, isSource); - + for (ASTCDType subClass : subTypes) { boolean isContained = false; List assocList = isSource ? srcMap.get(subClass) : getAllOtherAssocs(subClass, false); - + for (AssocStruct assocStruct : assocList) { if (isSource) { if (sameAssociationTypeSrcTgt(assocStruct, association)) { @@ -696,14 +696,14 @@ public Optional allSubClassesHaveIt(AssocStruct association, ASTCDTyp } } } - + if (!isContained) { return Optional.ofNullable(subClass); } } return Optional.empty(); } - + /** * Check if all matched subclasses in srcCD of a class from trgCD are target of the same * association. @@ -729,7 +729,7 @@ public Optional allSubClassesAreTargetTgtSrc(AssocStruct tgtAssoc, AS } return Optional.empty(); } - + /** * Check if the classes are in an inheritance relation. For this, the matched classes in * srcCD/tgtCD of the tgtClass/srcClass are compared with isSuper() to the srcClass. @@ -743,7 +743,7 @@ public boolean compareTypes(ASTCDType type1, ASTCDType type2, boolean isSource) type2); Optional type1Matched = isSource ? findMatchedTypeTgt(type1) : findMatchedTypeSrc( type1); - + return typeToMatch.filter(astcdType -> isSuperOf(astcdType.getSymbol() .getInternalQualifiedName(), type1.getSymbol().getInternalQualifiedName(), (ICD4CodeArtifactScope) (isSource ? srcCD.getEnclosingScope() : tgtCD.getEnclosingScope()))) @@ -752,7 +752,7 @@ public boolean compareTypes(ASTCDType type1, ASTCDType type2, boolean isSource) type1Matched.get())) : (typeToMatch.isPresent() && srcSubMap.get(type1).contains( typeToMatch.get()))); } - + /** * Check if the srcType has the given association from srcCD. * @@ -768,7 +768,7 @@ public boolean classHasAssociationSrcSrc(AssocStruct association, ASTCDType srcT } return false; } - + /** * Check if the srcType has the given association from tgtCD. * @@ -784,7 +784,7 @@ public boolean classHasAssociationTgtSrc(AssocStruct tgtStruct, ASTCDType srcTyp } return false; } - + public boolean classHasAssociationTgtSrcRev(AssocStruct tgtStruct, ASTCDType srcType) { for (AssocStruct assocStruct1 : srcMap.get(srcType)) { if (sameAssociationTypeSrcTgtRev(assocStruct1, tgtStruct)) { @@ -793,7 +793,7 @@ public boolean classHasAssociationTgtSrcRev(AssocStruct tgtStruct, ASTCDType src } return false; } - + /** * Check if the tgtType has the given association from srcCD. * @@ -809,7 +809,7 @@ public boolean classHasAssociationSrcTgt(AssocStruct assocStruct, ASTCDType tgtT } return false; } - + /** * Check if the srcType is target of the given association from srcCD. * @@ -825,7 +825,7 @@ public boolean classIsTarget(AssocStruct association, ASTCDType srcType) { } return false; } - + /** * Check if the tgtType is target of the given association from srcCD. * @@ -841,7 +841,7 @@ public boolean classIsTgtSrcTgt(AssocStruct association, ASTCDType tgtType) { } return false; } - + /** * Check if the srcType is target of the given association from tgtCD. * @@ -857,7 +857,7 @@ public boolean classIsTargetTgtSrc(AssocStruct association, ASTCDType srcType) { } return false; } - + public boolean classIsTargetTgtSrcRev(AssocStruct association, ASTCDType srcType) { for (AssocStruct assocStruct : getAllOtherAssocs(srcType, true)) { if (sameAssociationTypeSrcTgtRev(assocStruct, association)) { @@ -866,10 +866,10 @@ public boolean classIsTargetTgtSrcRev(AssocStruct association, ASTCDType srcType } return false; } - + public List getTypes(List types, boolean isSource) { List resultTypes = new ArrayList<>(); - + for (ASTCDType astcdType : types) { if (astcdType instanceof ASTCDClass) { Optional matched = isSource ? findMatchedSrc((ASTCDClass) astcdType) @@ -884,7 +884,7 @@ else if (astcdType instanceof ASTCDInterface) { } return resultTypes; } - + /** * Check if two associations are exactly the same. * @@ -907,7 +907,7 @@ public boolean sameAssociation(ASTCDAssociation association, ASTCDAssociation as } return false; } - + /** * Check if the target classes of the two associations are in an inheritance relation * @@ -942,7 +942,7 @@ else if (association.getSide().equals(ClassSide.Right) && superAssociation.getSi (ICD4CodeArtifactScope) compilationUnit.getEnclosingScope()); } } - + public boolean inheritanceTgt(AssocStruct assocStruct, AssocStruct assocStruct1) { if (assocStruct.getSide().equals(ClassSide.Left) && assocStruct1.getSide().equals( ClassSide.Left)) { @@ -964,7 +964,7 @@ else if (assocStruct.getSide().equals(ClassSide.Right) && assocStruct1.getSide() getConnectedTypes(assocStruct.getAssociation(), srcCD).a, false); } } - + /** * Get all attributes that need to be added from inheritance structure to an object of a given * type @@ -983,7 +983,7 @@ public Pair> getAllAttr(ASTCDType astcdClass) { } return new Pair<>(astcdClass, attributes); } - + public Pair> getAllAttrTgt(ASTCDType astcdClass) { List attributes = new ArrayList<>(); Set classes = getAllSuper(astcdClass, (ICD4CodeArtifactScope) tgtCD @@ -995,7 +995,7 @@ public Pair> getAllAttrTgt(ASTCDType astcdClass) } return new Pair<>(astcdClass, attributes); } - + /** * Check if the srcAssoc has the same type as the srcAssoc1 - direction, role names and the * cardinalities of srcAssoc are sub-intervals of the cardinalities of srcAssoc1. @@ -1014,7 +1014,7 @@ public boolean sameAssociationType(AssocStruct srcAssocSub, AssocStruct srcAssoc return compareAssociations(srcAssocSuper, srcAssocSub, false); } } - + private boolean compareAssociations(AssocStruct superAssoc, AssocStruct subAssoc, boolean sameSides) { // Compare role names, cardinality, and direction for both sides (left and right) @@ -1044,7 +1044,7 @@ private boolean compareAssociations(AssocStruct superAssoc, AssocStruct subAssoc .getAssociation().getLeft() .getCDCardinality())); } - + /** * Check if the srcAssoc has the same type as the tgtAssoc - direction, role names and the * cardinalities of srcAssoc are sub-intervals of the cardinalities of tgtAssoc. @@ -1062,7 +1062,7 @@ public boolean sameAssociationTypeSrcTgt(AssocStruct srcAssocSub, AssocStruct tg .equals(ClassSide.Right); boolean isRightLeft = srcAssocSub.getSide().equals(ClassSide.Right) && tgtAssocSuper.getSide() .equals(ClassSide.Left); - + if (isLeftLeft || isRightRight) { return matchRoleNames(srcAssocSub.getAssociation().getLeft(), tgtAssocSuper.getAssociation() .getLeft()) && matchRoleNames(srcAssocSub.getAssociation().getRight(), tgtAssocSuper @@ -1097,10 +1097,10 @@ else if (isLeftRight || isRightLeft) { .getAssociation().getLeft() .getCDCardinality())); } - + return false; } - + public boolean sameAssociationTypeSrcTgtRev(AssocStruct srcAssocSub, AssocStruct tgtAssocSuper) { boolean isLeftLeft = srcAssocSub.getSide().equals(ClassSide.Left) && tgtAssocSuper.getSide() .equals(ClassSide.Left); @@ -1110,7 +1110,7 @@ public boolean sameAssociationTypeSrcTgtRev(AssocStruct srcAssocSub, AssocStruct .equals(ClassSide.Right); boolean isRightLeft = srcAssocSub.getSide().equals(ClassSide.Right) && tgtAssocSuper.getSide() .equals(ClassSide.Left); - + if (isLeftRight || isRightLeft) { return matchRoleNames(srcAssocSub.getAssociation().getLeft(), tgtAssocSuper.getAssociation() .getLeft()) && matchRoleNames(srcAssocSub.getAssociation().getRight(), tgtAssocSuper @@ -1145,10 +1145,10 @@ else if (isLeftLeft || isRightRight) { .getAssociation().getLeft() .getCDCardinality())); } - + return false; } - + /** * Given the following two cardinalities, find their intersection * @@ -1202,7 +1202,7 @@ else if (cardinalityB.equals(AssocCardinality.Multiple) || cardinalityB.equals( } return null; } - + /** * This is the same function from CDDefinition, but it compares the classes based on the qualified * name of the class. @@ -1214,7 +1214,7 @@ public List getCDAssociationsListForType(ASTCDType type, boole List result = new ArrayList<>(); List associationsList = isSource ? srcCD.getCDDefinition() .getCDAssociationsList() : tgtCD.getCDDefinition().getCDAssociationsList(); - + for (ASTCDAssociation association : associationsList) { if (association.getLeftQualifiedName().getQName().equals(type.getSymbol() .getInternalQualifiedName()) && association.getCDAssocDir() @@ -1228,7 +1228,7 @@ else if (association.getRightQualifiedName().getQName().equals(type.getSymbol() } return result; } - + /** * Compute what associations can be used from a class (associations that were from the class and * superAssociations). For each class and each possible association we save the direction and also @@ -1244,28 +1244,28 @@ public void setMaps() { findNonInstantiableClasses(); checkRoleNameConflicts(); } - + private void processSourceTypes() { List srcTypes = getTypes(srcCD); for (ASTCDType astcdClass : srcTypes) { processAssociations(astcdClass, getCDAssociationsListForType(astcdClass, true), true); } } - + private void processTargetTypes() { List tgtTypes = getTypes(tgtCD); for (ASTCDType astcdClass : tgtTypes) { processAssociations(astcdClass, getCDAssociationsListForType(astcdClass, false), false); } } - + private List getTypes(ASTCDCompilationUnit compilationUnit) { List types = new ArrayList<>(); types.addAll(compilationUnit.getCDDefinition().getCDClassesList()); types.addAll(compilationUnit.getCDDefinition().getCDInterfacesList()); return types; } - + private void processAssociations(ASTCDType astcdClass, List associations, boolean isSource) { for (ASTCDAssociation astcdAssociation : associations) { @@ -1273,10 +1273,10 @@ private void processAssociations(ASTCDType astcdClass, List as : tgtCD); if (pair.a == null) continue; - + ASTCDAssociation copyAssoc = createVirtualAssociation(astcdAssociation); updateAssociationRoles(copyAssoc, astcdAssociation); - + if (isSource) { handleAssociationMapping(astcdClass, astcdAssociation, pair, copyAssoc, srcMap); } @@ -1285,14 +1285,14 @@ private void processAssociations(ASTCDType astcdClass, List as } } } - + private ASTCDAssociation createVirtualAssociation(ASTCDAssociation original) { ASTCDAssociation copyAssoc = original.deepClone(); copyAssoc.setName(" "); ensureCardinalities(copyAssoc); return copyAssoc; } - + private void ensureCardinalities(ASTCDAssociation assoc) { if (!assoc.getLeft().isPresentCDCardinality()) { assoc.getLeft().setCDCardinality(CD4CodeMill.cDCardMultBuilder().build()); @@ -1304,14 +1304,14 @@ private void ensureCardinalities(ASTCDAssociation assoc) { assoc.getLeft().setCDCardinality(CD4CodeMill.cDCardOneBuilder().build()); } } - + private void updateAssociationRoles(ASTCDAssociation copyAssoc, ASTCDAssociation original) { copyAssoc.getLeft().setCDRole(CD4CodeMill.cDRoleBuilder().setName(CDDiffUtil.inferRole(original .getLeft())).build()); copyAssoc.getRight().setCDRole(CD4CodeMill.cDRoleBuilder().setName(CDDiffUtil.inferRole(original .getRight())).build()); } - + private void handleAssociationMapping(ASTCDType astcdClass, ASTCDAssociation original, Pair pair, ASTCDAssociation copyAssoc, ArrayListMultimap map) { @@ -1326,7 +1326,7 @@ else if (pair.b.getSymbol().getInternalQualifiedName().equals(astcdClass.getSymb false, null)); } } - + private AssocStruct createAssocStruct(ASTCDAssociation assoc, ASTCDAssociation original, ASTCDType astcdType, ASTCDType connectedType, ClassSide side, Boolean isSuperAssoc, ASTCDType superClass) { @@ -1336,34 +1336,34 @@ private AssocStruct createAssocStruct(ASTCDAssociation assoc, ASTCDAssociation o } return new AssocStruct(assoc, direction, side, true, superClass, connectedType, original); } - + private AssocDirection determineAssocDirection(ASTCDAssociation assoc, ClassSide side) { if (assoc.getCDAssocDir().isBidirectional()) { return AssocDirection.BiDirectional; } return side == ClassSide.Left ? AssocDirection.LeftToRight : AssocDirection.RightToLeft; } - + private void inheritAssociations(ASTCDCompilationUnit compilationUnit, boolean isSource) { List types = getTypes(compilationUnit); for (ASTCDType astcdClass : types) { Set superTypes = CDDiffUtil.getAllSuperTypes(astcdClass, compilationUnit .getCDDefinition()); superTypes.remove(astcdClass); - + for (ASTCDType superClass : superTypes) { List associations = getCDAssociationsListForType(superClass, isSource); for (ASTCDAssociation assoc : associations) { Pair pair = getConnectedTypes(assoc, compilationUnit); if (pair.a == null) continue; - + processInheritedAssociation(astcdClass, assoc, superClass, pair, isSource); } } } } - + private void processInheritedAssociation(ASTCDType subClass, ASTCDAssociation assoc, ASTCDType superClass, Pair pair, boolean isSource) { ArrayListMultimap map = isSource ? srcMap : tgtMap; @@ -1380,14 +1380,14 @@ private void processInheritedAssociation(ASTCDType subClass, ASTCDAssociation as superClass)); } } - + private ASTCDAssociation createInheritedAssoc(ASTCDAssociation original, ASTCDType subClass, ClassSide side) { ASTCDAssociation assoc = original.deepClone(); assoc.setName(" "); updateAssociationRoles(assoc, original); ensureCardinalities(assoc); - + if (side == ClassSide.Left) { assoc.getLeft().setMCQualifiedType(createQualifiedType(subClass)); } @@ -1396,17 +1396,17 @@ private ASTCDAssociation createInheritedAssoc(ASTCDAssociation original, ASTCDTy } return assoc; } - + private ASTMCQualifiedType createQualifiedType(ASTCDType type) { return CD4CodeMill.mCQualifiedTypeBuilder().setMCQualifiedName(MCQualifiedNameFacade .createQualifiedName(type.getSymbol().getInternalQualifiedName())).build(); } - + private void findNonInstantiableClasses() { findDuplicateAttributes(srcCD, notInstClassesSrc, true); findDuplicateAttributes(tgtCD, notInstClassesTgt, false); } - + private void findDuplicateAttributes(ASTCDCompilationUnit compilationUnit, Set notInstClasses, boolean isSource) { for (ASTCDClass astcdClass : compilationUnit.getCDDefinition().getCDClassesList()) { @@ -1424,12 +1424,12 @@ private void findDuplicateAttributes(ASTCDCompilationUnit compilationUnit, } } } - + private void checkRoleNameConflicts() { checkRoleNameConflicts(srcCD, notInstClassesSrc, true); checkRoleNameConflicts(tgtCD, notInstClassesTgt, false); } - + private void checkRoleNameConflicts(ASTCDCompilationUnit compilationUnit, Set notInstClasses, boolean isSource) { for (ASTCDClass astcdClass : compilationUnit.getCDDefinition().getCDClassesList()) { @@ -1443,7 +1443,7 @@ private void checkRoleNameConflicts(ASTCDCompilationUnit compilationUnit, } } } - + /** Compute the subtypes for each type in the diagrams. */ public void setSubMaps() { srcSubMap = ArrayListMultimap.create(); @@ -1453,13 +1453,13 @@ public void setSubMaps() { srcSubMap.put(astcdClass, subClass); } } - + for (ASTCDClass astcdClass : tgtCD.getCDDefinition().getCDClassesList()) { for (ASTCDClass subClass : getSpannedInheritance(tgtCD, astcdClass)) { tgtSubMap.put(astcdClass, subClass); } } - + List interfaces = srcCD.getCDDefinition().getCDInterfacesList(); for (ASTCDInterface astcdInterface : interfaces) { for (ASTCDClass astcdClass : srcCD.getCDDefinition().getCDClassesList()) { @@ -1479,13 +1479,13 @@ public void setSubMaps() { } } } - + // Helper method to process interfaces and classes for superclass relationship private void processInterfacesAndClasses(ASTCDCompilationUnit cdUnit, ArrayListMultimap subMap) { List interfaces = cdUnit.getCDDefinition().getCDInterfacesList(); List classes = cdUnit.getCDDefinition().getCDClassesList(); - + for (ASTCDInterface astcdInterface : interfaces) { for (ASTCDClass astcdClass : classes) { if (CDInheritanceHelper.isSuperOf(astcdInterface.getSymbol().getInternalQualifiedName(), @@ -1495,14 +1495,14 @@ private void processInterfacesAndClasses(ASTCDCompilationUnit cdUnit, } } } - + private boolean sameRoleNameAndClass(String roleName, ASTCDClass astcdClass, boolean isSource) { String roleName1 = roleName.substring(0, 1).toUpperCase() + roleName.substring(1); - + // Determine which map and CD to use based on whether it's source or target ArrayListMultimap mapToUse = isSource ? srcMap : tgtMap; ASTCDCompilationUnit cdToUse = isSource ? srcCD : tgtCD; - + for (AssocStruct assocStruct : mapToUse.get(astcdClass)) { if (assocStruct.getSide().equals(ClassSide.Left)) { if (CDDiffUtil.inferRole(assocStruct.getAssociation().getRight()).equals(roleName) @@ -1521,7 +1521,7 @@ && getConnectedTypes(assocStruct.getAssociation(), cdToUse).a.getName().equals( } return false; } - + /** * Get the classes that are connected with the association. The function returns null if the * associated objects aren't classes. @@ -1542,7 +1542,7 @@ public static Pair getConnectedTypes(ASTCDAssociation asso Log.error("Could not resolve types of :" + CD4CodeMill.prettyPrint(association, false)); return new Pair<>(null, null); } - + /** * Compute the types that extend a given class. * @@ -1563,7 +1563,7 @@ public static List getSpannedInheritance(ASTCDCompilationUnit compil subclasses.remove(astcdClass); return subclasses; } - + /** * Check if the first cardinality is contained in the second cardinality. * @@ -1588,7 +1588,7 @@ else if (cardinality1.equals(AssocCardinality.AtLeastOne)) { return false; } } - + public static AssocCardinality cardToEnum(ASTCDCardinality cardinality) { if (cardinality.isOne()) { return AssocCardinality.One; @@ -1603,7 +1603,7 @@ else if (cardinality.isAtLeastOne()) { return AssocCardinality.Multiple; } } - + /** * Get the minimal non-abstract subclass(strict subclass) of a given type. The minimal subclass is * the subclass with the least amount of attributes and associations(ingoing and outgoing). @@ -1615,11 +1615,11 @@ else if (cardinality.isAtLeastOne()) { public Optional minSubClass(ASTCDType baseClass, boolean isSource) { ArrayListMultimap subMap = isSource ? srcSubMap : tgtSubMap; Set notInstClasses = isSource ? notInstClassesSrc : notInstClassesTgt; - + List subClasses = subMap.get(baseClass); int lowestCount = Integer.MAX_VALUE; ASTCDClass subclassWithLowestCount = null; - + for (ASTCDClass subclass : subClasses) { if (!subclass.getModifier().isAbstract() && !notInstClasses.contains(subclass)) { int attributeCount; @@ -1632,23 +1632,23 @@ public Optional minSubClass(ASTCDType baseClass, boolean isSource) { int associationCount = getAssociationCount(subclass, isSource); int otherAssocsCount = getAllOtherAssocs(subclass, isSource).size(); int totalCount = attributeCount + associationCount + otherAssocsCount; - + if (totalCount < lowestCount) { lowestCount = totalCount; subclassWithLowestCount = subclass; } } } - + return Optional.ofNullable(subclassWithLowestCount); } - + public int getAssociationCount(ASTCDType astcdClass, boolean isSource) { int count = 0; // Determine which map and CD to use based on whether it's source or target ArrayListMultimap mapToUse = isSource ? srcMap : tgtMap; ASTCDCompilationUnit cdToUse = isSource ? srcCD : tgtCD; - + for (AssocStruct assocStruct : mapToUse.get(astcdClass)) { if (assocStruct.getSide().equals(ClassSide.Left)) { if ((assocStruct.getAssociation().getRight().getCDCardinality().isAtLeastOne() @@ -1671,7 +1671,7 @@ public int getAssociationCount(ASTCDType astcdClass, boolean isSource) { } return count; } - + /** * Check if the directions match in reverse. * @@ -1697,7 +1697,7 @@ public boolean matchDirectionInReverse(AssocStruct srcStruct, AssocDirection.RightToLeft) && tgtStruct.a.getDirection().equals( AssocDirection.LeftToRight))); } - + public static boolean matchDirection(AssocStruct srcStruct, Pair tgtStruct) { if (((srcStruct.getSide().equals(ClassSide.Left) && tgtStruct.b.equals(ClassSide.Left)) @@ -1715,7 +1715,7 @@ public static boolean matchDirection(AssocStruct srcStruct, AssocDirection.RightToLeft) && tgtStruct.a.getDirection().equals( AssocDirection.LeftToRight))); } - + public boolean sameAssocStruct(AssocStruct srcStruct, AssocStruct tgtStruct) { return CDDiffUtil.inferRole(srcStruct.getAssociation().getLeft()).equals(CDDiffUtil.inferRole( tgtStruct.getAssociation().getLeft())) && CDDiffUtil.inferRole(srcStruct.getAssociation() @@ -1725,7 +1725,7 @@ && matchDirection(srcStruct, new Pair<>(tgtStruct, tgtStruct.getSide())) && matc && matchRoleNames(srcStruct.getAssociation().getRight(), tgtStruct.getAssociation() .getRight()); } - + public boolean sameAssocStructInReverse(AssocStruct struct, AssocStruct tgtStruct) { return CDDiffUtil.inferRole(struct.getAssociation().getLeft()).equals(CDDiffUtil.inferRole( tgtStruct.getAssociation().getRight())) && CDDiffUtil.inferRole(struct.getAssociation() @@ -1734,7 +1734,7 @@ && matchDirectionInReverse(struct, new Pair<>(tgtStruct, tgtStruct.getSide())) && matchRoleNames(struct.getAssociation().getLeft(), tgtStruct.getAssociation().getRight()) && matchRoleNames(struct.getAssociation().getRight(), tgtStruct.getAssociation().getLeft()); } - + /** * Compare associations. If for a pair of associations one of them is a subassociation and a loop * association, the other one is marked so that it won't be looked at for generation of object @@ -1753,7 +1753,7 @@ public void reduceMaps() { } } } - + public boolean sameAssociationSpec(ASTCDAssociation association, ASTCDAssociation association2) { Pair cardinalities = getCardinality(association2); Pair conncected1 = getConnectedTypes(association, srcCD); @@ -1769,12 +1769,12 @@ && cardToEnum(association.getRight().getCDCardinality()).equals(cardToEnum( } return false; } - + public boolean isLoopStruct(AssocStruct assocStruct) { Pair pair = getConnectedTypes(assocStruct.getAssociation(), srcCD); return pair.a.equals(pair.b); } - + /** * Delete all associations that use the given type as target. * @@ -1785,9 +1785,9 @@ public void deleteOtherSide(ASTCDType astcdType, boolean isSource) { // Select the map and CD to use based on whether it's source or target ArrayListMultimap mapToUse = isSource ? srcMap : tgtMap; ASTCDCompilationUnit cdToUse = isSource ? srcCD : tgtCD; - + List>> toDelete = new ArrayList<>(); - + for (ASTCDType toCheck : mapToUse.keySet()) { if (toCheck != astcdType) { List toDeleteStructs = new ArrayList<>(); @@ -1806,7 +1806,7 @@ else if (struct.getSide().equals(ClassSide.Right) && getConnectedTypes(struct toDelete.add(new Pair<>(toCheck, toDeleteStructs)); } } - + // Remove the structures from the map for (Pair> pair : toDelete) { for (AssocStruct struct : pair.b) { @@ -1814,7 +1814,7 @@ else if (struct.getSide().equals(ClassSide.Right) && getConnectedTypes(struct } } } - + /** * Delete the association from the other associated type. * @@ -1826,7 +1826,7 @@ public void deleteAssocOtherSide(AssocStruct assocStruct, boolean isSource) { // Select the appropriate map and CD based on the isSource flag ArrayListMultimap mapToUse = isSource ? srcMap : tgtMap; ASTCDCompilationUnit cdToUse = isSource ? srcCD : tgtCD; - + if (assocStruct.getSide().equals(ClassSide.Left)) { // Get the associated types on the right side ASTCDType connectedTypeB = getConnectedTypes(assocStruct.getAssociation(), cdToUse).b; @@ -1857,7 +1857,7 @@ && sameAssocStruct(assocStruct, struct)) { } } } - + /** * This function is used when the object diagrams are derived under simple semantics. The function * changes the stereotype to contain only the base type of the object without the superclasses. @@ -1881,7 +1881,7 @@ public void makeSimpleSem(List list) { } } } - + /** * Get the cardinalities of an association. * @@ -1897,7 +1897,7 @@ public Pair getCardinality(ASTCDAssociation else { left = association.getLeft().getCDCardinality(); } - + if (!association.getRight().isPresentCDCardinality()) { right = new ASTCDCardMult(); } @@ -1906,7 +1906,7 @@ public Pair getCardinality(ASTCDAssociation } return new Pair<>(left, right); } - + /** * Get the matching AssocStructs for a given pair. The id 'unmodifiedAssoc' is used to identify * the association in the map. @@ -1928,7 +1928,7 @@ public Pair getStructsForAssocDiff(ASTCDAssociation sr else if (getAssocStructByUnmod(srcCLasses.b, srcAssoc, true).isPresent()) { srcStruct = getAssocStructByUnmod(srcCLasses.b, srcAssoc, true).get(); } - + if (!reversed && getAssocStructByUnmod(tgtCLasses.a, tgtAssoc, false).isPresent()) { tgtStruct = getAssocStructByUnmod(tgtCLasses.a, tgtAssoc, false).get(); } @@ -1937,7 +1937,7 @@ else if (getAssocStructByUnmod(tgtCLasses.b, tgtAssoc, false).isPresent()) { } return new Pair<>(srcStruct, tgtStruct); } - + /** * Get the matching AssocStructs for a given association in srcCD/tgtCD. * @@ -1951,7 +1951,7 @@ public Optional getAssocStructByUnmod(ASTCDType astcdType, // Select the appropriate map and CD based on the isSource flag ArrayListMultimap mapToUse = isSource ? srcMap : tgtMap; ASTCDCompilationUnit cdToUse = isSource ? srcCD : tgtCD; - + // Iterate through the AssocStructs for the given ASTCDType for (AssocStruct struct : mapToUse.get(astcdType)) { if (sameAssociation(struct.getUnmodifiedAssoc(), association, cdToUse)) { @@ -1960,7 +1960,7 @@ public Optional getAssocStructByUnmod(ASTCDType astcdType, } return Optional.empty(); } - + /** * Check if the superclasses of the given one are the same in the source and target diagram. * @@ -1999,7 +1999,7 @@ public boolean hasDiffSuper(ASTCDType astcdType) { } return false; } - + /** * Delete associations from srcMap with a specific role name * @@ -2034,7 +2034,7 @@ public void deleteAssocsFromSrc(ASTCDType astcdClass, ASTCDRole role) { } } } - + public boolean isOtherSideNeeded(AssocStruct assocStruct) { if (assocStruct.getSide().equals(ClassSide.Left) && (assocStruct.getAssociation().getRight() .getCDCardinality().isOne() || assocStruct.getAssociation().getRight().getCDCardinality() @@ -2045,7 +2045,7 @@ public boolean isOtherSideNeeded(AssocStruct assocStruct) { .getCDCardinality().isOne() || assocStruct.getAssociation().getLeft().getCDCardinality() .isAtLeastOne()); } - + /** * Check for all compositions if a subcomponent cannot be instantiated. If this is the case, the * composite class cannot be instantiated either. @@ -2067,7 +2067,7 @@ && minSubClass(pair.b, true).isEmpty())) { } } } - + for (ASTCDType astcdType : tgtMap.keySet()) { for (ASTCDAssociation association : getCDAssociationsListForType(astcdType, false)) { Pair pair = Syn2SemDiffHelper.getConnectedTypes(association, tgtCD); @@ -2085,7 +2085,7 @@ && minSubClass(pair.b, false).isEmpty())) { } } } - + /** * Delete associations from trgMap with a specific role name * @@ -2120,7 +2120,7 @@ public void deleteAssocsFromTgt(ASTCDType astcdClass, ASTCDRole role) { } } } - + public List deletedAssocsForClass(ASTCDType astcdClass) { List list = new ArrayList<>(); for (ASTCDAssociation association : deletedAssocs) { @@ -2129,7 +2129,7 @@ public List deletedAssocsForClass(ASTCDType astcdClass) { } return list; } - + /** * Search for an association in srcCD that can't be matched with an association in tgtCD. * @@ -2192,12 +2192,12 @@ else if ((matchingStrategies.isEmpty() || matchingStrategies.contains( } return list; } - + public boolean containedInList(AssocStruct srcStruct, AssocStruct tgtAssocStruct) { return diffs.stream().anyMatch(obj -> obj.getSrcElem() == srcStruct.getUnmodifiedAssoc() && obj .getTgtElem() == tgtAssocStruct.getUnmodifiedAssoc()); } - + /** * Search for an association in tgtCD that can't be matched with an association in srcCD. * @@ -2248,7 +2248,7 @@ else if ((matchingStrategies.isEmpty() || matchingStrategies.contains( } return list; } - + public List addedAssocsForClass(ASTCDType astcdClass) { List list = new ArrayList<>(); for (ASTCDAssociation association : addedAssocs) { @@ -2257,7 +2257,7 @@ public List addedAssocsForClass(ASTCDType astcdClass) { } return list; } - + /** * Get two non-abstract subclasses for a given pair. * @@ -2319,7 +2319,7 @@ else if (possibleClassToUseForRightSideBasedOnRightTgt != null && srcSubMap.get( } return null; } - + public static ASTCDClass getCDClass(ASTCDCompilationUnit compilationUnit, String className) { for (ASTCDClass astcdClass : compilationUnit.getCDDefinition().getCDClassesList()) { if (astcdClass.getSymbol().getInternalQualifiedName().equals(className)) { @@ -2328,7 +2328,7 @@ public static ASTCDClass getCDClass(ASTCDCompilationUnit compilationUnit, String } return null; } - + /** * Check what the changes to the stereotype of a class are. * @@ -2350,7 +2350,7 @@ public Pair stereotypeChange(ASTCDClass newClass, ASTCDClass o } return new Pair<>(abstractChange, singletonChange); } - + /** * Sort the associations for a given type so that pairs aren't duplicated. * @@ -2424,13 +2424,13 @@ else if (assocStruct.getSide().equals(ClassSide.Right) && assocStruct1.getSide() } return new OverlappingAssocsDirect(directOverlappingAssocs, directOverlappingNoRelation); } - + public OverlappingAssocsDirect computeDirectForTypeNew(ASTCDType astcdType, ArrayListMultimap map, ASTCDCompilationUnit compilationUnit) { - + Set> directOverlappingAssocs = new HashSet<>(); Set> directOverlappingNoRelation = new HashSet<>(); - + List assocStructs = map.get(astcdType); for (AssocStruct assoc1 : assocStructs) { for (AssocStruct assoc2 : assocStructs) { @@ -2440,17 +2440,17 @@ public OverlappingAssocsDirect computeDirectForTypeNew(ASTCDType astcdType, compilationUnit); Pair types2 = getConnectedTypes(assoc2.getAssociation(), compilationUnit); - + if (areTypesValid(types1, types2)) { AssocStruct sub = assoc1; AssocStruct sup = assoc2; - + if (isSwappable(assoc1, assoc2, types1, types2)) { sub = assoc2; sup = assoc1; } updateAssocUsage(sub, sup, compilationUnit); - + directOverlappingAssocs.add(new Pair<>(sub, sup)); } } @@ -2459,17 +2459,17 @@ public OverlappingAssocsDirect computeDirectForTypeNew(ASTCDType astcdType, } return new OverlappingAssocsDirect(directOverlappingAssocs, directOverlappingNoRelation); } - + private boolean pairExists(Set> set, AssocStruct a, AssocStruct b) { return set.stream().anyMatch(pair -> (pair.a == b && pair.b == a)); } - + private boolean areTypesValid(Pair pair1, Pair pair2) { return pair1.a != null && pair1.b != null && pair2.a != null && pair2.b != null; } - + private boolean isSwappable(AssocStruct assoc1, AssocStruct assoc2, Pair pair1, Pair pair2) { return assoc1.getSide().equals(ClassSide.Left) && assoc2.getSide().equals(ClassSide.Left) @@ -2480,7 +2480,7 @@ private boolean isSwappable(AssocStruct assoc1, AssocStruct assoc2, pair2.a) || assoc1.getSide().equals(ClassSide.Right) && assoc2.getSide().equals( ClassSide.Left) && pair1.a.equals(pair2.b) && pair1.b.equals(pair2.a); } - + private void updateAssocUsage(AssocStruct sub, AssocStruct sup, ASTCDCompilationUnit compilationUnit) { setOtherSideUsage(sub, AssocType.SUB, compilationUnit); @@ -2492,7 +2492,7 @@ private void updateAssocUsage(AssocStruct sub, AssocStruct sup, sup.setUsedAs(AssocType.SUPER); } } - + /** * Get the pairs of duplicated associations for a given type * @@ -2523,7 +2523,7 @@ public List> getPairsForType(ASTCDType astcdType, } return list; } - + public void setOtherSideUsage(AssocStruct assocStruct, AssocType assocType, ASTCDCompilationUnit compilationUnit) { if (assocStruct.getDirection().equals(AssocDirection.BiDirectional)) { @@ -2553,34 +2553,34 @@ && sameAssocStruct(assocStruct, struct)) { } } } - + public void filterMatched() { matchedClasses.removeIf(pair -> !pair.a.getSymbol().getInternalQualifiedName().equals(pair.b .getSymbol().getInternalQualifiedName())); - + matchedInterfaces.removeIf(pair -> !pair.a.getSymbol().getInternalQualifiedName().equals(pair.b .getSymbol().getInternalQualifiedName())); } - + public void setMatcher() { matcher = new CachedMatches<>(matches.getAssocMatches()); } - + public List>> sortDiffs( List> input) { Map> resultMap = new HashMap<>(); - + for (Pair pair : input) { ASTCDClass cdClass = pair.a; AssocStruct assocStruct = pair.b; - + resultMap.computeIfAbsent(cdClass, key -> new ArrayList<>()).add(assocStruct); } - + return resultMap.entrySet().stream().map(entry -> new Pair<>(entry.getKey(), entry.getValue())) .collect(Collectors.toList()); } - + public Optional>> getPair( List>> list, ASTCDClass astcdClass) { for (Pair> pair : list) { @@ -2590,7 +2590,7 @@ public Optional>> getPair( } return Optional.empty(); } - + /** * This function is used to treat duplicated associations BEFORE the overlapping associations. * This was needed as otherwise overlapping associations would be treated twice and eventually @@ -2605,22 +2605,22 @@ public void findDuplicatedAssocs() { Set tgtToDelete = new HashSet<>(); Set> tgtAssocsToDelete = new HashSet<>(); Set tgtAssocsToMergeWithDelete = new HashSet<>(); - + // Process source associations processAssociationMap(srcMap, srcCD, srcAssocsToMergeWithDelete, srcAssocsToDelete, srcToDelete, true); - + // Process target associations processAssociationMap(tgtMap, tgtCD, tgtAssocsToMergeWithDelete, tgtAssocsToDelete, tgtToDelete, false); - + // Handle deletions and merges for src handleDeletionsAndMerges(srcToDelete, srcAssocsToMergeWithDelete, srcAssocsToDelete, true); - + // Handle deletions and merges for tgt handleDeletionsAndMerges(tgtToDelete, tgtAssocsToMergeWithDelete, tgtAssocsToDelete, false); } - + // Helper method to process associations private void processAssociationMap(ArrayListMultimap assocMap, ASTCDCompilationUnit cdType, Set assocsToMergeWithDelete, @@ -2645,7 +2645,7 @@ else if (isDeletable(association, superAssoc, isSrc)) { } } } - + // Determine if association is mergable private boolean isMergable(AssocStruct association, AssocStruct superAssoc, ASTCDType astcdClass, Set assocsToMergeWithDelete, boolean isSrc) { @@ -2654,14 +2654,14 @@ private boolean isMergable(AssocStruct association, AssocStruct superAssoc, ASTC || isInConflict(association, superAssoc) && inInheritanceRelation(association, superAssoc, isSrc ? srcCD : tgtCD); } - + // Determine if association is deletable private boolean isDeletable(AssocStruct association, AssocStruct superAssoc, boolean isSrc) { return isInConflict(association, superAssoc) && !inInheritanceRelation(association, superAssoc, isSrc ? srcCD : tgtCD) && !getConnectedTypes(association.getAssociation(), isSrc ? srcCD : tgtCD).equals(getConnectedTypes(superAssoc.getAssociation(), isSrc ? srcCD : tgtCD)); } - + // Handle deletions and merges for src or tgt private void handleDeletionsAndMerges(Set toDelete, Set assocsToMergeWithDelete, Set> assocsToDelete, @@ -2686,7 +2686,7 @@ private void handleDeletionsAndMerges(Set toDelete, removeAssociations(assocsToMergeWithDelete, isSrc); deleteAssociations(assocsToDelete, isSrc); } - + // Delete a class and its subclasses private void deleteClassAndSubclasses(ASTCDType astcdClass, boolean isSrc) { if (isSrc) { @@ -2706,7 +2706,7 @@ private void deleteClassAndSubclasses(ASTCDType astcdClass, boolean isSrc) { } } } - + // Remove associations private void removeAssociations(Set assocsToMergeWithDelete, boolean isSrc) { for (DeleteStruct pair : assocsToMergeWithDelete) { @@ -2718,7 +2718,7 @@ private void removeAssociations(Set assocsToMergeWithDelete, boole } } } - + // Delete associations private void deleteAssociations(Set> assocsToDelete, boolean isSrc) { for (Pair pair : assocsToDelete) { @@ -2730,7 +2730,7 @@ private void deleteAssociations(Set> assocsToDelete, } } } - + /** * Get a non-abstract class for changed type. * @@ -2747,7 +2747,7 @@ public Optional getClassForDiff(ASTCDClass astcdClass, } return Optional.empty(); } - + /** * Check if an attribute is conatined in a class in tgtCD. * @@ -2781,7 +2781,7 @@ else if (indexCurrent != -1 && indexAttribute != -1 && (att.getName().equals(att } return false; } - + /** * Delete associations from subclasses in tgtCD. * @@ -2803,7 +2803,7 @@ public void deleteAssocFromSubTgt(AssocStruct assocStruct, ASTCDType astcdType) } } } - + /** * Delete associations from subclasses in srcCD. * @@ -2823,7 +2823,7 @@ public void deleteAssocsFromSubSrc(AssocStruct assocStruct, ASTCDType astcdType) } } } - + public List>> transform( List> list) { List>> result = new ArrayList<>(); @@ -2832,7 +2832,7 @@ public List>> transform( } return result; } - + /** * Sort the added and deleted attributes for a given type. This reduces the number of generated * diff-witnesses. @@ -2842,7 +2842,7 @@ public List>> transform( public void sortTypeDiff(TypeDiffStruct typeDiffStruct) { List>> added = new ArrayList<>(); List>> deleted = new ArrayList<>(); - + if (typeDiffStruct.getAddedAttributes() != null && !typeDiffStruct.getAddedAttributes() .isEmpty()) { added.addAll(typeDiffStruct.getAddedAttributes()); @@ -2851,33 +2851,33 @@ public void sortTypeDiff(TypeDiffStruct typeDiffStruct) { .isEmpty()) { deleted.addAll(typeDiffStruct.getDeletedAttributes()); } - + Map classAttributeMap = new HashMap<>(); - + for (Pair> pair : added) { ASTCDClass clazz = pair.a; List attribute = pair.b; - + if (!classAttributeMap.containsKey(clazz)) { classAttributeMap.put(clazz, new AddedDeletedAtt()); } classAttributeMap.get(clazz).getAddedAttributes().addAll(attribute); } - + for (Pair> pair : deleted) { ASTCDClass clazz = pair.a; List attribute = pair.b; - + if (!classAttributeMap.containsKey(clazz)) { classAttributeMap.put(clazz, new AddedDeletedAtt()); } classAttributeMap.get(clazz).getDeletedAttributes().addAll(attribute); } - + List>> addedNew = new ArrayList<>(); List>> deletedNew = new ArrayList<>(); List> addedDeleted = new ArrayList<>(); - + // Remove AddedDeletedAtt if no deleted attributes are present for (Map.Entry astcdClass : classAttributeMap.entrySet()) { if (astcdClass.getValue().getDeletedAttributes().isEmpty()) { @@ -2895,5 +2895,5 @@ else if (astcdClass.getValue().getAddedAttributes().isEmpty()) { typeDiffStruct.setAddedAttributes(addedNew); typeDiffStruct.setDeletedAttributes(deletedNew); } - + } diff --git a/cddiff/src/main/java/de/monticore/odvalidity/AssociationsMatcher.java b/cddiff/src/main/java/de/monticore/odvalidity/AssociationsMatcher.java index bf6141820..780e63649 100644 --- a/cddiff/src/main/java/de/monticore/odvalidity/AssociationsMatcher.java +++ b/cddiff/src/main/java/de/monticore/odvalidity/AssociationsMatcher.java @@ -65,7 +65,7 @@ public boolean checkAssociations(ASTODArtifact od, ASTCDCompilationUnit cd, } // for closed-world semantics each link in od must be an instance of an association in cd - if (Semantic.isClosedWorld(semantics)) { + if (SemanticsHelper.isClosedWorld(semantics)) { for (ASTODLink link : links) { if (cd.getCDDefinition().getCDAssociationsList().stream().noneMatch( assoc -> matchLinkAgainstAssociation(link, assoc))) { diff --git a/cddiff/src/main/java/de/monticore/odvalidity/ClassMatcher.java b/cddiff/src/main/java/de/monticore/odvalidity/ClassMatcher.java index 1b88d8a76..393eddbc4 100644 --- a/cddiff/src/main/java/de/monticore/odvalidity/ClassMatcher.java +++ b/cddiff/src/main/java/de/monticore/odvalidity/ClassMatcher.java @@ -3,10 +3,7 @@ import de.monticore.cd4code._symboltable.ICD4CodeArtifactScope; import de.monticore.cdassociation._ast.ASTCDAssociation; -import de.monticore.cdbasis._ast.ASTCDAttribute; -import de.monticore.cdbasis._ast.ASTCDClass; -import de.monticore.cdbasis._ast.ASTCDCompilationUnit; -import de.monticore.cdbasis._ast.ASTCDType; +import de.monticore.cdbasis._ast.*; import de.monticore.cddiff.alloycddiff.CDSemantics; import de.monticore.cddiff.ow2cw.CDInheritanceHelper; import de.monticore.cdinterfaceandenum._ast.ASTCDEnum; @@ -21,6 +18,7 @@ import de.monticore.types.mccollectiontypes._ast.ASTMCListType; import de.se_rwth.commons.logging.Log; import java.util.*; +import java.util.stream.Collectors; public class ClassMatcher { @@ -72,7 +70,7 @@ public boolean checkAllObjectsInClassDiagram(ASTODArtifact od, ASTCDCompilationU String objectType = obj.getMCObjectType().printType(); Optional optClass = getCDClassOfType(objectType); - if (Semantic.isClosedWorld(semantics) && optClass.isEmpty()) { + if (SemanticsHelper.isClosedWorld(semantics) && optClass.isEmpty()) { Log.println("[CONFLICT] Could not find class: " + objectType); return false; } @@ -83,20 +81,24 @@ else if (optClass.isPresent() && (optClass.get().getModifier().isAbstract() return false; } - if (semantics.equals(CDSemantics.STA_OPEN_WORLD)) { + if (SemanticsHelper.isSuperTypeAware(semantics)) { Optional> optSuper = STAObjectMatcher.getSuperSetFromStereotype(obj); if (optSuper.isPresent()) { for (String type : optSuper.get()) { if (!optSuper.get().containsAll(STAObjectMatcher.getSuperSet(type, scope))) { + Log.println("[CONFLICT]" + optSuper + "does not contain" + STAObjectMatcher + .getSuperSet(type, scope)); return false; } Optional optType = getCDClassOfType(type); if (optType.isPresent()) { if (optClass.isPresent() && !optType.equals(optClass) && CDInheritanceHelper .isSuperOf(objectType, type, scope)) { + Log.println("[CONFLICT]" + type + "is not instantiated by" + obj.getName()); return false; } - if (!isObjectValid4Class(obj, optType.get(), semantics)) { + // We check with STA_OPEN_WORLD to prevent a call to areObjectAttributesValidInClass + if (!isObjectValid4Class(obj, optType.get(), CDSemantics.STA_OPEN_WORLD)) { return false; } } @@ -112,7 +114,7 @@ else if (optClass.isPresent() && (optClass.get().getModifier().isAbstract() private boolean isInstanceOf(ASTODObject object, ASTCDType type) { // check the intanceof-stereotype iff semantics is STA open-world - if (Semantic.isSuperTypeAware(semantics)) { + if (SemanticsHelper.isSuperTypeAware(semantics)) { Optional> optSuper = STAObjectMatcher.getSuperSetFromStereotype(object); if (optSuper.isPresent()) { return optSuper.get().contains(type.getSymbol().getInternalQualifiedName()); @@ -158,7 +160,7 @@ && areAttributesSemanticallyEqual(odAttribute, cdAttribute))) { } } - if (Semantic.isClosedWorld(semantics)) { + if (SemanticsHelper.isClosedWorld(semantics)) { return areObjectAttributesValidInClass(obj.getODAttributeList(), superAttributes); } @@ -207,6 +209,8 @@ && areAttributesSemanticallyEqual(odAttr, cdAttr)) { if (!odAttrFoundInCD) { // If we didn't find a matching attribute in class then we check if it exists in the // associations + Log.println("[CONFLICT] Could not find: " + odAttr.getName() + " in class attributes " + + cdAttributes.stream().map(ASTCDAttributeTOP::getName).collect(Collectors.toSet())); ASTCDAssociation cdAssociation = getCDAssociationOfODObjectAttribute(odAttr); return cdAssociation != null; } @@ -451,7 +455,7 @@ private Optional getEnum(String enumName) { * @param value Enumeration value */ private boolean validateEnumValue(ASTCDEnum cdEnum, String value) { - if (Semantic.isClosedWorld(semantics)) { + if (SemanticsHelper.isClosedWorld(semantics)) { for (var cdEnumMember : cdEnum.getCDEnumConstantList()) { if (cdEnumMember.getName().equals(value)) { return true; diff --git a/cddiff/src/main/java/de/monticore/odvalidity/OD2CDMatcher.java b/cddiff/src/main/java/de/monticore/odvalidity/OD2CDMatcher.java index 226d0ff77..6ae42ba41 100644 --- a/cddiff/src/main/java/de/monticore/odvalidity/OD2CDMatcher.java +++ b/cddiff/src/main/java/de/monticore/odvalidity/OD2CDMatcher.java @@ -42,7 +42,7 @@ public boolean checkIfDiffWitness(CDSemantics semantics, File baseCDFile, File c public boolean checkIfDiffWitness(CDSemantics semantics, ASTCDCompilationUnit baseCD, ASTCDCompilationUnit compareCD, ASTODArtifact od) { - if (Semantic.isSuperTypeAware(semantics)) { + if (SemanticsHelper.isSuperTypeAware(semantics)) { return new STAObjectMatcher(this).isDiffWitness(semantics, baseCD, compareCD, od); } else { diff --git a/cddiff/src/main/java/de/monticore/odvalidity/STAObjectMatcher.java b/cddiff/src/main/java/de/monticore/odvalidity/STAObjectMatcher.java index 1fc6f7a2e..07bff30c4 100644 --- a/cddiff/src/main/java/de/monticore/odvalidity/STAObjectMatcher.java +++ b/cddiff/src/main/java/de/monticore/odvalidity/STAObjectMatcher.java @@ -67,7 +67,7 @@ public boolean isDiffWitness(CDSemantics semantic, ASTCDCompilationUnit baseCD, // iterate over all objects for (ASTODObject obj : objectList) { // for closed world semantics call hasObjectSameInheritance() - if (Semantic.isClosedWorld(semantic)) { + if (SemanticsHelper.isClosedWorld(semantic)) { if (!hasObjectSameInheritance(obj, baseScope, compScope)) { // object has not the same inheritance in both CDs // -> DiffWitness @@ -76,7 +76,7 @@ public boolean isDiffWitness(CDSemantics semantic, ASTCDCompilationUnit baseCD, } } // for open world semantics call checkInheritanceOpenWorld() - else if (Semantic.isOpenWorld(semantic)) { + else if (SemanticsHelper.isOpenWorld(semantic)) { if (!checkInheritanceOpenWorld(obj, baseScope, compScope, compCD)) { // inheritance contradicts that both CDs have the same open world semantics // -> DiffWitness diff --git a/cddiff/src/main/java/de/monticore/odvalidity/Semantic.java b/cddiff/src/main/java/de/monticore/odvalidity/SemanticsHelper.java similarity index 95% rename from cddiff/src/main/java/de/monticore/odvalidity/Semantic.java rename to cddiff/src/main/java/de/monticore/odvalidity/SemanticsHelper.java index 27fa5aa8e..6133dd7d3 100644 --- a/cddiff/src/main/java/de/monticore/odvalidity/Semantic.java +++ b/cddiff/src/main/java/de/monticore/odvalidity/SemanticsHelper.java @@ -3,7 +3,7 @@ import de.monticore.cddiff.alloycddiff.CDSemantics; -public class Semantic { +public class SemanticsHelper { public static boolean isOpenWorld(CDSemantics semantic) { return semantic == CDSemantics.SIMPLE_OPEN_WORLD || semantic == CDSemantics.STA_OPEN_WORLD; diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java index a2202e9f8..8ac3f145d 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java @@ -28,86 +28,79 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class Syn2SemDiffTest extends SynDiffTestBasis { - + private static final String cddiffDir = "src/test/resources/de/monticore/cddiff/"; private static final String validationDir = "src/test/resources/validation/"; - + public static Stream emptyWitnesses() { - return Stream.of( -// Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", -// "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", false, false), Arguments.of(cddiffDir, -// "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", -// "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, false), Arguments.of(cddiffDir, -// "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", -// "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, false), Arguments.of(cddiffDir, -// "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", -// "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", false, false), Arguments.of( -// cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", -// "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, true), Arguments.of( -// cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", -// "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, true), Arguments.of( -// cddiffDir, "syndiff/TypeDiff/ChangedAttribute/CD71.cd", -// "syndiff/TypeDiff/ChangedAttribute/CD71.cd", false, false), -// Arguments.of(cddiffDir, "syndiff/TypeDiff/ChangedAttribute/CD71.cd", -// "syndiff/TypeDiff/ChangedAttribute/CD71.cd", false, true), Arguments.of(cddiffDir, -// "syndiff/TypeDiff/RemovedAttributeNoDiff/CD21.cd", -// "syndiff/TypeDiff/RemovedAttributeNoDiff/CD22.cd", false, false), Arguments.of( -// cddiffDir, "syndiff/SyntaxDiff/MaCoCo_v2.cd", "syndiff/SyntaxDiff/MaCoCo_v1.cd", -// false, false), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", -// "DigitalTwins/DigitalTwin3.cd", false, false), Arguments.of(cddiffDir, -// "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", false, -// false), -// Arguments.of(cddiffDir, "Employees/Employees2.cd", -// "Employees/Employees1.cd", true, true), - Arguments.of(cddiffDir, + return Stream.of(Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", + "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", false, false), Arguments.of(cddiffDir, + "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", + "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, false), Arguments.of(cddiffDir, + "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", + "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, false), Arguments.of(cddiffDir, + "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", + "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", false, false), Arguments.of( + cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", + "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, true), Arguments.of( + cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", + "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, true), Arguments.of( + cddiffDir, "syndiff/TypeDiff/ChangedAttribute/CD71.cd", + "syndiff/TypeDiff/ChangedAttribute/CD71.cd", false, false), + Arguments.of(cddiffDir, "syndiff/TypeDiff/ChangedAttribute/CD71.cd", + "syndiff/TypeDiff/ChangedAttribute/CD71.cd", false, true), Arguments.of(cddiffDir, + "syndiff/TypeDiff/RemovedAttributeNoDiff/CD21.cd", + "syndiff/TypeDiff/RemovedAttributeNoDiff/CD22.cd", false, false), Arguments.of( + cddiffDir, "syndiff/SyntaxDiff/MaCoCo_v2.cd", "syndiff/SyntaxDiff/MaCoCo_v1.cd", + false, false), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", + "DigitalTwins/DigitalTwin3.cd", false, false), Arguments.of(cddiffDir, + "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", false, + false), Arguments.of(cddiffDir, "Employees/Employees2.cd", + "Employees/Employees1.cd", true, true), Arguments.of(cddiffDir, "Employees/Employees2.cd", "Employees/Employees1.cd", false, true), Arguments.of(cddiffDir, "Employees/Employees8.cd", "Employees/Employees7.cd", true, true), Arguments.of( validationDir, "cddiff/LibraryV3.cd", - "cddiff/LibraryV2.cd", true, true) -// , Arguments.of( -// validationDir, "cddiff/LibraryV5.cd", -// "cddiff/LibraryV4.cd", true, true), Arguments.of( -// validationDir, "cd4analysis/ManagementV2.cd", -// "cd4analysis/ManagementV1.cd", true, true), -// Arguments.of(validationDir, "cd4analysis/MyCompanyV2.cd", "cd4analysis/MyCompanyV1.cd", -// true, true), Arguments.of(validationDir, "cd4analysis/MyExampleV2.cd", -// "cd4analysis/MyExampleV1.cd", true, true), Arguments.of(validationDir, -// "cd4analysis/MyExampleV1.cd", "cd4analysis/MyExampleV2.cd", true, true), -// Arguments.of(validationDir, "cd4analysis/ManagementV2.cd", "cd4analysis/ManagementV1.cd", -// true, false), Arguments.of(validationDir, "cd4analysis/MyExampleV2.cd", -// "cd4analysis/MyExampleV1.cd", true, false), Arguments.of(validationDir, -// "cd4analysis/MyExampleV1.cd", "cd4analysis/MyExampleV2.cd", true, false) - ); + "cddiff/LibraryV2.cd", true, true), Arguments.of( + validationDir, "cddiff/LibraryV5.cd", + "cddiff/LibraryV4.cd", true, true), Arguments.of( + validationDir, "cd4analysis/ManagementV2.cd", + "cd4analysis/ManagementV1.cd", true, true), + Arguments.of(validationDir, "cd4analysis/MyCompanyV2.cd", "cd4analysis/MyCompanyV1.cd", + true, true), Arguments.of(validationDir, "cd4analysis/MyExampleV2.cd", + "cd4analysis/MyExampleV1.cd", true, true), Arguments.of(validationDir, + "cd4analysis/MyExampleV1.cd", "cd4analysis/MyExampleV2.cd", true, true), + Arguments.of(validationDir, "cd4analysis/ManagementV2.cd", "cd4analysis/ManagementV1.cd", + true, false), Arguments.of(validationDir, "cd4analysis/MyExampleV2.cd", + "cd4analysis/MyExampleV1.cd", true, false), Arguments.of(validationDir, + "cd4analysis/MyExampleV1.cd", "cd4analysis/MyExampleV2.cd", true, false)); } - + @ParameterizedTest @MethodSource("emptyWitnesses") public void testEmptyWitnesses(String baseDir, String srcPath, String tgtPath, boolean staDiff, boolean reduction) { dir = baseDir; parseModels(srcPath, tgtPath); - + if (reduction) { ReductionTrafo trafo = new ReductionTrafo(); trafo.transform(src, tgt); + System.out.println(CD4CodeMill.prettyPrint(src, false)); } - + Syn2SemDiff syn2semdiff = new Syn2SemDiff(src, tgt); List witnesses = syn2semdiff.generateODs(staDiff); - - System.out.println("size is: " + witnesses.size()); - for (ASTODArtifact od : witnesses) { - System.out.println(new OD2CDMatcher().checkIfDiffWitness(STA_CLOSED_WORLD, src, tgt, od)); - if (!new OD2CDMatcher().checkIfDiffWitness(STA_CLOSED_WORLD, src, tgt, od)) { - System.out.println(new OD4ReportFullPrettyPrinter(new IndentPrinter()).prettyprint(od)); - Assertions.fail(); - } - } - + + System.out.println("size is: " + witnesses.size()); + for (ASTODArtifact od : witnesses) { + System.out.println(new OD2CDMatcher().checkIfDiffWitness(STA_CLOSED_WORLD, src, tgt, od)); + System.out.println(new OD4ReportFullPrettyPrinter(new IndentPrinter()).prettyprint(od)); + } + assertTrue(witnesses.isEmpty()); } - + public static Stream witnesses() { return Stream.of(Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", SIMPLE_CLOSED_WORLD, true), Arguments.of( @@ -177,28 +170,28 @@ public static Stream witnesses() { STA_CLOSED_WORLD, true), Arguments.of(validationDir, "cd4analysis/MyCompanyV2.cd", "cd4analysis/MyCompanyV1.cd", STA_CLOSED_WORLD, false)); } - + @ParameterizedTest @MethodSource("witnesses") public void testWitnesses(String baseDir, String srcPath, String tgtPath, CDSemantics semantics, boolean reduction) { dir = baseDir; parseModels(srcPath, tgtPath); - + if (reduction) { ReductionTrafo trafo = new ReductionTrafo(); trafo.transform(src, tgt); } - + Syn2SemDiff syn2semdiff = new Syn2SemDiff(src, tgt); List witnesses = syn2semdiff.generateODs(semantics.equals(STA_CLOSED_WORLD) || semantics.equals(STA_OPEN_WORLD)); - + assertFalse(witnesses.isEmpty()); - + checkDiffWitnesses(semantics, src, tgt, witnesses); } - + public static Stream witnessesReduction() { return Stream.of(Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd"), Arguments.of(validationDir, "Performance/5A.cd", "Performance/5B.cd"), Arguments.of( @@ -223,32 +216,32 @@ public static Stream witnessesReduction() { "Employees/Employees8.cd"), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd")); } - + @ParameterizedTest @MethodSource("witnessesReduction") public void testWitnessesReduction(String baseDir, String srcPath, String tgtPath) { dir = baseDir; parseModels(srcPath, tgtPath); - + ASTCDCompilationUnit srcOriginal = src.deepClone(); ASTCDCompilationUnit tgtOriginal = tgt.deepClone(); - + // reduction-based ReductionTrafo trafo = new ReductionTrafo(); trafo.transform(src, tgt); - + Syn2SemDiff syn2semdiff = new Syn2SemDiff(src, tgt); List witnesses = syn2semdiff.generateODs(true); - + Assertions.assertFalse(witnesses.isEmpty()); - + checkDiffWitnesses(CDSemantics.STA_CLOSED_WORLD, src, tgt, witnesses); - + CD4CodeMill.scopesGenitorDelegator().createFromAST(srcOriginal); CD4CodeMill.scopesGenitorDelegator().createFromAST(tgtOriginal); checkDiffWitnesses(CDSemantics.STA_OPEN_WORLD, srcOriginal, tgtOriginal, witnesses); } - + protected void checkDiffWitnesses(CDSemantics semantics, ASTCDCompilationUnit cd1, ASTCDCompilationUnit cd2, Collection witnesses) { System.out.println(new CD4AnalysisFullPrettyPrinter(new IndentPrinter()).prettyprint(cd1)); @@ -261,5 +254,5 @@ protected void checkDiffWitnesses(CDSemantics semantics, ASTCDCompilationUnit cd } } } - + } From 520d1821dace1bbcda79684168933a7045f51183 Mon Sep 17 00:00:00 2001 From: Presiyan Date: Sun, 28 Sep 2025 20:16:33 +0200 Subject: [PATCH 16/17] Fix before Max --- .../syn2semdiff/helpers/ODGenHelper.java | 12 +- .../cddiff/syn2semdiff/odgen/ODBuilder.java | 11 +- .../syn2semdiff/odgen/Syn2SemDiffHelper.java | 117 +++++++++++------- .../cddiff/syndiff/CDSyntaxDiff.java | 18 ++- .../cddiff/syndiff/Syn2SemDiffTest.java | 1 - 5 files changed, 91 insertions(+), 68 deletions(-) diff --git a/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/helpers/ODGenHelper.java b/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/helpers/ODGenHelper.java index e1ccc7872..276429b7f 100644 --- a/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/helpers/ODGenHelper.java +++ b/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/helpers/ODGenHelper.java @@ -46,8 +46,7 @@ public ODGenHelper(ASTCDCompilationUnit srcCD, Syn2SemDiffHelper syn2SemDiffHelp * @return List of types as Strings. */ public List getSuperTypes(ASTCDClass astcdClass) { - List typeList = new ArrayList<>(CDDiffUtil.getAllSuperTypes(astcdClass, srcCD - .getCDDefinition())); + List typeList = new ArrayList<>(CDDiffUtil.getAllSuperTypes(astcdClass)); List typesString = new ArrayList<>(); for (int i = typeList.size() - 1; i >= 0; i--) { String type = typeList.get(i).getSymbol().getInternalQualifiedName(); @@ -105,7 +104,7 @@ public static ASTCDClass getCDClass(ASTCDCompilationUnit compilationUnit, String public int getClassSize(ASTCDClass astcdClass) { int attributeCount = syn2SemDiffHelper.getAllAttr(astcdClass).b.size(); int associationCount = syn2SemDiffHelper.getAssociationCount(astcdClass, true); - int otherAssocsCount = syn2SemDiffHelper.getOtherAssocs(astcdClass, true, false).size(); + int otherAssocsCount = syn2SemDiffHelper.getOtherAssocs(astcdClass, true, false, false).size(); return attributeCount + associationCount + otherAssocsCount; } @@ -216,10 +215,9 @@ else if (subAssoc.getSide().equals(ClassSide.Right) && superAssoc.getSide().equa public List getTgtAssocs(ASTCDClass astcdClass) { List assocStructs = new ArrayList<>(); - Set superClassSet = CDDiffUtil.getAllSuperclasses(astcdClass, srcCD - .getCDDefinition().getCDClassesList()); - for (ASTCDClass superClass : superClassSet) { - assocStructs.addAll(syn2SemDiffHelper.getOtherAssocs(superClass, true, false)); + Set superClassSet = CDDiffUtil.getAllSuperTypes(astcdClass); + for (ASTCDType superClass : superClassSet) { + assocStructs.addAll(syn2SemDiffHelper.getOtherAssocs(superClass, true, false, false)); } List copy = new ArrayList<>(assocStructs); for (AssocStruct assocStruct : copy) { diff --git a/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/odgen/ODBuilder.java b/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/odgen/ODBuilder.java index 5aa9de343..287e388cd 100644 --- a/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/odgen/ODBuilder.java +++ b/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/odgen/ODBuilder.java @@ -2,6 +2,7 @@ package de.monticore.cddiff.syn2semdiff.odgen; import de.monticore.cddiff.syn2semdiff.datastructures.AssocDirection; +import de.monticore.expressions.expressionsbasis.ExpressionsBasisMill; import de.monticore.od4report.OD4ReportMill; import de.monticore.odbasis.ODBasisMill; import de.monticore.odbasis._ast.ASTODAttribute; @@ -13,6 +14,7 @@ import de.monticore.odlink._ast.ASTODLinkBuilder; import de.monticore.odlink._ast.ASTODLinkLeftSideBuilder; import de.monticore.odlink._ast.ASTODLinkRightSideBuilder; +import de.monticore.umlmodifier._ast.ASTModifier; import de.se_rwth.commons.logging.Log; import java.util.*; @@ -79,10 +81,13 @@ public ASTODObject buildObj(String id, String type, Collection types, objectBuilder.setName(id); - objectBuilder.setModifier(OD4ReportMill.modifierBuilder().setStereotype(OD4ReportMill + ASTModifier modifier = OD4ReportMill.modifierBuilder().setStereotype(OD4ReportMill .stereotypeBuilder().addValues(OD4ReportMill.stereoValueBuilder().setName("instanceof") - .setContent(String.join(", ", types)).setText(OD4ReportMill.stringLiteralBuilder() - .setSource(String.join(", ", types)).build()).build()).build()).build()); + .setExpression(ExpressionsBasisMill.literalExpressionBuilder().setLiteral(OD4ReportMill + .stringLiteralBuilder().setSource(String.join(", ", types)).build()).build()) + .build()).build()).build(); + + objectBuilder.setModifier(modifier); objectBuilder.setMCObjectType(ODBasisMill.mCQualifiedTypeBuilder().setMCQualifiedName( ODBasisMill.mCQualifiedNameBuilder().setPartsList(Collections.singletonList(type)).build()) diff --git a/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/odgen/Syn2SemDiffHelper.java b/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/odgen/Syn2SemDiffHelper.java index c7019dc3f..1cda05004 100644 --- a/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/odgen/Syn2SemDiffHelper.java +++ b/cddiff/src/main/java/de/monticore/cddiff/syn2semdiff/odgen/Syn2SemDiffHelper.java @@ -236,7 +236,7 @@ public boolean isSubclassWithSuper(ASTCDType superClass, ASTCDType subClass) { * @return list of associations */ public List getOtherAssocs(ASTCDType astcdClass, boolean isSource, - boolean makeConditionStrict) { + boolean makeConditionStrict, boolean allowBiDirectional) { List list = new ArrayList<>(); ArrayListMultimap map = isSource ? srcMap : tgtMap; @@ -247,17 +247,18 @@ public List getOtherAssocs(ASTCDType astcdClass, boolean isSource, connectedTypes = Syn2SemDiffHelper.getConnectedTypes(assocStruct.getAssociation(), isSource ? srcCD : tgtCD); - if (assocStruct.getSide().equals(ClassSide.Left) && !assocStruct.getDirection().equals( - AssocDirection.BiDirectional) && (makeConditionStrict || assocStruct.getAssociation() - .getLeft().getCDCardinality().isOne() || assocStruct.getAssociation().getLeft() - .getCDCardinality().isAtLeastOne()) && connectedTypes.b == astcdClass) { + if (assocStruct.getSide().equals(ClassSide.Left) && (allowBiDirectional || !assocStruct + .getDirection().equals(AssocDirection.BiDirectional)) && (makeConditionStrict + || assocStruct.getAssociation().getLeft().getCDCardinality().isOne() + || assocStruct.getAssociation().getLeft().getCDCardinality().isAtLeastOne()) + && connectedTypes.b == astcdClass) { list.add(assocStruct.deepClone()); } - else if (assocStruct.getSide().equals(ClassSide.Right) && !assocStruct.getDirection() - .equals(AssocDirection.BiDirectional) && (makeConditionStrict || assocStruct - .getAssociation().getRight().getCDCardinality().isOne() || assocStruct - .getAssociation().getRight().getCDCardinality().isAtLeastOne()) - && connectedTypes.a == astcdClass) { + else if (assocStruct.getSide().equals(ClassSide.Right) && (allowBiDirectional + || !assocStruct.getDirection().equals(AssocDirection.BiDirectional)) + && (makeConditionStrict || assocStruct.getAssociation().getRight().getCDCardinality() + .isOne() || assocStruct.getAssociation().getRight().getCDCardinality() + .isAtLeastOne()) && connectedTypes.a == astcdClass) { list.add(assocStruct.deepClone()); } } @@ -276,11 +277,21 @@ else if (assocStruct.getSide().equals(ClassSide.Right) && !assocStruct.getDirect */ public List getAllOtherAssocs(ASTCDType astcdClass, boolean isSource) { List list = new ArrayList<>(); - Set superTypes = CDDiffUtil.getAllSuperTypes(astcdClass, isSource ? srcCD - .getCDDefinition() : tgtCD.getCDDefinition()); + Set superTypes = CDDiffUtil.getAllSuperTypes(astcdClass); for (ASTCDType astcdClass1 : superTypes) { - list.addAll(getOtherAssocs(astcdClass1, isSource, false)); + list.addAll(getOtherAssocs(astcdClass1, isSource, false, false)); + } + + return list; + } + + public List getAllOtherAssocsWithBiDir(ASTCDType astcdClass, boolean isSource) { + List list = new ArrayList<>(); + Set superTypes = CDDiffUtil.getAllSuperTypes(astcdClass); + + for (ASTCDType astcdClass1 : superTypes) { + list.addAll(getOtherAssocs(astcdClass1, isSource, false, true)); } return list; @@ -288,11 +299,10 @@ public List getAllOtherAssocs(ASTCDType astcdClass, boolean isSourc public List getAllOtherAssocsSpecCase(ASTCDType astcdClass, boolean isSource) { List list = new ArrayList<>(); - Set superTypes = CDDiffUtil.getAllSuperTypes(astcdClass, isSource ? srcCD - .getCDDefinition() : tgtCD.getCDDefinition()); + Set superTypes = CDDiffUtil.getAllSuperTypes(astcdClass); for (ASTCDType astcdClass1 : superTypes) { - list.addAll(getOtherAssocs(astcdClass1, isSource, true)); + list.addAll(getOtherAssocs(astcdClass1, isSource, true, false)); } return list; @@ -652,7 +662,7 @@ public Optional allSubClassesAreTgtSrcTgt(AssocStruct matchedAssocStr for (ASTCDType subClass : subClassesTgt) { boolean contained = false; for (AssocStruct assocStruct : getAllOtherAssocs(subClass, false)) { - if (sameAssociationTypeSrcTgt(matchedAssocStruc, assocStruct)) { + if (sameAssociationTypeSrcTgt(matchedAssocStruc, assocStruct, true)) { contained = true; break; } @@ -684,13 +694,13 @@ public Optional allSubClassesHaveIt(AssocStruct association, ASTCDTyp for (AssocStruct assocStruct : assocList) { if (isSource) { - if (sameAssociationTypeSrcTgt(assocStruct, association)) { + if (sameAssociationTypeSrcTgt(assocStruct, association, true)) { isContained = true; break; } } else { - if (sameAssociationTypeSrcTgt(association, assocStruct)) { + if (sameAssociationTypeSrcTgt(association, assocStruct, true)) { isContained = true; break; } @@ -718,7 +728,7 @@ public Optional allSubClassesAreTargetTgtSrc(AssocStruct tgtAssoc, AS for (ASTCDType subClass : subClassesSrc) { boolean contained = false; for (AssocStruct assocStruct : getAllOtherAssocs(subClass, true)) { - if (sameAssociationTypeSrcTgt(assocStruct, tgtAssoc)) { + if (sameAssociationTypeSrcTgt(assocStruct, tgtAssoc, true)) { contained = true; break; } @@ -778,7 +788,7 @@ public boolean classHasAssociationSrcSrc(AssocStruct association, ASTCDType srcT */ public boolean classHasAssociationTgtSrc(AssocStruct tgtStruct, ASTCDType srcType) { for (AssocStruct assocStruct1 : srcMap.get(srcType)) { - if (sameAssociationTypeSrcTgt(assocStruct1, tgtStruct)) { + if (sameAssociationTypeSrcTgt(assocStruct1, tgtStruct, true)) { return true; } } @@ -803,7 +813,7 @@ public boolean classHasAssociationTgtSrcRev(AssocStruct tgtStruct, ASTCDType src */ public boolean classHasAssociationSrcTgt(AssocStruct assocStruct, ASTCDType tgtType) { for (AssocStruct assocStruct1 : tgtMap.get(tgtType)) { - if (sameAssociationTypeSrcTgt(assocStruct, assocStruct1)) { + if (sameAssociationTypeSrcTgt(assocStruct, assocStruct1, false)) { return true; } } @@ -835,7 +845,7 @@ public boolean classIsTarget(AssocStruct association, ASTCDType srcType) { */ public boolean classIsTgtSrcTgt(AssocStruct association, ASTCDType tgtType) { for (AssocStruct assocStruct : getAllOtherAssocsSpecCase(tgtType, false)) { - if (sameAssociationTypeSrcTgt(association, assocStruct)) { + if (sameAssociationTypeSrcTgt(association, assocStruct, true)) { return true; } } @@ -850,8 +860,8 @@ public boolean classIsTgtSrcTgt(AssocStruct association, ASTCDType tgtType) { * @return true, if an association has the same association type. */ public boolean classIsTargetTgtSrc(AssocStruct association, ASTCDType srcType) { - for (AssocStruct assocStruct : getAllOtherAssocs(srcType, true)) { - if (sameAssociationTypeSrcTgt(assocStruct, association)) { + for (AssocStruct assocStruct : getAllOtherAssocsWithBiDir(srcType, true)) { + if (sameAssociationTypeSrcTgt(assocStruct, association, true)) { return true; } } @@ -859,7 +869,7 @@ public boolean classIsTargetTgtSrc(AssocStruct association, ASTCDType srcType) { } public boolean classIsTargetTgtSrcRev(AssocStruct association, ASTCDType srcType) { - for (AssocStruct assocStruct : getAllOtherAssocs(srcType, true)) { + for (AssocStruct assocStruct : getAllOtherAssocsWithBiDir(srcType, true)) { if (sameAssociationTypeSrcTgtRev(assocStruct, association)) { return true; } @@ -1051,9 +1061,13 @@ private boolean compareAssociations(AssocStruct superAssoc, AssocStruct subAssoc * * @param srcAssocSub association from srcCD. * @param tgtAssocSuper association from tgtCD. + * @param srcCardContainedInSuper should the cardinalities of the source association be contained + * in the ones of the + * subassociation or the other way around * @return true, if the condition is fulfilled. */ - public boolean sameAssociationTypeSrcTgt(AssocStruct srcAssocSub, AssocStruct tgtAssocSuper) { + public boolean sameAssociationTypeSrcTgt(AssocStruct srcAssocSub, AssocStruct tgtAssocSuper, + boolean srcCardContainedInSuper) { boolean isLeftLeft = srcAssocSub.getSide().equals(ClassSide.Left) && tgtAssocSuper.getSide() .equals(ClassSide.Left); boolean isLeftRight = srcAssocSub.getSide().equals(ClassSide.Left) && tgtAssocSuper.getSide() @@ -1063,6 +1077,10 @@ public boolean sameAssociationTypeSrcTgt(AssocStruct srcAssocSub, AssocStruct tg boolean isRightLeft = srcAssocSub.getSide().equals(ClassSide.Right) && tgtAssocSuper.getSide() .equals(ClassSide.Left); + AssocStruct structWithSubCardinalities = srcCardContainedInSuper ? srcAssocSub : tgtAssocSuper; + AssocStruct structWithSuperCardinalities = srcCardContainedInSuper ? tgtAssocSuper + : srcAssocSub; + if (isLeftLeft || isRightRight) { return matchRoleNames(srcAssocSub.getAssociation().getLeft(), tgtAssocSuper.getAssociation() .getLeft()) && matchRoleNames(srcAssocSub.getAssociation().getRight(), tgtAssocSuper @@ -1072,13 +1090,16 @@ public boolean sameAssociationTypeSrcTgt(AssocStruct srcAssocSub, AssocStruct tg tgtCD).a, true) && compareTypes(getConnectedTypes(srcAssocSub .getAssociation(), srcCD).b, getConnectedTypes(tgtAssocSuper .getAssociation(), tgtCD).b, true) && isContainedIn(cardToEnum( - tgtAssocSuper.getAssociation().getLeft().getCDCardinality()), - cardToEnum(srcAssocSub.getAssociation().getLeft() - .getCDCardinality())) && isContainedIn(cardToEnum( - tgtAssocSuper.getAssociation().getRight() - .getCDCardinality()), cardToEnum(srcAssocSub - .getAssociation().getRight() - .getCDCardinality())); + structWithSubCardinalities.getAssociation().getLeft() + .getCDCardinality()), cardToEnum( + structWithSuperCardinalities.getAssociation() + .getLeft().getCDCardinality())) && isContainedIn( + cardToEnum(structWithSubCardinalities + .getAssociation().getRight() + .getCDCardinality()), cardToEnum( + structWithSuperCardinalities + .getAssociation().getRight() + .getCDCardinality())); } else if (isLeftRight || isRightLeft) { return matchRoleNames(srcAssocSub.getAssociation().getLeft(), tgtAssocSuper.getAssociation() @@ -1089,13 +1110,16 @@ else if (isLeftRight || isRightLeft) { tgtCD).b, true) && compareTypes(getConnectedTypes(srcAssocSub .getAssociation(), srcCD).b, getConnectedTypes(tgtAssocSuper .getAssociation(), tgtCD).a, true) && isContainedIn(cardToEnum( - tgtAssocSuper.getAssociation().getLeft().getCDCardinality()), - cardToEnum(srcAssocSub.getAssociation().getRight() - .getCDCardinality())) && isContainedIn(cardToEnum( - tgtAssocSuper.getAssociation().getRight() - .getCDCardinality()), cardToEnum(srcAssocSub - .getAssociation().getLeft() - .getCDCardinality())); + structWithSubCardinalities.getAssociation().getLeft() + .getCDCardinality()), cardToEnum( + structWithSuperCardinalities.getAssociation() + .getRight().getCDCardinality())) && isContainedIn( + cardToEnum(structWithSubCardinalities + .getAssociation().getRight() + .getCDCardinality()), cardToEnum( + structWithSuperCardinalities + .getAssociation().getLeft() + .getCDCardinality())); } return false; @@ -1347,8 +1371,7 @@ private AssocDirection determineAssocDirection(ASTCDAssociation assoc, ClassSide private void inheritAssociations(ASTCDCompilationUnit compilationUnit, boolean isSource) { List types = getTypes(compilationUnit); for (ASTCDType astcdClass : types) { - Set superTypes = CDDiffUtil.getAllSuperTypes(astcdClass, compilationUnit - .getCDDefinition()); + Set superTypes = CDDiffUtil.getAllSuperTypes(astcdClass); superTypes.remove(astcdClass); for (ASTCDType superClass : superTypes) { @@ -1969,8 +1992,8 @@ public Optional getAssocStructByUnmod(ASTCDType astcdType, */ public boolean hasDiffSuper(ASTCDType astcdType) { Optional oldType = findMatchedTypeTgt(astcdType); - Set oldTypes = CDDiffUtil.getAllSuperTypes(oldType.get(), tgtCD.getCDDefinition()); - Set newTypes = CDDiffUtil.getAllSuperTypes(astcdType, srcCD.getCDDefinition()); + Set oldTypes = CDDiffUtil.getAllSuperTypes(oldType.get()); + Set newTypes = CDDiffUtil.getAllSuperTypes(astcdType); for (ASTCDType class1 : oldTypes) { boolean foundMatch = false; for (ASTCDType type2 : newTypes) { @@ -2148,7 +2171,7 @@ public List> srcAssocsExist(List asso } boolean foundMatch = false; for (AssocStruct assocStructTgt : tgtMap.get(tgtType)) { - if (sameAssociationTypeSrcTgt(assocStruct, assocStructTgt)) { // the given pair is a match + if (sameAssociationTypeSrcTgt(assocStruct, assocStructTgt, true)) { // the given pair is a match foundMatch = true; break; } @@ -2211,7 +2234,7 @@ public List> tgtAssocsExist(List asso for (AssocStruct assocStruct : assocStructs) { boolean foundMatch = false; for (AssocStruct assocStructSrc : srcMap.get(srcType)) { // 1:1 as srcAssocsExist - if (sameAssociationTypeSrcTgt(assocStructSrc, assocStruct)) { + if (sameAssociationTypeSrcTgt(assocStructSrc, assocStruct, true)) { foundMatch = true; break; } diff --git a/cddiff/src/main/java/de/monticore/cddiff/syndiff/CDSyntaxDiff.java b/cddiff/src/main/java/de/monticore/cddiff/syndiff/CDSyntaxDiff.java index 07fd37af4..89103dbda 100644 --- a/cddiff/src/main/java/de/monticore/cddiff/syndiff/CDSyntaxDiff.java +++ b/cddiff/src/main/java/de/monticore/cddiff/syndiff/CDSyntaxDiff.java @@ -272,11 +272,10 @@ public ASTCDClass isSupClass(ASTCDClass astcdClass) { for (ASTCDClass classToCheck : classesToCheck) { for (ASTCDAttribute attribute : attributes) { if (!helper.isAttContainedInClass(attribute, classToCheck)) { - Set classes = CDDiffUtil.getAllSuperclasses(classToCheck, helper.getSrcCD() - .getCDDefinition().getCDClassesList()); + Set classes = CDDiffUtil.getAllSuperTypes(classToCheck); classes.remove(astcdClass); boolean isContained = false; - for (ASTCDClass superOfSub : classes) { + for (ASTCDType superOfSub : classes) { if (helper.isAttContainedInClass(attribute, superOfSub)) { isContained = true; break; @@ -350,7 +349,7 @@ public boolean isInheritanceDeleted(ASTCDType superClassTgt, ASTCDType subClassS for (AssocStruct tgtStruct : helper.getTgtMap().get(superClassTgt)) { if (!areZeroAssocs(tgtStruct, tgtStruct)) { for (AssocStruct srcAssoc : helper.getSrcMap().get(subClassSrc)) { - if (helper.sameAssociationTypeSrcTgt(srcAssoc, tgtStruct)) { + if (helper.sameAssociationTypeSrcTgt(srcAssoc, tgtStruct, true)) { isContained = true; } } @@ -365,7 +364,7 @@ public boolean isInheritanceDeleted(ASTCDType superClassTgt, ASTCDType subClassS for (AssocStruct otherStruct : helper.getAllOtherAssocs(superClassTgt, false)) { boolean isContained1 = false; for (AssocStruct srcStruct : helper.getAllOtherAssocs(subClassSrc, true)) { - if (helper.sameAssociationTypeSrcTgt(srcStruct, otherStruct)) { + if (helper.sameAssociationTypeSrcTgt(srcStruct, otherStruct, true)) { isContained1 = true; } } @@ -465,7 +464,7 @@ public boolean isInheritanceAdded(ASTCDType astcdClass, ASTCDType subClass) { for (AssocStruct newAssocs : helper.getSrcMap().get(astcdClass)) { for (AssocStruct srcStruct : helper.getTgtMap().get(helper.findMatchedTypeTgt(subClass) .get())) { - if (helper.sameAssociationTypeSrcTgt(newAssocs, srcStruct)) { + if (helper.sameAssociationTypeSrcTgt(newAssocs, srcStruct, true)) { isContained = true; break; } @@ -481,7 +480,7 @@ public boolean isInheritanceAdded(ASTCDType astcdClass, ASTCDType subClass) { boolean isContained1 = false; for (AssocStruct oldAssocs : helper.getAllOtherAssocs(helper.findMatchedTypeTgt(subClass) .get(), false)) { - if (helper.sameAssociationTypeSrcTgt(newAssocs, oldAssocs)) { + if (helper.sameAssociationTypeSrcTgt(newAssocs, oldAssocs, true)) { isContained1 = true; } } @@ -544,9 +543,8 @@ else if (!helper.getNotInstClassesTgt().contains(right) && sub.isPresent() && !h Optional sub = helper.allSubClassesHaveIt(assocStruct.get(), astcdClass, true); if (!astcdClass.getModifier().isAbstract() && matched.isPresent() && !helper .getNotInstClassesTgt().contains(astcdClass) && !helper.getNotInstClassesSrc() - .contains(matched.get()) && !(helper.classHasAssociationTgtSrc(assocStruct.get(), - matched.get()) || helper.classIsTargetTgtSrcRev(assocStruct.get(), matched - .get()))) { + .contains(matched.get()) && !helper.classHasAssociationTgtSrc(assocStruct.get(), + matched.get())) { isDeletedSrc = matched.get(); } else if (!helper.getNotInstClassesTgt().contains(astcdClass) && sub.isPresent() && !helper diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java index 8ac3f145d..201655608 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java @@ -246,7 +246,6 @@ protected void checkDiffWitnesses(CDSemantics semantics, ASTCDCompilationUnit cd ASTCDCompilationUnit cd2, Collection witnesses) { System.out.println(new CD4AnalysisFullPrettyPrinter(new IndentPrinter()).prettyprint(cd1)); System.out.println(new CD4AnalysisFullPrettyPrinter(new IndentPrinter()).prettyprint(cd2)); - //System.out.println(witnesses.size()); for (ASTODArtifact od : witnesses) { if (!new OD2CDMatcher().checkIfDiffWitness(semantics, cd1, cd2, od)) { System.out.println(new OD4ReportFullPrettyPrinter(new IndentPrinter()).prettyprint(od)); From eff2f36332e2cdfef701a8d9fb425699916d9ed0 Mon Sep 17 00:00:00 2001 From: Presiyan Date: Mon, 29 Sep 2025 13:36:19 +0200 Subject: [PATCH 17/17] Fix --- .../cddiff/syndiff/CDSyntaxDiff.java | 10 ++- .../cddiff/syndiff/Syn2SemDiffTest.java | 79 +++++++++---------- 2 files changed, 44 insertions(+), 45 deletions(-) diff --git a/cddiff/src/main/java/de/monticore/cddiff/syndiff/CDSyntaxDiff.java b/cddiff/src/main/java/de/monticore/cddiff/syndiff/CDSyntaxDiff.java index 89103dbda..0ae4e7d55 100644 --- a/cddiff/src/main/java/de/monticore/cddiff/syndiff/CDSyntaxDiff.java +++ b/cddiff/src/main/java/de/monticore/cddiff/syndiff/CDSyntaxDiff.java @@ -723,7 +723,10 @@ else if (helper.sameAssocStruct(association, superAssoc) || helper.sameAssocStru helper.deleteAssocsFromSubSrc(pair.getSuperAssoc(), getConnectedTypes(pair.getSuperAssoc() .getAssociation(), srcCD).a); } - helper.getSrcMap().remove(pair.getAstcdClass(), pair.getSuperAssoc()); + // Check if the association that we merged into the other one comes from a superclass - if that is the case, it gets removed from the subclass + if (pair.getSuperAssoc().isSuperAssoc()) { + helper.getSrcMap().remove(pair.getAstcdClass(), pair.getSuperAssoc()); + } } for (Pair pair : srcAssocsToDelete) { helper.deleteAssocsFromSrc(pair.a, pair.b); @@ -752,7 +755,10 @@ else if (helper.sameAssocStruct(association, superAssoc) || helper.sameAssocStru helper.deleteAssocFromSubTgt(pair.getSuperAssoc(), getConnectedTypes(pair.getSuperAssoc() .getAssociation(), tgtCD).a); } - helper.getTgtMap().remove(pair.getAstcdClass(), pair.getSuperAssoc()); + // Check if the association that we merged into the other one comes from a superclass - if that is the case, it gets removed from the subclass + if (pair.getSuperAssoc().isSuperAssoc()) { + helper.getTgtMap().remove(pair.getAstcdClass(), pair.getSuperAssoc()); + } } for (Pair pair : tgtAssocsToDelete) { helper.deleteAssocsFromTgt(pair.a, pair.b); diff --git a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java index 201655608..76ab97699 100644 --- a/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java +++ b/cddiff/src/test/java/de/monticore/cddiff/syndiff/Syn2SemDiffTest.java @@ -35,45 +35,40 @@ public class Syn2SemDiffTest extends SynDiffTestBasis { public static Stream emptyWitnesses() { return Stream.of(Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", false, false), Arguments.of(cddiffDir, - "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", - "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, false), Arguments.of(cddiffDir, - "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", - "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, false), Arguments.of(cddiffDir, - "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", - "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", false, false), Arguments.of( - cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", - "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, true), Arguments.of( - cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", - "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, true), Arguments.of( - cddiffDir, "syndiff/TypeDiff/ChangedAttribute/CD71.cd", - "syndiff/TypeDiff/ChangedAttribute/CD71.cd", false, false), - Arguments.of(cddiffDir, "syndiff/TypeDiff/ChangedAttribute/CD71.cd", - "syndiff/TypeDiff/ChangedAttribute/CD71.cd", false, true), Arguments.of(cddiffDir, - "syndiff/TypeDiff/RemovedAttributeNoDiff/CD21.cd", - "syndiff/TypeDiff/RemovedAttributeNoDiff/CD22.cd", false, false), Arguments.of( - cddiffDir, "syndiff/SyntaxDiff/MaCoCo_v2.cd", "syndiff/SyntaxDiff/MaCoCo_v1.cd", - false, false), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", - "DigitalTwins/DigitalTwin3.cd", false, false), Arguments.of(cddiffDir, - "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", false, - false), Arguments.of(cddiffDir, "Employees/Employees2.cd", - "Employees/Employees1.cd", true, true), Arguments.of(cddiffDir, - "Employees/Employees2.cd", "Employees/Employees1.cd", false, - true), Arguments.of(cddiffDir, "Employees/Employees8.cd", - "Employees/Employees7.cd", true, true), Arguments.of( - validationDir, "cddiff/LibraryV3.cd", - "cddiff/LibraryV2.cd", true, true), Arguments.of( - validationDir, "cddiff/LibraryV5.cd", - "cddiff/LibraryV4.cd", true, true), Arguments.of( - validationDir, "cd4analysis/ManagementV2.cd", - "cd4analysis/ManagementV1.cd", true, true), - Arguments.of(validationDir, "cd4analysis/MyCompanyV2.cd", "cd4analysis/MyCompanyV1.cd", - true, true), Arguments.of(validationDir, "cd4analysis/MyExampleV2.cd", - "cd4analysis/MyExampleV1.cd", true, true), Arguments.of(validationDir, - "cd4analysis/MyExampleV1.cd", "cd4analysis/MyExampleV2.cd", true, true), + "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", + "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, false), Arguments.of(cddiffDir, + "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", + "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", false, false), Arguments.of(cddiffDir, + "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", + "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", false, true), Arguments.of( + cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD11.cd", + "syndiff/SyntaxDiff/MoveAttributes/CD12.cd", false, true), Arguments.of( + cddiffDir, "syndiff/TypeDiff/ChangedAttribute/CD71.cd", + "syndiff/TypeDiff/ChangedAttribute/CD71.cd", false, false), Arguments + .of(cddiffDir, "syndiff/TypeDiff/ChangedAttribute/CD71.cd", + "syndiff/TypeDiff/ChangedAttribute/CD71.cd", false, true), + Arguments.of(cddiffDir, "syndiff/TypeDiff/RemovedAttributeNoDiff/CD21.cd", + "syndiff/TypeDiff/RemovedAttributeNoDiff/CD22.cd", false, false), Arguments.of( + cddiffDir, "syndiff/SyntaxDiff/MaCoCo_v2.cd", "syndiff/SyntaxDiff/MaCoCo_v1.cd", + false, false), Arguments.of(cddiffDir, "DigitalTwins/DigitalTwin2.cd", + "DigitalTwins/DigitalTwin3.cd", false, false), Arguments.of(cddiffDir, + "DigitalTwins/DigitalTwin3.cd", "DigitalTwins/DigitalTwin2.cd", false, + false), Arguments.of(cddiffDir, "Employees/Employees2.cd", + "Employees/Employees1.cd", true, true), Arguments.of(cddiffDir, + "Employees/Employees2.cd", "Employees/Employees1.cd", false, true), + Arguments.of(cddiffDir, "Employees/Employees8.cd", "Employees/Employees7.cd", true, true), + Arguments.of(validationDir, "cddiff/LibraryV3.cd", "cddiff/LibraryV2.cd", true, true), + Arguments.of(validationDir, "cddiff/LibraryV5.cd", "cddiff/LibraryV4.cd", true, true), Arguments.of(validationDir, "cd4analysis/ManagementV2.cd", "cd4analysis/ManagementV1.cd", - true, false), Arguments.of(validationDir, "cd4analysis/MyExampleV2.cd", - "cd4analysis/MyExampleV1.cd", true, false), Arguments.of(validationDir, - "cd4analysis/MyExampleV1.cd", "cd4analysis/MyExampleV2.cd", true, false)); + true, true), Arguments.of(validationDir, "cd4analysis/MyCompanyV2.cd", + "cd4analysis/MyCompanyV1.cd", true, true), Arguments.of(validationDir, + "cd4analysis/MyExampleV2.cd", "cd4analysis/MyExampleV1.cd", true, true), + Arguments.of(validationDir, "cd4analysis/MyExampleV1.cd", "cd4analysis/MyExampleV2.cd", + true, true), Arguments.of(validationDir, "cd4analysis/ManagementV2.cd", + "cd4analysis/ManagementV1.cd", true, false), Arguments.of(validationDir, + "cd4analysis/MyExampleV2.cd", "cd4analysis/MyExampleV1.cd", true, false), + Arguments.of(validationDir, "cd4analysis/MyExampleV1.cd", "cd4analysis/MyExampleV2.cd", + true, false)); } @ParameterizedTest @@ -102,11 +97,9 @@ public void testEmptyWitnesses(String baseDir, String srcPath, String tgtPath, b } public static Stream witnesses() { - return Stream.of(Arguments.of(cddiffDir, "syndiff/AssocDiff/AssocDeletedMerging/CD51.cd", - "syndiff/AssocDiff/AssocDeletedMerging/CD52.cd", SIMPLE_CLOSED_WORLD, true), Arguments.of( - validationDir, "cddiff/LibraryV5.cd", "cddiff/LibraryV4.cd", STA_CLOSED_WORLD, false), - Arguments.of(cddiffDir, "Employees/Employees1.cd", "Employees/Employees2.cd", - SIMPLE_CLOSED_WORLD, true), Arguments.of(cddiffDir, + return Stream.of(Arguments.of(validationDir, "cddiff/LibraryV5.cd", "cddiff/LibraryV4.cd", + STA_CLOSED_WORLD, false), Arguments.of(cddiffDir, "Employees/Employees1.cd", + "Employees/Employees2.cd", SIMPLE_CLOSED_WORLD, true), Arguments.of(cddiffDir, "syndiff/SyntaxDiff/AddedDeletedAssocs/CD31.cd", "syndiff/SyntaxDiff/AddedDeletedAssocs/CD32.cd", SIMPLE_CLOSED_WORLD, false), Arguments.of(cddiffDir, "syndiff/SyntaxDiff/MoveAttributes/CD12.cd",