From a27840f3c0c02d417a171eb67d11bd0847262b15 Mon Sep 17 00:00:00 2001 From: Niklas Rentz Date: Fri, 6 Oct 2023 15:49:19 +0200 Subject: [PATCH] fixed removing category connections from overviews, as they need the non-unique category connections --- .../spviz/spviz/generator/DataAccess.xtend | 16 ++++++++++++---- .../spviz/spviz/generator/GenerateActions.xtend | 4 ++-- .../spviz/generator/GenerateSubSyntheses.xtend | 4 ++-- .../spviz/generator/GenerateSyntheses.xtend | 10 +++++----- .../spviz/generator/GenerateVizModelUtils.xtend | 6 +++--- .../spviz/spviz/generator/SPVizGenerator.xtend | 2 +- 6 files changed, 25 insertions(+), 17 deletions(-) diff --git a/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/DataAccess.xtend b/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/DataAccess.xtend index 84f136a..2df7030 100644 --- a/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/DataAccess.xtend +++ b/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/DataAccess.xtend @@ -64,12 +64,18 @@ class DataAccess { /** All connections displayable in this SPViz. */ @Accessors(PUBLIC_GETTER) List connections + /** + * All category connections displayable in this SPViz. Equal category connections with different containing + * overviews are all contained. + */ + @Accessors(PUBLIC_GETTER) + List categoryConnections /** * All unique category connections displayable in this SPViz. Equal category connections with different containing * overviews are only included once. */ @Accessors(PUBLIC_GETTER) - List categoryConnections + List uniqueCategoryConnections /** A convenient map to show all {@link ArtifactView}s that may be shown within the key {@link Artifact}. */ Map> containedViews /** @@ -105,6 +111,7 @@ class DataAccess { artifactsShowing = newHashMap connections = newArrayList categoryConnections = newArrayList + uniqueCategoryConnections = newArrayList categorizedConnections = newHashMap for (view : spviz.views) { @@ -135,8 +142,9 @@ class DataAccess { } for (categoryConnection : view.shownCategoryConnections) { val catConnectionView = categoryConnection.innerView - if (!categoryConnections.exists[equals(it, categoryConnection)]) { - categoryConnections.add(categoryConnection) + categoryConnections.add(categoryConnection) + if (!uniqueCategoryConnections.exists[equals(it, categoryConnection)]) { + uniqueCategoryConnections.add(categoryConnection) if (!categorizedConnections.containsKey(catConnectionView)) { categorizedConnections.put(catConnectionView, newArrayList) } @@ -367,7 +375,7 @@ class DataAccess { } def List categoryConnectionsFor(Connection connection) { - return categoryConnections.filter[it.connection === connection].toList + return uniqueCategoryConnections.filter[it.connection === connection].toList } /** diff --git a/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/GenerateActions.xtend b/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/GenerateActions.xtend index 2720d68..0e8fd79 100644 --- a/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/GenerateActions.xtend +++ b/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/GenerateActions.xtend @@ -857,7 +857,7 @@ class GenerateActions { ««« BundleConnectsBundleNamedDependencyContainer import «data.bundleNamePrefix».model.«connection.connecting.name.toFirstUpper»Connects«connection.connected.name.toFirstUpper»Named«connection.name.toFirstUpper»Container «ENDFOR» - «FOR categoryConnection : data.categoryConnections» + «FOR categoryConnection : data.getUniqueCategoryConnections» import «data.bundleNamePrefix».model.«categoryConnection.connectingCategory.name.toFirstUpper»CategoryConnects«categoryConnection.connectedCategory.name.toFirstUpper»Via«(categoryConnection.connection.connecting).name.toFirstUpper»Dot«categoryConnection.connection.name.toFirstUpper»Container «ENDFOR» @@ -912,7 +912,7 @@ class GenerateActions { «ENDFOR» «ENDIF» «IF data.categoryConnectingArtifacts.contains(artifact)» - «FOR categoryConnection : data.categoryConnections.filter[it.sourceChain.target === artifact]» + «FOR categoryConnection : data.getUniqueCategoryConnections.filter[it.sourceChain.target === artifact]» // Connect all container connections of the «categoryConnection.connectedCategory.name.toFirstLower»'s «categoryConnection.connectingArtifact.name.toFirstLower»'s and «categoryConnection.connectedArtifact.name.toFirstLower»'s «categoryConnection.connection.name.toFirstLower»s. // Only try to connect using this connection type if the parent overview context supports it. if (ovc instanceof «categoryConnection.connectingCategory.name.toFirstUpper»CategoryConnects«categoryConnection.connectedCategory.name.toFirstUpper»Via«(categoryConnection.connection.connecting).name.toFirstUpper»Dot«categoryConnection.connection.name.toFirstUpper»Container && childContext.«categoryConnection.innerView.name.toFirstLower»OverviewContext !== null) { diff --git a/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/GenerateSubSyntheses.xtend b/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/GenerateSubSyntheses.xtend index d184478..a5c2cd9 100644 --- a/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/GenerateSubSyntheses.xtend +++ b/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/GenerateSubSyntheses.xtend @@ -66,7 +66,7 @@ class GenerateSubSyntheses { // the category connections defined in this view val innerCategoryConnections = view.shownCategoryConnections // the category connections connecting connections from this view - val List outerCategoryConnections = data.categoryConnections.filter[it.innerView === view].toList + val List outerCategoryConnections = data.getUniqueCategoryConnections.filter[it.innerView === view].toList val Set categories = outerCategoryConnections.map[it.connectedCategory].toSet return ''' package «data.getBundleNamePrefix».viz.subsyntheses @@ -674,7 +674,7 @@ class GenerateSubSyntheses { importedArtifacts.add(connecting.connecting.name) } // The connections for which this artifact is the category. - val categories = data.categoryConnections.filter[artifact === it.sourceChain.source] + val categories = data.getUniqueCategoryConnections.filter[artifact === it.sourceChain.source] return ''' package «data.getBundleNamePrefix».viz.subsyntheses diff --git a/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/GenerateSyntheses.xtend b/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/GenerateSyntheses.xtend index 4f23f06..9430d4e 100644 --- a/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/GenerateSyntheses.xtend +++ b/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/GenerateSyntheses.xtend @@ -1163,7 +1163,7 @@ class GenerateSyntheses { «ENDFOR» - «FOR categoryConnection : data.categoryConnections» + «FOR categoryConnection : data.getUniqueCategoryConnections» /** * Adds the rendering for a category edge showing a «categoryConnection.connectedCategory.name.toFirstLower» connection via their «categoryConnection.connectingArtifact.name.toFirstLower» to «categoryConnection.connectedArtifact.name.toFirstLower» «categoryConnection.connection.name.toFirstLower». */ @@ -1195,7 +1195,7 @@ class GenerateSyntheses { val Set categoryArtifacts = newHashSet val Set categoryViews = newHashSet - for (categoryConnection : data.categoryConnections) { + for (categoryConnection : data.getUniqueCategoryConnections) { categoryArtifacts.add(categoryConnection.connectedArtifact) categoryArtifacts.add(categoryConnection.connectingArtifact) categoryArtifacts.add(categoryConnection.connectedCategory) @@ -1232,7 +1232,7 @@ class GenerateSyntheses { «FOR view : categoryViews» import «data.bundleNamePrefix».model.«view.name.toFirstUpper»OverviewContext «ENDFOR» - «FOR categoryConnection : data.categoryConnections» + «FOR categoryConnection : data.getUniqueCategoryConnections» import «data.bundleNamePrefix».model.«categoryConnection.connectingCategory.name.toFirstUpper»CategoryConnects«categoryConnection.connectedCategory.name.toFirstUpper»Via«(categoryConnection.connection.connecting).name.toFirstUpper»Dot«categoryConnection.connection.name.toFirstUpper»Container «ENDFOR» @@ -1340,7 +1340,7 @@ class GenerateSyntheses { } } - «FOR categoryConnection : data.categoryConnections» + «FOR categoryConnection : data.getUniqueCategoryConnections» /** * For a category connection between «categoryConnection.connectedCategory.name.toFirstLower» based on their «categoryConnection.connectingArtifact.name.toFirstLower»->«categoryConnection.connectedArtifact.name.toFirstLower» «categoryConnection.connection.name.toFirstLower» in «(categoryConnection.connection.connecting).name.toFirstLower»Dot«categoryConnection.connection.name.toFirstUpper» and given a such «categoryConnection.connectedCategory.name.toFirstLower» category container and a «categoryConnection.connectedCategory.name.toFirstLower», * returns all «categoryConnection.connectedCategory.name.toFirstLower» that are connected to the given «categoryConnection.connectedCategory.name.toFirstLower» in the container. @@ -1471,7 +1471,7 @@ class GenerateSyntheses { } } - «FOR categoryConnection : data.categoryConnections» + «FOR categoryConnection : data.getUniqueCategoryConnections» /** * Helper method to find find all «categoryConnection.connectingArtifact.name.toFirstLower» to «categoryConnection.connectedArtifact.name.toFirstLower» connections with equal source «categoryConnection.connectingArtifact.name.toFirstLower» and target «categoryConnection.connectedCategory.name.toFirstLower». Writes the index of * each first occurrence of a duplicate into the {@code firstDuplicateIndices} list and all indices of other diff --git a/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/GenerateVizModelUtils.xtend b/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/GenerateVizModelUtils.xtend index 29b5472..fd95b28 100644 --- a/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/GenerateVizModelUtils.xtend +++ b/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/GenerateVizModelUtils.xtend @@ -164,7 +164,7 @@ class GenerateVizModelUtils { «FOR connection : data.connections» import «data.getBundleNamePrefix».model.«connection.connecting.name»Connects«connection.connected.name»Named«connection.name»Container «ENDFOR» - «FOR categoryConnection : data.categoryConnections» + «FOR categoryConnection : data.getUniqueCategoryConnections» import «data.getBundleNamePrefix».model.«categoryConnection.connectingCategory.name.toFirstUpper»CategoryConnects«categoryConnection.connectedCategory.name.toFirstUpper»Via«(categoryConnection.connection.connecting).name.toFirstUpper»Dot«categoryConnection.connection.name.toFirstUpper»Container «ENDFOR» import «data.modelBundleNamePrefix».model.«data.projectName» @@ -450,7 +450,7 @@ class GenerateVizModelUtils { } } «ENDFOR» - «FOR categoryConnection : data.categoryConnections.filter[ it.connectedCategory === shownElement.shownElement && it.eContainer === view ].toSet» + «FOR categoryConnection : data.getCategoryConnections.filter[ it.connectedCategory === shownElement.shownElement && it.eContainer === view ].toSet» overviewContext.«categoryConnection.connectingCategory.name.toFirstLower»CategoryConnects«categoryConnection.connectedCategory.name.toFirstUpper»Via«(categoryConnection.connection.connecting).name.toFirstUpper»Dot«categoryConnection.connection.name.toFirstUpper»Edges.removeIf[ «categoryConnection.connectedCategory.name.toFirstLower»Edge | «categoryConnection.connectedCategory.name.toFirstLower»Edge.key === context || «categoryConnection.connectedCategory.name.toFirstLower»Edge.value === context ] @@ -723,7 +723,7 @@ class GenerateVizModelUtils { «ENDFOR» - «FOR categoryConnection : data.categoryConnections» + «FOR categoryConnection : data.getUniqueCategoryConnections» /** * Adds a container connection edge to the parent overview context of the two given contexts. * The direction of the edge indicates that the «categoryConnection.connectingArtifact.name.toFirstLower» of the {@code connecting«categoryConnection.connectingArtifact.name.toFirstUpper»Context} connects the «categoryConnection.connectedArtifact.name.toFirstLower» of the diff --git a/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/SPVizGenerator.xtend b/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/SPVizGenerator.xtend index 261ddad..60ec39b 100644 --- a/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/SPVizGenerator.xtend +++ b/plugins/de.cau.cs.kieler.spviz.spviz/src/de/cau/cs/kieler/spviz/spviz/generator/SPVizGenerator.xtend @@ -461,7 +461,7 @@ class SPVizGenerator extends AbstractGenerator { } «ENDFOR» - «FOR categoryConnection : data.categoryConnections» + «FOR categoryConnection : data.getUniqueCategoryConnections» class «categoryConnection.connectingCategory.name.toFirstUpper»CategoryConnects«categoryConnection.connectedCategory.name.toFirstUpper»Via«(categoryConnection.connection.connecting).name.toFirstUpper»Dot«categoryConnection.connection.name.toFirstUpper»Container extends IOverviewVisualizationContext { // For the category connection between «categoryConnection.connectingCategory.name.toFirstLower»s to connect via their «categoryConnection.connection.name.toFirstLower»s, define some relations for // pre-calculating which connected «categoryConnection.connectedArtifact.name.toFirstLower»s, connecting «categoryConnection.connectingArtifact.name.toFirstLower»s, and which «categoryConnection.connectedCategory.name.toFirstLower»s are connected in this way.