Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [XPAND] [XTEND] hot to get the number of parameters for an operation
[XPAND] [XTEND] hot to get the number of parameters for an operation [message #504715] Tue, 22 December 2009 10:31 Go to next message
Wafi Dahman is currently offline Wafi DahmanFriend
Messages: 15
Registered: November 2009
Junior Member
hello to all,

I want to get the number of parameters of an operation to generate Java code out of UML
I need only the number of parameters to insert it inside an array.
I have something like the following.. I do not know what to insert inside the FOREACH block instead of the question marks.

«FOREACH trueParameters() AS p ITERATOR i-»
?????????????????????????
«ENDFOREACH»


thanx in-advance
Re: [XPAND] [XTEND] hot to get the number of parameters for an operation [message #504722 is a reply to message #504715] Tue, 22 December 2009 05:44 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

I'm assuming that you mean parameters for an uml::Operation...

«FOREACH ownedParameters.reject(e|e.direction!=uml::ParameterDirectionKind::return) AS p ITERATOR i-»
«ENDFOREACH»



Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: [XPAND] [XTEND] hot to get the number of parameters for an operation [message #504724 is a reply to message #504722] Tue, 22 December 2009 10:47 Go to previous messageGo to next message
Wafi Dahman is currently offline Wafi DahmanFriend
Messages: 15
Registered: November 2009
Junior Member
yes true ...
Re: [XPAND] [XTEND] hot to get the number of parameters for an operation [message #504735 is a reply to message #504722] Tue, 22 December 2009 11:12 Go to previous messageGo to next message
Wafi Dahman is currently offline Wafi DahmanFriend
Messages: 15
Registered: November 2009
Junior Member
have you answered my question?

Karsten Thoms wrote on Tue, 22 December 2009 00:44
I'm assuming that you mean parameters for an uml::Operation...

«FOREACH ownedParameters.reject(e|e.direction!=uml::ParameterDirectionKind::return) AS p ITERATOR i-»
«ENDFOREACH»



Re: [XPAND] [XTEND] hot to get the number of parameters for an operation [message #504882 is a reply to message #504735] Wed, 23 December 2009 10:23 Go to previous message
Wafi Dahman is currently offline Wafi DahmanFriend
Messages: 15
Registered: November 2009
Junior Member
the following has worked
xtend
int count (uml::Operation o) : o.ownedParameter.size;


and call it in your template like this

«count()-1»


Previous Topic:Xpand copy files as-is
Next Topic:[Xtext] Can a keyword not be generated as a lexer rule ?
Goto Forum:
  


Current Time: Tue Oct 15 04:16:16 GMT 2024

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

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

Back to the top