| [ATL] : problem with Sequence in Sequence [message #39516] | 
Mon, 21 May 2007 05:15   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: tristan.faure.c-s.fr 
 
I have defined an helper for an UML transformation which takes all the  
operations of the class from a package 
 
helper context UML!Package def : getOperations() : Sequence(UML!Operation)  
=  
( 
	self.ownedMember->select(a|a.oclIsTypeOf(UML!Class))->collect(a |  
a.ownedOperation).asSequence() 
); 
 
But when I check what there is returned by this helper I have this trace : 
 
Sequence {Sequence {_in!opcs_pop, _in!opcs_push, _in!pop, _in!push},  
Sequence {}, Sequence {}, Sequence {}, Sequence {}} 
 
A sequence in a sequence O_o . . . How can I do to have Just One sequence  
??? 
 
Thanks 
 
PS : if anybody knows (or have a source?) what is the best solution for  
defining a rule  
1 element -> many elements (i have to define for one operation many  
signals) 
I take it ;) 
 
i did something like that : 
s : _IF!System ( 
	id <- p.name, 
	signal <- theSignals, 
	), 
theSignals : distinct _IF!Signal foreach (e in seq)( 
	id <- e. ... 
)
 |  
 |  
  | 
| Re: [ATL] : problem with Sequence in Sequence [message #39549 is a reply to message #39516] | 
Mon, 21 May 2007 05:44    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: rchevrel.sodius.com 
 
This is a multi-part message in MIME format. 
--------------080600060208040609090005 
Content-Type: text/plain; charset=ISO-8859-15; format=flowed 
Content-Transfer-Encoding: 8bit 
 
Hi Tristan, 
 
It is completely normal to obtain sequence of sequences: select return a  
sequence and collect return a sequence for each element in input  
sequence, so you obtain sequence of sequences. 
 
Use "flatten" operation to create a sequence from a sequence of sequences 
(Sequence {Sequence {_in!opcs_pop, _in!opcs_push, _in!pop, _in!push},  
Sequence {}, Sequence {}, Sequence {}, Sequence {}}->flatten()  
become:  Sequence{_in!opcs_pop, _in!opcs_push, _in!pop, _in!push}) 
 
For your P.S., the way to do this is exactly the one you propose,  so  
try it or send more information :) 
 
Regards, 
 
*R
 |  
 |  
  | 
 | 
Powered by 
FUDForum. Page generated in 0.08600 seconds