Skip to content

Commit

Permalink
Fixed #1191
Browse files Browse the repository at this point in the history
Add methods to handle declared type dependencies.
  • Loading branch information
sofeess committed Oct 18, 2024
1 parent dfca33e commit 28ad1fc
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 5 deletions.
8 changes: 8 additions & 0 deletions src/MooseIDE-Dependency/FamixTClass.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Extension { #name : #FamixTClass }

{ #category : #'*MooseIDE-Dependency' }
FamixTClass >> addDeclaredTypesIn: dependencies [

self children do: [ :c | c addDeclaredTypesIn: dependencies ].

]
8 changes: 8 additions & 0 deletions src/MooseIDE-Dependency/FamixTMethod.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Extension { #name : #FamixTMethod }

{ #category : #'*MooseIDE-Dependency' }
FamixTMethod >> addDeclaredTypesIn: dependencies [

self children do: [ :c | c addDeclaredTypesIn: dependencies ].
self declaredType ifNotNil: [ dependencies add: self declaredType ]
]
7 changes: 7 additions & 0 deletions src/MooseIDE-Dependency/FamixTPackage.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : #FamixTPackage }

{ #category : #'*MooseIDE-Dependency' }
FamixTPackage >> addDeclaredTypesIn: dependencies [

self children do: [ :c | c addDeclaredTypesIn: dependencies ].
]
7 changes: 7 additions & 0 deletions src/MooseIDE-Dependency/FamixTTypedEntity.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : #FamixTTypedEntity }

{ #category : #'*MooseIDE-Dependency' }
FamixTTypedEntity >> addDeclaredTypesIn: dependencies [

self declaredType ifNotNil: [dependencies add: self declaredType. "1haltIf: [ dependencies anySatisfy: [:e | e isLocalVariable] ]".]
]
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,23 @@ 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 ]
tuple key model queryAllOutgoingForDSM count: [ :dependency || opposites |
dependency isAssociation ifTrue: [
"Association so need to get the target because DSM is done between entities"
opposites := dependency target.
opposites isCollection
ifTrue: [ opposites anySatisfy: [ :each | (each atScope: tuple value model class) includes: tuple value model] ]
"The ifNotNil is to avoid the null dependency problem coming from the model due to generic types"
ifFalse: [ opposites
ifNotNil: [ (opposites atScope: tuple value model class) includes: tuple value model ]
ifNil: [false]]
]
ifFalse: [
"Case of declaredType"
dependency isStub ifTrue: [ false ] ifFalse: [ (dependency atScope: tuple value model class) includes: tuple value model ]
]
]

]
]

Expand Down
15 changes: 15 additions & 0 deletions src/MooseIDE-Dependency/TEntityMetaLevelDependency.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ TEntityMetaLevelDependency >> miTreeExtension [
beResizable
]

{ #category : #'*MooseIDE-Dependency' }
TEntityMetaLevelDependency >> queryAllOutgoingForDSM [
"Query all the outgoing associations of the receiver and its children.
Example:
aFAMIXClass queryAllOutgoing.
--> Will return a MooseOutgoingQueryResult containing the FAMIXAssociation having aFAMIXClass or its children as source
"

| dependencies |
dependencies := self queryAllOutgoing.
self addDeclaredTypesIn: dependencies.
^ dependencies
]

{ #category : #'*MooseIDE-Dependency' }
TEntityMetaLevelDependency >> rootsForTreeMap [

Expand Down

0 comments on commit 28ad1fc

Please sign in to comment.