[ATL] short circuit and operation [message #19328] |
Tue, 27 February 2007 18:57  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03565 seconds