Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Sequence Diagram to text(how to restrict the amount/number of method)
[Acceleo] Sequence Diagram to text [message #529763] Tue, 27 April 2010 07:14 Go to next message
Laviale Benoit is currently offline Laviale Benoit
Messages: 25
Registered: April 2010
Location: Paris
Junior Member
Good Morning

I am trying to generate a code from sequences diagrams.
The job of this code is to instantiate objects(Lifeline) and call the method(messages).

My template is "good", I have all my methods, all of my parameters and all my objects ...

But, you know that, in a sequence diagram, it's possible to call many times the same method.

The result is that my template write X times the method who is called X times.

To conclude, I just need a trick to "restrict" to only one, the number of my method.

Thank you !

Best Regards

Benoît

[Edit : I'am using Acceleo V3 with model generate with RSM ]




Trainee
Thales Communications France

[Updated on: Mon, 03 May 2010 06:59]

Report message to a moderator

Re: [Acceleo] Sequence Diagram to text [message #529786 is a reply to message #529763] Tue, 27 April 2010 08:40 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1625
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070305030905010300090608
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hi,

I believe this is the same as what you posted on
http://www.acceleo.org/forum/read.php?5,3593,3595#msg-3595 ... Please
only post questions here about Acceleo 3 :).

Laurent Goubet
Obeo

Laviale Benoit wrote:
> Good Morning
>
> I am trying to generate a code from sequences diagrams.
> The job of this code is to instantiate objects(Lifeline) and call the
> method(messages).
>
> My template is "good", I have all my methods, all of my parameters and
> all my objects ...
>
> But, you know that, in a sequence diagram, it's possible to call many
> times the same method.
> The result is that my template write X times the method who is called X
> times.
>
> To conclude, I just need a trick to "restrict" to only one, the number
> of my method.
>
> Thank you !
> Best Regards
>
> Benoît
>
>
>


--------------070305030905010300090608
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------070305030905010300090608--
Re: [Acceleo] Sequence Diagram to text [message #529789 is a reply to message #529786] Tue, 27 April 2010 08:46 Go to previous messageGo to next message
Laviale Benoit is currently offline Laviale Benoit
Messages: 25
Registered: April 2010
Location: Paris
Junior Member
Hi

Sure that's the same problem/topic.

I am working on.

I will only post on this forum for Acceleo 3.0

Thank you for your help Wink


Trainee
Thales Communications France
Re: [Acceleo] Sequence Diagram to text [message #531274 is a reply to message #529763] Tue, 04 May 2010 12:06 Go to previous messageGo to next message
Laviale Benoit is currently offline Laviale Benoit
Messages: 25
Registered: April 2010
Location: Paris
Junior Member
Hi,

I am coming back on this problem...

[query private getOperationList(i : Interaction) : Sequence(Operation) =
	i.fragment->iterate(mess : MessageOccurenceSpecification; res : Sequence(Operation) = Sequence{} |
		res->union(
			mess.covered.represents.type.ownedElement->select(o : Operation |
				mess.message.name = o.name and mess.event.eClass().name = 'ReceiveOperationEvent'
			)->asOrderedSet()->asSequence()
		)
	)
/]


I tried the code of Laurent,it was very interesting but it don't running...

I tried to custom this code, but it is always not running...

I have some questions about the Laurent's code :
- i think its not possible to make a "basic" union because we have two types of values ( Operation and Messages) and the union method needs to have the same type of object, some body agree ?
- the union function is not implemented on sequence, but implemented on Set => What's the differences of this two type of lists?



Is it possible to do something like that :
Against to use Union & Co

Operations = [ ]
Cleared = [ ]
For op in Operations 
       if  empty( Cleared.getObj(op) )  // The op is not in the Cleared array
               Cleared.add(op) // Add the op to the cleared array

operations = cleared




Thank you for any help!


Ps : when does the Acceleo 3.0 Documentation will be released ??
@ Laurent Do you have a "beta" of the documentation?



[EDIT]

I ve just read this

"To be extreme, [...] should be the way to filter every kind of thing, for example if I want to filter the types of the objects in the current collection, I would write something like that :"

myCollection[Class].name
myCollection[Class or Interface].name

Does it implemented in Acceleo 3.0 Beta?
Will it be implemented in Acceleo 3.0 Release ( June 2k10) ?

(Source : http://jomd.blogspot.com/2010/03/just-little-bit-about-simpl e-ocl.html Jonathan Musset )




Trainee
Thales Communications France

[Updated on: Tue, 04 May 2010 12:39]

Report message to a moderator

Re: [Acceleo] Sequence Diagram to text [message #531362 is a reply to message #531274] Tue, 04 May 2010 15:19 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1625
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030407070809050808010801
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Benoit,

Please see comments inlined below.

Laviale Benoit wrote:
> Hi,
> I am coming back on this problem...
>
>
> [query private getOperationList(i : Interaction) : Sequence(Operation) =
> i.fragment->iterate(mess : MessageOccurenceSpecification; res :
> Sequence(Operation) = Sequence{} |
> res->union(
> mess.covered.represents.type.ownedElement->select(o :
> Operation |
> mess.message.name = o.name and mess.event.eClass().name
> = 'ReceiveOperationEvent'
> )->asOrderedSet()->asSequence()
> )
> )
> /]
>
>
> I tried the code of Laurent,it was very interesting but it don't
> running...

Could you post the error message(s) you get (either compilation errors
or runtime errors logged in the error log)? It is quite difficult to
debug without knowing what fails, and when :p.

>
> I tried to custom this code, but it is always not running...
>
> I have some questions about the Laurent's code :
> - i think its not possible to make a "basic" union because we have two
> types of values ( Operation and Messages) and the union method needs to
> have the same type of object, some body agree ?

Union needs the two collections' types to have a common supertype (you
can do an union between a Set(Integer) and a Set(Real)).

> - the union function is not implemented on sequence, but implemented on
> Set => What's the differences of this two type list?

There are four types of collections in OCL, corresponding to the two
feature's attributes that can matter : "ordered" tells us whether the
collection should have a predictable iteration order, "unique" tells us
whether the collection should accept more than once a given value. The
collections are :

"Sequence" - ordered, non unique
"OrderedSet" - ordered, unique
"Bag" - non ordered, non unique
"Set" - non ordered, unique

That being said there are a couple of "union" operations accessible :

Set::union(Bag)
Set::union(Set)
OrderedSet::union(Bag)
OrderedSet::union(Set)
Bag::union(Bag)
Bag::union(Set)
Sequence::union(Sequence)

The specification tells nothing about "union" on OrderedSet... I don't
really want to try and understand the definition on Bags. I wanted to
add a non-standard operation in Acceleo with the semantics of Java's
"addAll" that would allow manipulation on all kind of Collections, yet
haven't had time yet to plan this.

Please raise a bug against Acceleo if you require such an operation,
otherwise you'll have to convert your collections here and there in
order to make use of one of the 7 "union" OCL defines.

>
>
> Is it possible to do something like that : Against to use Union & Co
>
>
> Operations = [ ]
> Cleared = [ ]
> For op in Operations if empty( Cleared.getObj(op) ) // The op is
> not in the Cleared array
> Cleared.add(op) // Add the op to the cleared array
>
> operations = cleared
>
>

Sure, "iterate" allows things like this :

operations->iterate(op : Operation; cleared : Set(Operation) = Set{} |
if cleared->includes(op) then cleared else cleared->including(op))

but this is exactly the same as converting "operations" to a Set (thus
removing all duplicates along the way).

>
>
> Thank you for any help!
>
> Ps : when does the Acceleo 3.0 Documentation will be released ?? @
> Laurent Do you have a "beta" of the documentation?
>

The M7 build is fresh out of the build server, you can download it on
the usual download page (
http://www.eclipse.org/modeling/m2t/downloads/?project=accel eo ) or use
the interim helios update site (
http://download.eclipse.org/modeling/m2t/updates/milestones/ ). This
build contains most of the updated docs. I still need to review two of
them, and we're still missing some "[PENDING]" annotations here and
there, but this is the most up to date version of the docs you can find.

Laurent Goubet
Obeo

--------------030407070809050808010801
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------030407070809050808010801--
Re: [Acceleo] Sequence Diagram to text [message #532107 is a reply to message #531362] Fri, 07 May 2010 08:30 Go to previous message
Laviale Benoit is currently offline Laviale Benoit
Messages: 25
Registered: April 2010
Location: Paris
Junior Member
Thank you for your help Laurent...

I just get a List with string Filtred. But I can't use it after... That's useless...

I will try other ways to find an issue!


Have a nice day.

Benoit




Trainee
Thales Communications France
Previous Topic:Strange behaviour of EXPAND statement
Next Topic:[Xtend] Creating New Project from Ecore model from XSD
Goto Forum:
  


Current Time: Fri Sep 19 22:14:26 GMT 2014

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

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