|Re: [Xtend] Criterion for element equality in Xtend sets? [message #545955 is a reply to message #545845]
||Fri, 09 July 2010 17:12
Registered: May 2010
I'll give some background for my question.|
In a model transformation rule that I want to express as an Xtend transformation, I require an n:1 mapping of input model elements to output model elements - that is, from time to time, even though I've called a "create extention" with different parameters, I want to have two equal objects be returned from both invocations.
That is: imagine I have a tuple of input model elements <a1, b, c> of types <A, B, C>. Using a create extension, I get some new output model element of type D.
create anotherpack::D createSomeD(somepack::A myA, somepack::B myB, somepack::C myC) :
let myNewD = createSomeD(a1, b, c) :
Now imagine that for my model transformation to be correct, I require to receive an equal "d" in case I call createSomeD() with a slightly different tuple
let anotherNewD = createSomeD(a2, b, c) :
So I'd like to have the following expression to be true:
myNewD.equalsTo(anotherNewD) // (some pseudocode)
(you might ask, "why do you want to have an equal object be returned by different create invocations?"... the reason is: I require it ;-)
As much as I see, Xtend's create extensions allow for 1:1 mappings. That is: given any tuple of input, this tuple gets its own unique output.
But I just came across a transformation problem where I require an n:1 mapping. That is: given a tuple of input, it may map to the same output as some other tuple of input.
I'm trying to work around this problem using the JavaTuple library, but this unfortunately causes me to use JAVA extensions... distributing my whole transformation algorithm across some .ext files and some ugly static Java methods.
Powered by FUDForum
. Page generated in 0.04972 seconds