Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » Retrieving the "match of value" in an ADD Diff computed by EMF Compare
Retrieving the "match of value" in an ADD Diff computed by EMF Compare [message #1828185] Wed, 03 June 2020 12:21 Go to next message
Jean Walter is currently offline Jean WalterFriend
Messages: 10
Registered: May 2020
Junior Member
I am fairly new to EMF and have recently started using EMF Compare to compute the differences between two models. For the moment, those differences are simply printed to the console, and I try to retrieve all the useful information from them.

When I print an ADD Diff corresponding for example to the add of an eAttribute, it looks like this:
UNRESOLVED LEFT ADD org.eclipse.emf.compare.internal.spec.ReferenceChangeSpec{
  reference=EClass.eStructuralFeatures,
  value=EAttribute@7e8dcdaanom,
  parentMatch=org.eclipse.emf.compare.internal.spec.MatchSpec{
    left=EClass@5cdd09b1SystemOfAirport,
    right=EClass@8c11eeeSystemOfAirport,
    origin=<null>,
    #differences=2,
    #submatches=5
  },
  match of value=org.eclipse.emf.compare.internal.spec.MatchSpec{
    left=EAttribute@7e8dcdaanom,
    right=<null>,
    origin=<null>,
    #differences=1,
    #submatches=0
  }
}


What I would like to retrieve is the MatchSpec corresponding to the *match of value* attribute of my ReferenceChangeSpec. However, I can't seem to find the corresponding getter in the ReferenceChangeSpec documentation. I have tried looking into the GitHub code for Diffs and especially Diff.toString(), but it hasn't brought me any further, that's why I am asking for your help.

[Updated on: Thu, 04 June 2020 09:35]

Report message to a moderator

Re: Retrieving the "match of value" in an ADD Diff computed by EMF Compare [message #1828344 is a reply to message #1828185] Mon, 08 June 2020 07:05 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hello,

Have you looked into the EMFComparePrettyPrinter class and how it's implemented? This is what we are using to debug some tricky issues with the comparison model and might help you understand how to retrieve the different values.

Specifically, what you are looking for is Comparison.getMatch(EObject).

Laurent Goubet
Obeo
Re: Retrieving the "match of value" in an ADD Diff computed by EMF Compare [message #1828390 is a reply to message #1828344] Tue, 09 June 2020 06:30 Go to previous message
Jean Walter is currently offline Jean WalterFriend
Messages: 10
Registered: May 2020
Junior Member
Okay thanks very much. I got what I needed using :
Match matchOfValue = comparison.getMatch(((ReferenceChangeSpec) difference).getValue());

[Updated on: Tue, 09 June 2020 06:30]

Report message to a moderator

Previous Topic:Distinguishing various references inside Diff with same name
Next Topic:BatchMerger functionality in additive merging
Goto Forum:
  


Current Time: Fri Sep 20 08:11:12 GMT 2024

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

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

Back to the top