Skip to content

Commit

Permalink
Merge pull request #1164 from moosetechnology/new-DSM
Browse files Browse the repository at this point in the history
New DSM with weights
  • Loading branch information
sofeess authored Sep 19, 2024
2 parents 8f56c11 + c3e13f6 commit 7179138
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Controls:
- command+click to use the last tag.
- Mouse left to drag
- Arrrow keys to move the visualization around
- Arrow keys to move the visualization around
- Scrolls bars to change the view's position
- M to collapse or expand the window
- I to zoom in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,21 @@ MiDependencyStructuralMatrixBrowserModel >> followEntity: aCollection [
browser buildDSM
]

{ #category : #api }
MiDependencyStructuralMatrixBrowserModel >> getTupleDependencyWeight: tuple [

^(tuple key = tuple value)
ifTrue: [ ^0 ]
ifFalse: [
tuple key model queryAllOutgoing count: [ :dependency || opposites |
opposites := dependency target.
opposites isCollection
ifTrue: [ opposites anySatisfy: [ :each | (each atScope: tuple value model class) includes: tuple value model] ]
ifFalse: [(opposites atScope: tuple value model class) includes: tuple value model ]
]
]
]

{ #category : #initialization }
MiDependencyStructuralMatrixBrowserModel >> initialize [
super initialize.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ MiDependencyStructuralMatrixVisualization >> cellShowSCCColor: tuple [
^viewModel showSCCColorForTuple: tuple
]

{ #category : #accessing }
MiDependencyStructuralMatrixVisualization >> getTupleDependencyWeight: tuple [
^ viewModel getTupleDependencyWeight: tuple
]

{ #category : #initialization }
MiDependencyStructuralMatrixVisualization >> initialize [

Expand All @@ -59,12 +64,11 @@ MiDependencyStructuralMatrixVisualization >> initialize [

{ #category : #private }
MiDependencyStructuralMatrixVisualization >> sccShapesIncluding: aRSShape [
"Transcript
show: ' ';
show: (aRSShape model key model name) ;
show: ' -> ';
show: (aRSShape model value model name)."

"Returns all shapes involved in the same cycle as aRSShape.
lastSCCShapes is an optimization cache.
if aRSShape is part of the lastSSCShapes, do nothing. Otherwise, get all shapes of the tuples involved in a cycle with aRSShape model."

(lastSCCShapes key = aRSShape model key) ifFalse: [
"Transcript show: ' - NOT found' ; cr."
lastSCCShapes := aRSShape model key -> (aRSShape canvas deepShapesFromModels:
Expand Down
28 changes: 28 additions & 0 deletions src/MooseIDE-Dependency/MiRSDSMShape.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"
This is a modified version of the `RSComposite` to accomodate our new DSM
"
Class {
#name : #MiRSDSMShape,
#superclass : #RSComposite,
#category : #'MooseIDE-Dependency-DSM'
}

{ #category : #accessing }
MiRSDSMShape >> color: aColor [
self children first color: aColor
]

{ #category : #initialization }
MiRSDSMShape >> initialize [
super initialize.

self add: (RSBox new size: 15).
self add: (RSLabel new fontSize: 5).
self adjustToChildren

]

{ #category : #accessing }
MiRSDSMShape >> text: aString [
self children second text: aString
]
18 changes: 18 additions & 0 deletions src/MooseIDE-Dependency/MiRSDependencyStructuralMatrix.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@ Class {
#category : #'MooseIDE-Dependency-DSM'
}

{ #category : #hooks }
MiRSDependencyStructuralMatrix >> createShape: tuple [
"1halt."
| weight |
weight := self getTupleDependencyWeight: tuple.

^ MiRSDSMShape new
text: (weight = 0 ifTrue: [''] ifFalse: [ weight asString]);
model: tuple;
color: (self color cull: tuple);
yourself
]

{ #category : #accessing }
MiRSDependencyStructuralMatrix >> getTupleDependencyWeight: tuple [
^ owner getTupleDependencyWeight: tuple
]

{ #category : #highlighting }
MiRSDependencyStructuralMatrix >> highlight: evt [
super highlight: evt.
Expand Down

0 comments on commit 7179138

Please sign in to comment.