Skip to content

Simplify entity comparison using meta description#51

Open
AntoninGoslin wants to merge 10 commits into
moosetechnology:differences-list-with-meta-modelfrom
AntoninGoslin:simplify_entity_comparison_using_meta_description
Open

Simplify entity comparison using meta description#51
AntoninGoslin wants to merge 10 commits into
moosetechnology:differences-list-with-meta-modelfrom
AntoninGoslin:simplify_entity_comparison_using_meta_description

Conversation

@AntoninGoslin
Copy link
Copy Markdown
Contributor

I changed the logic of Famix Simple Diff, and we are now using meta models and Moose description instead of slots.
Here are the things that I changed:

  1. Property selection
properties := aFamixEntity class allSlots select: [ :slot |
		              slot class = FMProperty ].

is now like this

	properties := aFamixEntity mooseDescription allProperties select: [ :property |
			              property type isPrimitive and: [
				              property isDerived not and: [
					              property name ~= 'numberOfLinesOfCode' ] ] ].

we use Moose description with the method allProperties to get all the properties of the models.
We want the primitive types(Number,Boolean,String). They represent all the properties of the models.
We exclude the derived properties to not have the same differences multiple times.
We also exclude numberOfLinesOfCode which is useless for the comparison.

As we dont have slots anymore, we can't use read to use them. So now we are using getRawFrom, which is the equivalent for Moose meta models.

  1. Relation selection
    I changed this code:
relations := aFamixEntity class allSlots select: [ :slot |
		             slot isFMRelationSlot and: [
			             slot name ~= 'sourceAnchor' ] ].

to this code

relations := aFamixEntity mooseDescription allProperties select: [ :property |
			             property type isPrimitive not and: [
				          	property name ~= 'sourceAnchor' ] ].

This is the same logic. We get all the properties of the models that are not primitives one (objects, so relations). To do so, I changed the method compareRelation:from:to: in order to use getRawFrom: instead of read.

  1. isMultivalued

We are now using isMultivalued to know is relations are toOne or toMany.

All tests are OK with this new logic.

Closes issue #4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant