Skip to main content



      Home
Home » Modeling » ATL » ifExp in ATL textual syntax.
ifExp in ATL textual syntax. [message #1066975] Fri, 05 July 2013 06:12 Go to next message
Eclipse UserFriend
Hello, I saw in ATL grammar that ifExp is like that:
ifExp ::= 'if' oclExpression 'then' oclExpression 'else' oclExpression 'endif';

I would like to use something like 'if' oclExpression 'then' oclExpression 'endif';

Does anyone know how to manage that?

Althrough, is there something like breack(in "C" language) in ATL so it will help me to use ifExp like this:
ifExp ::= 'if' oclExpression 'then' oclExpression 'else' break 'endif';
Re: ifExp in ATL textual syntax. [message #1067076 is a reply to message #1066975] Fri, 05 July 2013 13:14 Go to previous messageGo to next message
Eclipse UserFriend
Félix SILINOU KAMDEM wrote on Fri, 05 July 2013 06:12
Hello, I saw in ATL ifExp ::= 'if' oclExpression 'then' oclExpression 'else' break 'endif';


What would be the value of such an expression?
Comparing to C "if" in ATL is like "?:" operator - not "if" statement.
Remember that OCL is side-effect free so: what is your use case?

You can always write "if exp then exp else OclUndefined endif"

Thanks,
Michal
Re: ifExp in ATL textual syntax. [message #1067217 is a reply to message #1067076] Sun, 07 July 2013 14:15 Go to previous messageGo to next message
Eclipse UserFriend
I know that Michal,
But in my case I would like to do something like if something is true I will generate this, if not I do nothing.

Actually, I only want to do something if condition is true.
Re: ifExp in ATL textual syntax. [message #1067338 is a reply to message #1067217] Mon, 08 July 2013 06:51 Go to previous messageGo to next message
Eclipse UserFriend
Hi

You are demanding that ATL behaves in a non-declarative way contrary to
its principles.

If you really want to do imperative programming, perhaps you should
consider an imperative technique such as Java, Xtend or QVTo.

ATL does have imperative capabilities, but they are discouraged, so
perhaps you overlooked them.

Regards

Ed Willink


On 07/07/2013 19:15, Félix SILINOU KAMDEM wrote:
> I know that Michal,
> But in my case I would like to do something like if something is true
> I will generate this, if not I do nothing.
>
> Actually, I only want to do something if condition is true.
Re: ifExp in ATL textual syntax. [message #1067359 is a reply to message #1067338] Mon, 08 July 2013 08:05 Go to previous messageGo to next message
Eclipse UserFriend
Thank.
It is possible to invoke java methods in ATL?

Can I ask you something @Ed? I want to know if there is an ATL methods we can use to break operation.
Re: ifExp in ATL textual syntax. [message #1067384 is a reply to message #1067359] Mon, 08 July 2013 09:22 Go to previous messageGo to next message
Eclipse UserFriend
Hi, did you try something like that, just using the first expression and condition

if(aPerson.gender = #male) {
	thisModule.menNb <- thisModule.menNb + 1;
	thisModule.men->including(aPerson);
}
Re: ifExp in ATL textual syntax. [message #1067407 is a reply to message #1067384] Mon, 08 July 2013 10:30 Go to previous message
Eclipse UserFriend
Thank you everyone,
Like @Michal said before, "if" in ATL is like "?:" operator so I must an else_expression.

I just need to return in else case something which is not important.
Previous Topic:Full name reference - Classifiers seem not to be equal
Next Topic:Help for using properties through collection
Goto Forum:
  


Current Time: Thu Jul 24 11:24:31 EDT 2025

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

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

Back to the top