Skip to content

Commit

Permalink
Merge branch 'development' into improve-UMLDocumentor-RoassalBackend
Browse files Browse the repository at this point in the history
  • Loading branch information
ClotildeToullec authored Jul 1, 2024
2 parents 00423c8 + d0830d6 commit 3883aab
Show file tree
Hide file tree
Showing 23 changed files with 701 additions and 478 deletions.
80 changes: 40 additions & 40 deletions src/Famix-Java-Generator/FamixJavaGenerator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -134,43 +134,43 @@ FamixJavaGenerator >> defineClasses [

super defineClasses.

access := builder newClassNamed: #Access.
annotationInstance := builder newClassNamed: #AnnotationInstance.
annotationInstanceAttribute := builder newClassNamed: #AnnotationInstanceAttribute.
annotationType := builder newClassNamed: #AnnotationType.
annotationTypeAttribute := builder newClassNamed: #AnnotationTypeAttribute.
attribute := builder newClassNamed: #Attribute.
class := builder newClassNamed: #Class.
interface := builder newClassNamed: #Interface.
access := self newClassNamed: #Access.
annotationInstance := self newClassNamed: #AnnotationInstance.
annotationInstanceAttribute := self newClassNamed: #AnnotationInstanceAttribute.
annotationType := self newClassNamed: #AnnotationType.
annotationTypeAttribute := self newClassNamed: #AnnotationTypeAttribute.
attribute := self newClassNamed: #Attribute.
class := self newClassNamed: #Class.
interface := self newClassNamed: #Interface.
interface withTesting.
implementation := builder newClassNamed: #Implementation.
containerEntity := builder newAbstractClassNamed: #ContainerEntity.
enum := builder newClassNamed: #Enum.
enumValue := builder newClassNamed: #EnumValue.
exception := builder newClassNamed: #Exception.
implicitVariable := builder newClassNamed: #ImplicitVariable.
import := builder newClassNamed: #Import.
indexedFileAnchor := builder newClassNamed: #IndexedFileAnchor.
inheritance := builder newClassNamed: #Inheritance.
invocation := builder newClassNamed: #Invocation.
localVariable := builder newClassNamed: #LocalVariable.
method := builder newClassNamed: #Method.
package := builder newClassNamed: #Package.
parameter := builder newClassNamed: #Parameter.
parameterType := builder newClassNamed: #ParameterType.
primitiveType := builder newClassNamed: #PrimitiveType.
implementation := self newClassNamed: #Implementation.
containerEntity := self newAbstractClassNamed: #ContainerEntity.
enum := self newClassNamed: #Enum.
enumValue := self newClassNamed: #EnumValue.
exception := self newClassNamed: #Exception.
implicitVariable := self newClassNamed: #ImplicitVariable.
import := self newClassNamed: #Import.
indexedFileAnchor := self newClassNamed: #IndexedFileAnchor.
inheritance := self newClassNamed: #Inheritance.
invocation := self newClassNamed: #Invocation.
localVariable := self newClassNamed: #LocalVariable.
method := self newClassNamed: #Method.
package := self newClassNamed: #Package.
parameter := self newClassNamed: #Parameter.
parameterType := self newClassNamed: #ParameterType.
primitiveType := self newClassNamed: #PrimitiveType.
primitiveType withTesting.
reference := builder newClassNamed: #Reference.
type := builder newClassNamed: #Type.
unknownVariable := builder newClassNamed: #UnknownVariable.
reference := self newClassNamed: #Reference.
type := self newClassNamed: #Type.
unknownVariable := self newClassNamed: #UnknownVariable.

parametricClass := builder newClassNamed: #ParametricClass.
parametricMethod := builder newClassNamed: #ParametricMethod.
parametricInterface := builder newClassNamed: #ParametricInterface.
parameterConcretization := builder newClassNamed: #ParameterConcretization.
parametricClass := self newClassNamed: #ParametricClass.
parametricMethod := self newClassNamed: #ParametricMethod.
parametricInterface := self newClassNamed: #ParametricInterface.
parameterConcretization := self newClassNamed: #ParameterConcretization.

concretization := builder newClassNamed: #Concretization.
wildcard := builder newClassNamed: #Wildcard.
concretization := self newClassNamed: #Concretization.
wildcard := self newClassNamed: #Wildcard.
]

