Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up #source and #target on associations #770

Merged
merged 2 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/Famix-Traits/FamixTAssociation.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,6 @@ FamixTAssociation >> source: aSource [
self perform: (self sourceSelector , ':') with: aSource
]

{ #category : #accessing }
FamixTAssociation >> sourceSelector [
^ (self mooseDescription allComplexProperties detect: #isSource)
implementingSelector
]

{ #category : #accessing }
FamixTAssociation >> target [
^ self targetSelector value: self
Expand All @@ -161,9 +155,3 @@ FamixTAssociation >> target [
FamixTAssociation >> target: aTarget [
self perform: (self targetSelector , ':') with: aTarget
]

{ #category : #accessing }
FamixTAssociation >> targetSelector [
^ (self mooseDescription allComplexProperties detect: #isTarget)
implementingSelector
]
9 changes: 9 additions & 0 deletions src/Moose-Core/Object.extension.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
Extension { #name : #Object }

{ #category : #'*Moose-Core' }
Object >> allComplexPropertiesIn: aMetamodel [
"All complex properties described in the metamodel.
A complex property is a property whose type is not a primitive."

aMetamodel ifNil: [ ^ OrderedCollection new ].
^ aMetamodel descriptionOf: self class instanceSide ifPresent: #allComplexProperties ifAbsent: [ OrderedCollection new ]
]

{ #category : #'*Moose-Core' }
Object >> allDeclaredPropertiesIn: aMetamodel [
"All properties described in the metamodel"
Expand Down
36 changes: 36 additions & 0 deletions src/Moose-Query/TAssociationMetaLevelDependency.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ TAssociationMetaLevelDependency classSide >> annotation [
^ self
]

{ #category : #accessing }
TAssociationMetaLevelDependency classSide >> privateSourceSelectorIn: aMetamodel [

^ ((self allComplexPropertiesIn: aMetamodel) detect: #isSource) implementingSelector
]

{ #category : #private }
TAssociationMetaLevelDependency classSide >> privateSourceTypesIn: aMetamodel [
"I return the classes that could be my source"
Expand All @@ -26,6 +32,12 @@ TAssociationMetaLevelDependency classSide >> privateSourceTypesIn: aMetamodel [
thenCollect: #implementingType
]

{ #category : #accessing }
TAssociationMetaLevelDependency classSide >> privateTargetSelectorIn: aMetamodel [

^ ((self allComplexPropertiesIn: aMetamodel) detect: #isTarget) implementingSelector
]

{ #category : #private }
TAssociationMetaLevelDependency classSide >> privateTargetTypesIn: aMetamodel [
"I return the classes that could be my target"
Expand All @@ -35,25 +47,49 @@ TAssociationMetaLevelDependency classSide >> privateTargetTypesIn: aMetamodel [
thenCollect: #implementingType
]

{ #category : #accessing }
TAssociationMetaLevelDependency classSide >> sourceSelectorIn: aMetamodel [

^ aMetamodel additionalProperty: #sourceSelector for: self ifAbsentPut: [ self privateSourceSelectorIn: aMetamodel ]
]

{ #category : #accessing }
TAssociationMetaLevelDependency classSide >> sourceTypesIn: aMetamodel [

^ aMetamodel additionalProperty: #sourceTypes for: self ifAbsentPut: [ self privateSourceTypesIn: aMetamodel ]

]

{ #category : #accessing }
TAssociationMetaLevelDependency classSide >> targetSelectorIn: aMetamodel [

^ aMetamodel additionalProperty: #targetSelector for: self ifAbsentPut: [ self privateTargetSelectorIn: aMetamodel ]
]

{ #category : #accessing }
TAssociationMetaLevelDependency classSide >> targetTypesIn: aMetamodel [

^ aMetamodel additionalProperty: #targetTypes for: self ifAbsentPut: [ self privateTargetTypesIn: aMetamodel ]

]

{ #category : #accessing }
TAssociationMetaLevelDependency >> sourceSelector [

^ self class sourceSelectorIn: self metamodel
]

{ #category : #accessing }
TAssociationMetaLevelDependency >> sourceTypes [
^ self class sourceTypesIn: self metamodel
]

{ #category : #accessing }
TAssociationMetaLevelDependency >> targetSelector [

^ self class targetSelectorIn: self metamodel
]

{ #category : #accessing }
TAssociationMetaLevelDependency >> targetTypes [
^ self class targetTypesIn: self metamodel
Expand Down
Loading