[furcas-discussion] Question on element ordering

Uhl, Axel axel.uhl at sap.com
Wed Feb 16 16:57:06 CET 2011


Hi,

I'm a bit scared by the following observation. I have a .tcs file excerpt as follows:

		     revenues=foreach("OCL:self.articles",
		                      when="self.key.size() < 5", mode=short, as=RevenueLedger,
		                      when="self.key.size() >= 5 and self.key.size() < 10", mode=medium, as=RevenueLedger,
		                      mode=long, as=RevenueLedger) }}

When I debug the DelayedReferenceHelper while it's carrying out the foreach property init I can see that the PredicateSemantic objects are traversed such that the when-clause "self.key.size() >= 5 and self.key.size() < 10" comes first, "self.key.size() < 5" comes second and no-when-clause comes last.

This is scary because the ordering of when-clauses carries semantics, as does the order of the case-clauses inside a Java switch statement.

I checked the InjectorActionsHandler responsible for generating the setPredicateRef(...) call in the parser. The assembly of the List structure holding the PredicateSemantic objects happens in the order in which the PredicateSemantic objects are retrieved from the ForeachPredicatePropertyInit. The respective reference is set as ordered in the TCS.ecore metamodel.

I'll try to check what the ordering is in the generated TCS model for the mapping. In the meantime, if anyone has an idea, please let me know.

Best,
-- Axel


More information about the Furcas-discussion mailing list