Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF compare] ignore the comparison of an attribute by its value
[EMF compare] ignore the comparison of an attribute by its value [message #667200] Wed, 27 April 2011 11:43 Go to next message
No real name is currently offline No real nameFriend
Messages: 42
Registered: December 2010

I want to ignore the comparison of an attribute after the comparison of its value;

Some Things like this:
if (attribut.getValue(). equals ("value"))
         ignore = true

shouldBeignored() only checks the name of the attribute but not its value;

there is a way to do that?

[Updated on: Wed, 27 April 2011 11:44]

Report message to a moderator

Re: [EMF compare] ignore the comparison of an attribute by its value [message #667821 is a reply to message #667200] Mon, 02 May 2011 10:57 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1886
Registered: July 2009
Senior Member
Not easily, but it can be done. Basically, you need to override the two "checkAttributesUpdates" methods, copy/paste the code from the generic "AttributesCheck" and replace the call to "shouldBeIgnored" (the line "if (!shouldBeIgnored(next)) {" by a call to your own "shouldBeIgnored" that takes both the EAttribute and the MatchElement as parameter in order to retrieve the attribute value for that given Match2/3Elements.

Something like

	protected void shouldBeIgnored(EAttribute attribute, Match2Elements mapping) {
		boolean result = shouldBeIgnored(next));

		if (!result) {
			Object leftValue = mapping.getLeftElement().eGet(attribute);
			Object rightValue = mapping.getRightElement().eGet(attribute);
			result = leftValue.equals("ignoreMe") || rightValue.equals("ignoreMe");

		return result;

Laurent Goubet
Previous Topic:[EMF Compare] and supertypes
Next Topic:[EMF Compare] Detecting supertype changes for the purpose of creating a common Ecore model
Goto Forum:

Current Time: Wed Oct 28 21:21:22 GMT 2020

Powered by FUDForum. Page generated in 0.02461 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top