Skip to content

Commit

Permalink
fixed removing category connections from overviews, as they need the
Browse files Browse the repository at this point in the history
non-unique category connections
  • Loading branch information
NiklasRentzCAU committed Jan 18, 2024
1 parent 5c64c14 commit a27840f
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,18 @@ class DataAccess {
/** All connections displayable in this SPViz. */
@Accessors(PUBLIC_GETTER)
List<Connection> connections
/**
* All category connections displayable in this SPViz. Equal category connections with different containing
* overviews are all contained.
*/
@Accessors(PUBLIC_GETTER)
List<ShownCategoryConnection> categoryConnections
/**
* All unique category connections displayable in this SPViz. Equal category connections with different containing
* overviews are only included once.
*/
@Accessors(PUBLIC_GETTER)
List<ShownCategoryConnection> categoryConnections
List<ShownCategoryConnection> uniqueCategoryConnections
/** A convenient map to show all {@link ArtifactView}s that may be shown within the key {@link Artifact}. */
Map<Artifact, List<ArtifactView>> containedViews
/**
Expand Down Expand Up @@ -105,6 +111,7 @@ class DataAccess {
artifactsShowing = newHashMap
connections = newArrayList
categoryConnections = newArrayList
uniqueCategoryConnections = newArrayList
categorizedConnections = newHashMap

for (view : spviz.views) {
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -367,7 +375,7 @@ class DataAccess {
}

def List<ShownCategoryConnection> categoryConnectionsFor(Connection connection) {
return categoryConnections.filter[it.connection === connection].toList
return uniqueCategoryConnections.filter[it.connection === connection].toList
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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»

Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ShownCategoryConnection> outerCategoryConnections = data.categoryConnections.filter[it.innerView === view].toList
val List<ShownCategoryConnection> outerCategoryConnections = data.getUniqueCategoryConnections.filter[it.innerView === view].toList
val Set<Artifact> categories = outerCategoryConnections.map[it.connectedCategory].toSet
return '''
package «data.getBundleNamePrefix».viz.subsyntheses
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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».
*/
Expand Down Expand Up @@ -1195,7 +1195,7 @@ class GenerateSyntheses {
val Set<Artifact> categoryArtifacts = newHashSet
val Set<View> categoryViews = newHashSet

for (categoryConnection : data.categoryConnections) {
for (categoryConnection : data.getUniqueCategoryConnections) {
categoryArtifacts.add(categoryConnection.connectedArtifact)
categoryArtifacts.add(categoryConnection.connectingArtifact)
categoryArtifacts.add(categoryConnection.connectedCategory)
Expand Down Expand Up @@ -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»
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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»
Expand Down Expand Up @@ -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
]
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object> {
// 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.
Expand Down

0 comments on commit a27840f

Please sign in to comment.