Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » ATL Operator for &&
ATL Operator for && [message #1614677] Fri, 13 February 2015 12:12 Go to next message
Alexander R is currently offline Alexander RFriend
Messages: 211
Registered: July 2013
Senior Member
Hi there,

is it possible to use a Java-like operator && in ATL (not only one &) ?
I would like to validate just one oprand in an if-expression and then jump to the else part.

In java it looks like this:

System.out.println( false && foo() );// false, foo() will not be called
System.out.println( false & foo() ); // false, foo() will be called


ALT behaves like false & foo() and not like false && foo(). I found this also in the documentation:

Quote:
if (exp1 and exp2) ... exp2 will always be evaluated, regardless of the result of the first expression


How may I change this behavior?

Thanks,
Alex
Re: ATL Operator for && [SOLVED] [message #1614742 is a reply to message #1614677] Fri, 13 February 2015 13:10 Go to previous messageGo to next message
Alexander R is currently offline Alexander RFriend
Messages: 211
Registered: July 2013
Senior Member
The only workaround I found is to nest if-clauses...like this:

	if false then
		if foo() then OclUndefined else OclUndefined endif
	else
		OclUndefined
	endif;


Each if-clause should handle only one case.
And because ATL uses OCL and OCL is side-effect free, we can use oclundefiend...

Hope this helps someone
Re: ATL Operator for && [SOLVED] [message #1614894 is a reply to message #1614742] Fri, 13 February 2015 15:15 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 589
Registered: September 2012
Location: Belgium
Senior Member

Regular ATL is strict. The new ATL/EMFTVM is lazy. In EMFTVM, the following expression will not call foo():

false and foo()


Cheers,
Dennis
Re: ATL Operator for && [SOLVED] [message #1618978 is a reply to message #1614894] Mon, 16 February 2015 08:52 Go to previous messageGo to next message
Alexander R is currently offline Alexander RFriend
Messages: 211
Registered: July 2013
Senior Member
Thanks for the hint,

just one question. Is the ATL/EMFTVM not the same as the EMF-specific VM?
Which I can configurate in the runtime-config?

https://dl.dropboxusercontent.com/u/18688378/eclipseCoding/question/EMFTVM.JPG

Thanks,

Alex

[Updated on: Mon, 16 February 2015 09:20]

Report message to a moderator

Re: ATL Operator for && [SOLVED] [message #1619392 is a reply to message #1618978] Mon, 16 February 2015 14:50 Go to previous message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 589
Registered: September 2012
Location: Belgium
Senior Member

No, it isn't the same: see https://wiki.eclipse.org/ATL/EMFTVM#How_to_use_EMFTVM.3F

Cheers,
Dennis
Previous Topic:Guards for unique lazy rules
Next Topic:[ATL] Transformation ends without output
Goto Forum:
  


Current Time: Thu Apr 18 08:04:21 GMT 2024

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

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

Back to the top