From 8f8138705016100ccd16112d18fa8d3bfb007d22 Mon Sep 17 00:00:00 2001 From: ClotildeToullec Date: Fri, 26 Jan 2024 16:05:28 +0100 Subject: [PATCH 1/2] Remove old Class blueprint from FamixTType --- .../FamixTType.extension.st | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/Famix-Visualizations/FamixTType.extension.st b/src/Famix-Visualizations/FamixTType.extension.st index c2a1bd97..2ddd29c0 100644 --- a/src/Famix-Visualizations/FamixTType.extension.st +++ b/src/Famix-Visualizations/FamixTType.extension.st @@ -1,24 +1,5 @@ Extension { #name : #FamixTType } -{ #category : #'*Famix-Visualizations' } -FamixTType >> accessorMethods [ - - ^ self methods select: #isPureAccessor -] - -{ #category : #'*Famix-Visualizations' } -FamixTType >> blueprint [ - - ^ FamixTypeBlueprint forType: self -] - -{ #category : #'*Famix-Visualizations' } -FamixTType >> inspectorShowBlueprint [ - - - ^ self blueprint asInspectorPresenter -] - { #category : #'*Famix-Visualizations' } FamixTType >> uml [ From 25b5d0f8d0d7b93d5b4410de901407f9cabfabaf Mon Sep 17 00:00:00 2001 From: ClotildeToullec Date: Fri, 26 Jan 2024 16:09:42 +0100 Subject: [PATCH 2/2] Remove the old FamixTypeBlueprint and FamixTypeGroupBlueprintComplexity --- .../FamixTypeBlueprint.class.st | 208 ------------------ .../FamixTypeGroup.extension.st | 5 - ...FamixTypeGroupBlueprintComplexity.class.st | 109 --------- 3 files changed, 322 deletions(-) delete mode 100644 src/Famix-Visualizations/FamixTypeBlueprint.class.st delete mode 100644 src/Famix-Visualizations/FamixTypeGroupBlueprintComplexity.class.st diff --git a/src/Famix-Visualizations/FamixTypeBlueprint.class.st b/src/Famix-Visualizations/FamixTypeBlueprint.class.st deleted file mode 100644 index 3c494494..00000000 --- a/src/Famix-Visualizations/FamixTypeBlueprint.class.st +++ /dev/null @@ -1,208 +0,0 @@ -" -I show the blueprint of a FamixTType. - -The visualization shows 5 layers: - - initialization methods - - public methods - - private methods - - accessors - - attributes - -Edges represent variable accesses and method invocations. -" -Class { - #name : #FamixTypeBlueprint, - #superclass : #MooseAbstractVisualization, - #instVars : [ - 'famixType' - ], - #category : #'Famix-Visualizations-Core' -} - -{ #category : #adding } -FamixTypeBlueprint class >> defaultTitle [ - ^ 'Blueprint' -] - -{ #category : #public } -FamixTypeBlueprint class >> forType: aFamixType [ - ^ self new - famixType: aFamixType; - yourself -] - -{ #category : #adding } -FamixTypeBlueprint class >> icon [ - ^ MooseIcons mooseBlueprint -] - -{ #category : #building } -FamixTypeBlueprint >> build [ - self buildLayers. - self buildEdges. - self nestLayers. - super build -] - -{ #category : #building } -FamixTypeBlueprint >> buildEdges [ - | builder edges | - "Accesses" - builder := self edgeBuilder - color: Color lightBlue; - yourself. - edges := famixType queryIncomingAccesses - flatCollect: [ :access | builder connectFrom: access source to: access target ]. - edges do: #pushBack. - - "Invocations" - builder color: (Color r: 0 g: 0 b: 0.8 alpha: 0.6 ). - edges := (famixType queryOutgoing: FamixTInvocation) - flatCollect: [ :acc | builder connectFrom: acc source toAll: acc candidates ]. - edges do: #pushBack -] - -{ #category : #building } -FamixTypeBlueprint >> buildLayerNamed: label withEntities: aGroup [ - | layer | - layer := RSComposite new borderColor: Color gray translucent. - layer - addAll: (aGroup collect: [ :entity | entity shapeInBlueprint: self ]). - layer popupText: label. - self canvas add: layer -] - -{ #category : #building } -FamixTypeBlueprint >> buildLayers [ - self layersEntities - keysAndValuesDo: - [ :title :entities | self buildLayerNamed: title withEntities: entities ] -] - -{ #category : #building } -FamixTypeBlueprint >> buildLegend [ - | legend | - legend := RSLegend new. - legend container: self canvas. - legend onDemand. - legend title: self class defaultTitle. - legend text: 'From left to right:'. - legend - text: - ' Constructors, Public methods, Private methods, Accessors, Attributes'. - legend - text: 'Variable access' - withShape: - (RSBox new - extent: 15 @ 5; - color: Color lightBlue). - legend - text: 'Method invocation' - withShape: - (RSBox new - extent: 15 @ 5; - color: (Color r: 0 g: 0 b: 0.8 alpha: 0.6 )). - legend text: 'Setter' withBoxColor: Color red. - legend text: 'Getter' withBoxColor: Color orange. - legend text: 'Abstract' withBoxColor: Color cyan. - legend text: 'Overriding' withBoxColor: Color brown. - legend text: 'Constant' withBoxColor: Color gray. - legend build -] - -{ #category : #shapes } -FamixTypeBlueprint >> colorForMethod: aMethod [ - aMethod isPureAccessor - ifTrue: [ ^ Color orange ]. - aMethod isSetter - ifTrue: [ ^ Color red ]. - aMethod isGetter - ifTrue: [ ^ Color orange ]. - (aMethod isAbstract isNotNil and: [ aMethod isAbstract ]) - ifTrue: [ ^ Color cyan ]. - aMethod isOverriding - ifTrue: [ ^ Color brown ]. - aMethod isConstant - ifTrue: [ ^ Color gray ]. - ^ Color white -] - -{ #category : #shapes } -FamixTypeBlueprint >> edgeBuilder [ - ^ RSEdgeBuilder line - shapes: (self canvas nodes flatCollect: #children); - withHorizontalAttachPoint; - yourself -] - -{ #category : #accessing } -FamixTypeBlueprint >> famixType: aFamixType [ - famixType := aFamixType -] - -{ #category : #building } -FamixTypeBlueprint >> layersEntities [ - ^ {('Initializers' - -> (famixType methods select: [ :method | method isInitializer ])). - ('Interface methods' - -> - (famixType methods - select: [ :each | - each isInternalImplementation not & each isInitializer not - & each isPureAccessor not ])). - ('Implementation methods' - -> - (famixType methods - select: [ :method | method isInternalImplementation ])). - ('Accessors' - -> (famixType methods select: [ :method | method isPureAccessor ])). - ('Attributes' -> famixType attributes)} asOrderedDictionary -] - -{ #category : #building } -FamixTypeBlueprint >> nestLayers [ - | layers maxHeight | - layers := self canvas nodes. - RSHorizontalTreeLayout new - on: (layers flatCollect: #nodes) - edges: self canvas edges. - layers do: [ :layer | layer padding: 10 ]. - maxHeight := layers max: [ :layer | layer height ]. - layers do: [ :layer | layer height: maxHeight ]. - RSHorizontalLineLayout new - gapSize: 0; - on: layers -] - -{ #category : #shapes } -FamixTypeBlueprint >> shapeForAttribute: anAttribute [ - | shape | - shape := RSBox new - model: anAttribute; - borderColor: Color lightGray; - color: Color blue; - popup; - yourself. - shape @ RSDraggable. - ^ shape -] - -{ #category : #shapes } -FamixTypeBlueprint >> shapeForMethod: aMethod [ - | shape | - shape := RSBox new - model: aMethod; - color: (self colorForMethod: aMethod); - borderColor: Color lightGray; - width: (aMethod numberOfOutgoingInvocations max: 5); - height: (aMethod numberOfLinesOfCode max: 5); - popup; - yourself. - shape @ RSDraggable. - ^ shape -] - -{ #category : #accessing } -FamixTypeBlueprint >> windowTitle [ - ^ famixType name , ' blueprint' -] diff --git a/src/Famix-Visualizations/FamixTypeGroup.extension.st b/src/Famix-Visualizations/FamixTypeGroup.extension.st index a13b1fc2..a03387c8 100644 --- a/src/Famix-Visualizations/FamixTypeGroup.extension.st +++ b/src/Famix-Visualizations/FamixTypeGroup.extension.st @@ -1,10 +1,5 @@ Extension { #name : #FamixTypeGroup } -{ #category : #'*Famix-Visualizations' } -FamixTypeGroup >> blueprintComplexity [ - ^ FamixTypeGroupBlueprintComplexity forTypeGroup: self -] - { #category : #'*Famix-Visualizations' } FamixTypeGroup >> inspectorShowComplexity [ diff --git a/src/Famix-Visualizations/FamixTypeGroupBlueprintComplexity.class.st b/src/Famix-Visualizations/FamixTypeGroupBlueprintComplexity.class.st deleted file mode 100644 index 1274deba..00000000 --- a/src/Famix-Visualizations/FamixTypeGroupBlueprintComplexity.class.st +++ /dev/null @@ -1,109 +0,0 @@ -" -I show TypeBlueprints for each type in a FamixTypeGroup. - -Edges between blueprints represent hierarchy -" -Class { - #name : #FamixTypeGroupBlueprintComplexity, - #superclass : #MooseAbstractVisualization, - #instVars : [ - 'famixTypeGroup' - ], - #category : #'Famix-Visualizations-Core' -} - -{ #category : #accessing } -FamixTypeGroupBlueprintComplexity class >> defaultTitle [ - ^ 'Blueprint complexity' -] - -{ #category : #public } -FamixTypeGroupBlueprintComplexity class >> forTypeGroup: aFamixTypeGroup [ - ^ self new - famixTypeGroup: aFamixTypeGroup; - yourself -] - -{ #category : #accessing } -FamixTypeGroupBlueprintComplexity class >> icon [ - ^ MooseIcons mooseBlueprint -] - -{ #category : #shapes } -FamixTypeGroupBlueprintComplexity >> blueprintOfType: type [ - | singleBlueprint | - singleBlueprint := (type blueprint - build; - yourself) canvas asShape - model: type; - @ RSDraggable; - yourself. - - "The following is a hack: after copying shapes from singleBlueprint, shapes are unaware of their connected edges." - singleBlueprint edges - do: [ :edge | - edge from addConnectedEdge: edge. - edge to addConnectedEdge: edge ]. - - ^ singleBlueprint -] - -{ #category : #building } -FamixTypeGroupBlueprintComplexity >> build [ - self buildSingleTypeBlueprints. - self connectSingleBlueprints. - RSTreeLayout new on: canvas nodes edges: canvas edges. - super build -] - -{ #category : #building } -FamixTypeGroupBlueprintComplexity >> buildLegend [ - | legend | - legend := RSLegend new. - legend container: self canvas. - legend onDemand. - legend title: self class defaultTitle. - legend text: 'Each class is composed of 5 parts, from left to right:'. - legend - text: - ' Constructors, Public methods, Private methods, Accessors, Variables'. - legend - text: 'Variable access' - withShape: - (RSBox new - extent: 15 @ 5; - color: Color lightBlue). - legend - text: 'Method invocation' - withShape: - (RSBox new - extent: 15 @ 5; - color: Color lightMagenta). - legend text: 'Setter' withBoxColor: Color red. - legend text: 'Getter' withBoxColor: Color orange. - legend text: 'Abstract' withBoxColor: Color cyan. - legend text: 'Overriding' withBoxColor: Color brown. - legend text: 'Constant' withBoxColor: Color gray. - legend build -] - -{ #category : #building } -FamixTypeGroupBlueprintComplexity >> buildSingleTypeBlueprints [ - canvas - addAll: (famixTypeGroup collect: [ :type | self blueprintOfType: type ]) -] - -{ #category : #building } -FamixTypeGroupBlueprintComplexity >> connectSingleBlueprints [ - RSEdgeBuilder line - shapes: canvas nodes; - color: Color veryLightGray; - withVerticalAttachPoint; - connectTo: [ :class | class superclass ]. - canvas pushBackEdges -] - -{ #category : #accessing } -FamixTypeGroupBlueprintComplexity >> famixTypeGroup: aFamixTypeGroup [ - famixTypeGroup := aFamixTypeGroup -]