| Inverting and merging differences [message #1049160] |
Thu, 25 April 2013 09:05  |
Miklós Földényi Messages: 5 Registered: October 2012 |
Junior Member |
|
|
Hi!
I am having some newbie trouble using EMF Diff/Merge. It might even be, that this tool is not ideal for my needs, but I got so confused I am not sure I can decide that by myself, so I present my use case below:
Assume I have an EMF meta-model (that can be considered non-changing for our purposes) and an EMF model instance of this meta-model. I'll refer to the current state of this instance as State 1 (S1).
I want to execute changes on my model instance:
C1:S1->S2 (executing Change 1 in State 1 results in State 2)
C2:S1->S3
C3:S2->S4
Executing C1, C2 and C3 in order, results in the following state transition: (to execute C3 I have to move the model into S2 first)
S1->S2->S1->S3->S2->S4
The Green transitions are trivial. The Orange and Red transitions are my problems.
The Orange requires me to "undo" a transition, which I cannot do by undoing the RecordingCommands, for reasons outside of the scope of my question. This I would like to achieve, by calculating the Diff1 S1->S2 and executing it's inverse.
The Red transition is a "state jump", which I would like to achieve by calculating Diff2 S1->S3, then merging Diff1 and Diff2 into Diff3 in such a way, that executing Diff3 in S3 will result in S2. (this would mean (inverse Diff2)+Diff1)
This is important for me since I can be pretty deep down in the change tree and always walking up to the root then back down can be very expensive. Also, due to a large number of listeners on the model instance, I would like to achieve the S3->S2 state transition with the least amount of model modifications.
So my questions are:
- Can a Diff be calculated and stored for later use in this way?
- Can it be inverted?
- Can it be merged with other Diffs (prior to merging them with the model instance) assuming they have a common state "end"? (like in the case above, S1 appearing in Diff1 S1->S2 and in inverse Diff2 S3->S1, so S3->S1->S2 is a valid transition sequence)
Thanks!
|
|
|