Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » ifExp in ATL textual syntax.
ifExp in ATL textual syntax. [message #1066975] Fri, 05 July 2013 10:12 Go to next message
Félix SILINOU KAMDEM is currently offline Félix SILINOU KAMDEMFriend
Messages: 96
Registered: April 2013
Member
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 17:14 Go to previous messageGo to next message
Michal Kleczek is currently offline Michal KleczekFriend
Messages: 31
Registered: May 2013
Member
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 18:15 Go to previous messageGo to next message
Félix SILINOU KAMDEM is currently offline Félix SILINOU KAMDEMFriend
Messages: 96
Registered: April 2013
Member
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 10:51 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
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 12:05 Go to previous messageGo to next message
Félix SILINOU KAMDEM is currently offline Félix SILINOU KAMDEMFriend
Messages: 96
Registered: April 2013
Member
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 13:22 Go to previous messageGo to next message
achraf lyazidi is currently offline achraf lyazidiFriend
Messages: 12
Registered: May 2013
Junior Member
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 14:30 Go to previous message
Félix SILINOU KAMDEM is currently offline Félix SILINOU KAMDEMFriend
Messages: 96
Registered: April 2013
Member
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: Fri Apr 19 04:59:21 GMT 2024

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

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

Back to the top