Skip to content

Commit

Permalink
Merge pull request #770 from moosetechnology/speedup-source-target
Browse files Browse the repository at this point in the history
Speed up #source and #target on associations
  • Loading branch information
jecisc authored May 14, 2024
2 parents 1572a77 + 9774679 commit 449e884
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 12 deletions.
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

0 comments on commit 449e884

Please sign in to comment.