[furcas-discussion] Question on element ordering

Uhl, Axel axel.uhl at sap.com
Wed Feb 16 17:07:45 CET 2011


The elements show up in the original, correct order inside the ForeachPredicatePropertyInitImpl:

[com.sap.furcas.metamodel.FURCAS.TCS.impl.PredicateSemanticImpl at 4ed4b486 (when: self.key.size() < 5, mode: short), com.sap.furcas.metamodel.FURCAS.TCS.impl.PredicateSemanticImpl at 3986d4a1 (when: self.key.size() >= 5 and self.key.size() < 10, mode: medium), com.sap.furcas.metamodel.FURCAS.TCS.impl.PredicateSemanticImpl at a41c80e (when: null, mode: long)]

The debugger also shows that the predicateActionList inside the DelayedReference is still in correct order.

Arghhh... and now it doesn't seem to be reproducable anymore. Could this mean that the placement of the PredicateSemantic children in the ForeachPredicatePropertyInit object is *random*?

-- Axel

> -----Original Message-----
> From: furcas-discussion-bounces at lists.furcas.org [mailto:furcas-
> discussion-bounces at lists.furcas.org] On Behalf Of Uhl, Axel
> Sent: Wednesday, February 16, 2011 4:57 PM
> To: furcas-discussion
> Subject: [furcas-discussion] Question on element ordering
> 
> 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
> _______________________________________________
> Furcas-discussion mailing list
> Furcas-discussion at lists.furcas.org
> http://lists.furcas.org/cgi-bin/mailman/listinfo/furcas-discussion


More information about the Furcas-discussion mailing list