Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Debugging Expressions(Debugging if conditions)
Debugging Expressions [message #645040] Wed, 15 December 2010 10:29 Go to next message
mqasimae  is currently offline mqasimae Friend
Messages: 3
Registered: December 2010
Junior Member
Hey every one,
Well im new to ATLs and trying to create a transformation, i have sucessfully completed all the examples given on the website but want to do more. Getting onto the point, im unable to debug the if conditions or expressions.

Here is the condition,
if(s1.incomingEdges->collect(c|c.source.lanes)->size()>0)

what i want is to see the actual value that its returning, like whats the value of size in this case, is it possible??

Please help me out coz im absolutely stuck here.
Re: Debugging Expressions [message #645043 is a reply to message #645040] Wed, 15 December 2010 10:46 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
debug(x : String) is an operation that applied on a returns a while printing "x : "+a on the console.
In your case it will be :
if(s1.incomingEdges->collect(c|c.source.lanes)->size().debug('size')>0)


Btw, you are probably lacking a ->flatten() in your expression because collect will return a sequence of results. There, each result is a sequence too so in the end you will get a sequence of sequences and the size will be > 0 except if incomingEdges is empty which is probably not you want.
Re: Debugging Expressions [message #645062 is a reply to message #645043] Wed, 15 December 2010 13:24 Go to previous messageGo to next message
mqasimae  is currently offline mqasimae Friend
Messages: 3
Registered: December 2010
Junior Member
Thanx for the reply mate, u r exactly right in suggesting abt flatten, but i really am not sure where to place it, it tried placing it after .source but that returns an error of operation not found. then i tried it at different places but can't get the desired results.

the scenario is s1 can contain more than one incomingEdges, theses incomingEdges have a source which may contain a lane, the lane is what i wan to put the check on, that if there exist atleast one lane then the expression may return true.

Re: Debugging Expressions [message #645071 is a reply to message #645040] Wed, 15 December 2010 13:55 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
if(s1.incomingEdges->collect(c|c.source.lanes)->flatten()->size().debug('size')>0)
Re: Debugging Expressions [message #645108 is a reply to message #645071] Wed, 15 December 2010 15:39 Go to previous message
mqasimae  is currently offline mqasimae Friend
Messages: 3
Registered: December 2010
Junior Member
Thanx once again, whats happning now is s1.incomingEdges is selecting only one incoming edge from all the edges and producing the result. so it works fine if there exists only one incomingEdge, but if there are more edges than it just selects the first edge and if it contains lanes it produces true else false. can u please guide how can that be fixed.
Previous Topic:Howto to setup M2M development environment
Next Topic:[QVTo] Failed to resolve metamodel - in running Java application
Goto Forum:
  


Current Time: Thu Apr 25 14:47:11 GMT 2024

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

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

Back to the top