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 07:43 Go to next message
No real name is currently offline No real name
Messages: 42
Registered: December 2010
Member
HI,

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 07: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 06:57 Go to previous message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1621
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
Obeo
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: Mon Jul 28 00:13:41 EDT 2014

Powered by FUDForum. Page generated in 0.01413 seconds