Skip to main content



      Home
Home » Archived » M2M (model-to-model transformation) » [ATL] short circuit and operation
[ATL] short circuit and operation [message #19328] Tue, 27 February 2007 18:57 Go to next message
Eclipse UserFriend
Originally posted by: irbull.cs.uvic.ca

Does ATL support a short circuit AND operation? I have a transformation
condition which I am trying to apply, however, if first have to check
that an element has a particular property and if so, then I can check my
condition.

something like:

rule test {
from s : element!InputMM (
s.type.name = 'value' and s.refImmediateComposite().name = 'v2'
)

all input elements of type s with s.type.name = value have a proper
parent so I can do this. However, other elements don't. If s.type.name
= 'value' is false, then the second part should not take place.

cheers,
ian
Re: [ATL] short circuit and operation [message #19466 is a reply to message #19328] Wed, 28 February 2007 03:54 Go to previous message
Eclipse UserFriend
Ian Bull schreef:
> Does ATL support a short circuit AND operation? I have a transformation
> condition which I am trying to apply, however, if first have to check
> that an element has a particular property and if so, then I can check my
> condition.
>
> something like:
>
> rule test {
> from s : element!InputMM (
> s.type.name = 'value' and s.refImmediateComposite().name = 'v2'
> )
>
> all input elements of type s with s.type.name = value have a proper
> parent so I can do this. However, other elements don't. If s.type.name
> = 'value' is false, then the second part should not take place.
>
> cheers,
> ian

You can use the OCL "if" statement:

if s.type.name = 'value' then
s.refImmediateComposite().name = 'v2'
else false endif

This is also a good way to gain some speed-up, since the "then" part is
only evaluated if the "if" part holds.

--
Dennis
Previous Topic:[ATL] superimposition question
Next Topic:[ATL] New ATL use case
Goto Forum:
  


Current Time: Thu Jul 10 00:06:12 EDT 2025

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

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

Back to the top