{ #category : #definition }
Expand Down Expand Up @@ -392,22 +392,22 @@ FamixJavaGenerator >> defineRelations [
FamixJavaGenerator >> defineTraits [
super defineTraits.

tCanBeVolatile := builder newTraitNamed: #TCanBeVolatile.
tCanBeVolatile := self newTraitNamed: #TCanBeVolatile.
tCanBeVolatile comment: self commentForTCanBeVolatile.

tCanBeTransient := builder newTraitNamed: #TCanBeTransient.
tCanBeTransient := self newTraitNamed: #TCanBeTransient.
tCanBeTransient comment: self commentForTCanBeTransient.

tCanBeSynchronized := builder newTraitNamed: #TCanBeSynchronized.
tCanBeSynchronized := self newTraitNamed: #TCanBeSynchronized.
tCanBeSynchronized comment: self commentForTCanBeSynchronized.

tWithInterfaces := builder newTraitNamed: #TWithInterfaces.
tWithInterfaces := self newTraitNamed: #TWithInterfaces.
tWithInterfaces comment: self commentForTWithInterfaces.

tJavaClassMetrics := builder newTraitNamed: #TClassMetrics.
tJavaClassMetrics := self newTraitNamed: #TClassMetrics.

tBounded := builder newTraitNamed: #TBounded comment: self commentForTBounded.
tBound := builder newTraitNamed: #TBound comment: self commentForTBound.
tBounded := self newTraitNamed: #TBounded comment: self commentForTBounded.
tBound := self newTraitNamed: #TBound comment: self commentForTBound.
]

{ #category : #definition }
Expand Down
36 changes: 36 additions & 0 deletions src/Famix-MetamodelBuilder-Core/FamixMetamodelGenerator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,47 @@ FamixMetamodelGenerator >> mooseModelName [
^ self class mooseModelName
]

{ #category : #definition }
FamixMetamodelGenerator >> newAbstractClassNamed: aClassName [

^ builder newAbstractClassNamed: aClassName
]

{ #category : #definition }
FamixMetamodelGenerator >> newAbstractClassNamed: aClassName comment: aComment [

^ builder newAbstractClassNamed: aClassName comment: aComment
]

{ #category : #definition }
FamixMetamodelGenerator >> newBuilder [
^ FamixMetamodelBuilder forGenerator: self
]

{ #category : #definition }
FamixMetamodelGenerator >> newClassNamed: aClassName [

^ builder newClassNamed: aClassName
]

{ #category : #definition }
FamixMetamodelGenerator >> newClassNamed: aClassName comment: aComment [

^ builder newClassNamed: aClassName comment: aComment
]

{ #category : #definition }
FamixMetamodelGenerator >> newTraitNamed: aTraitName [

^ builder newTraitNamed: aTraitName
]

{ #category : #definition }
FamixMetamodelGenerator >> newTraitNamed: aClassName comment: aString [

^ builder newTraitNamed: aClassName comment: aString
]

{ #category : #definition }
FamixMetamodelGenerator >> packageName [

Expand Down
74 changes: 72 additions & 2 deletions src/Famix-MetamodelBuilder-Core/FmxMBClass.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ Class {
#superclass : #FmxMBBehavior,
#instVars : [
'classGeneralization',
'isAbstractClass'
'isAbstractClass',
'propertiesForEqualityCheck'
],
#category : #'Famix-MetamodelBuilder-Core-Implementation'
}
Expand Down Expand Up @@ -80,7 +81,70 @@ FmxMBClass >> generate [
self generatePrecedenceInTraitComposition: aClass.

self generateNavigationGroupsFor: aClass.
self generateAddToCollectionFor: aClass
self generateAddToCollectionFor: aClass.

self generateEqualsMethodFor: aClass.
self generateHashMethodFor: aClass.
]

{ #category : #'generating-methods' }
FmxMBClass >> generateEqualsMethodFor: aClass [

propertiesForEqualityCheck ifNotNil: [
| variableName |
variableName := 'a' , aClass name.
self builder environment
compile: (String streamContents: [ :stream |
stream << '= '.
stream << variableName.
stream << '
<generated>
^ '.
stream
<< variableName;
<< ' ';
<< propertiesForEqualityCheck first;
<< ' = self ';
<< propertiesForEqualityCheck first.
propertiesForEqualityCheck size > 1 ifTrue: [
2 to: propertiesForEqualityCheck size do: [ :idx |
stream << ' and: [ '.
stream
<< variableName;
<< ' ';
<< (propertiesForEqualityCheck at: idx);
<< ' = self ';
<< (propertiesForEqualityCheck at: idx) ].
2 to: propertiesForEqualityCheck size do: [ :idx |
stream << '] ' ] ] ])
in: aClass instanceSide
classified: #comparing ]
]

{ #category : #'generating-methods' }
FmxMBClass >> generateHashMethodFor: aClass [

propertiesForEqualityCheck ifNotNil: [
self builder environment
compile: (String streamContents: [ :stream |
stream << 'hash'.
stream << '
<generated>
^ '.
stream
<< 'self ';
<< propertiesForEqualityCheck first;
<< ' hash '.
propertiesForEqualityCheck size > 1 ifTrue: [
2 to: propertiesForEqualityCheck size do: [ :idx |
stream
<< 'bitXor: self ';
<< (propertiesForEqualityCheck at: idx);
<< ' hash ' ] ] ])
in: aClass instanceSide
classified: #comparing ]
]

{ #category : #generating }
Expand Down Expand Up @@ -183,3 +247,9 @@ FmxMBClass >> traitsFromRelations [

^ (self relations collect: [ :each | each side trait ] thenSelect: #isNotNil) asSet
]

{ #category : #generalization }
FmxMBClass >> withEqualityCheckOn: aCollectionOfPropertySymbol [

propertiesForEqualityCheck := aCollectionOfPropertySymbol
]
11 changes: 7 additions & 4 deletions src/Famix-PharoSmalltalk-Entities/FamixStAttribute.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,16 @@ FamixStAttribute class >> annotation [
^ self
]

{ #category : #'Famix-Implementation' }
{ #category : #properties }
FamixStAttribute >> beSharedVariable [

self propertyNamed: #sharedVariable put: true
^ self attributeAt: #isSharedVariable put: true
]

{ #category : #'Famix-Implementation' }
{ #category : #testing }
FamixStAttribute >> isSharedVariable [
^ self propertyNamed: #sharedVariable ifNil: [ false ]

<FMProperty: #isSharedVariable type: #Boolean>
<FMComment: 'True if the attribute is a shared variable'>
^ self attributeAt: #isSharedVariable ifAbsent: [ false ]
]
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,25 @@ FamixPharoSmalltalkGenerator class >> prefix [
FamixPharoSmalltalkGenerator >> defineClasses [
super defineClasses.

access := builder newClassNamed: #Access.
annotationInstance := builder newClassNamed: #AnnotationInstance.
annotationInstanceAttribute := builder newClassNamed: #AnnotationInstanceAttribute.
annotationType := builder newClassNamed: #AnnotationType.
annotationTypeAttribute := builder newClassNamed: #AnnotationTypeAttribute.
attribute := builder newClassNamed: #Attribute.
class := builder newClassNamed: #Class.
globalVariable := builder newClassNamed: #GlobalVariable.
implicitVariable := builder newClassNamed: #ImplicitVariable.
inheritance := builder newClassNamed: #Inheritance.
invocation := builder newClassNamed: #Invocation.
localVariable := builder newClassNamed: #LocalVariable.
pharoEntitySourceAnchor := builder newClassNamed: #PharoEntitySourceAnchor.
method := builder newClassNamed: #Method.
namespace := builder newClassNamed: #Namespace.
package := builder newClassNamed: #Package.
parameter := builder newClassNamed: #Parameter.
reference := builder newClassNamed: #Reference.
unknownVariable := builder newClassNamed: #UnknownVariable.
access := self newClassNamed: #Access.
annotationInstance := self newClassNamed: #AnnotationInstance.
annotationInstanceAttribute := self newClassNamed: #AnnotationInstanceAttribute.
annotationType := self newClassNamed: #AnnotationType.
annotationTypeAttribute := self newClassNamed: #AnnotationTypeAttribute.
attribute := self newClassNamed: #Attribute.
class := self newClassNamed: #Class.
globalVariable := self newClassNamed: #GlobalVariable.
implicitVariable := self newClassNamed: #ImplicitVariable.
inheritance := self newClassNamed: #Inheritance.
invocation := self newClassNamed: #Invocation.
localVariable := self newClassNamed: #LocalVariable.
pharoEntitySourceAnchor := self newClassNamed: #PharoEntitySourceAnchor.
method := self newClassNamed: #Method.
namespace := self newClassNamed: #Namespace.
package := self newClassNamed: #Package.
parameter := self newClassNamed: #Parameter.
reference := self newClassNamed: #Reference.
unknownVariable := self newClassNamed: #UnknownVariable.

]

Expand Down
17 changes: 16 additions & 1 deletion src/Famix-PharoSmalltalk-Tests/FamixPharoAttributeTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,23 @@ Class {

{ #category : #tests }
FamixPharoAttributeTest >> testIsClassSide [

| attribute |
attribute := FamixStAttribute new.
attribute isClassSide: true.
self assert: attribute isClassSide .
self assert: attribute isClassSide
]

{ #category : #tests }
FamixPharoAttributeTest >> testSharedVariableArePersisted [

| attribute |
attribute := FamixStAttribute new.
attribute
isClassSide: true;
beSharedVariable.
self assert: attribute isSharedVariable.

attribute flush.
self assert: attribute isSharedVariable
]
Loading

0 comments on commit 3883aab

Please sign in to comment.