Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » How to retreive a list of attribut in a certain order
How to retreive a list of attribut in a certain order [message #872190] Tue, 15 May 2012 16:03 Go to next message
Alain Lavoie is currently offline Alain LavoieFriend
Messages: 82
Registered: April 2012
Member
Hi,

I have to generate list of element (properties) in a given
order (doc and other requirements).

I have made multiple attempts without success. Here is what
I came from.

[let as : Set(Property) =
c.attribute->select(self.toString().startsWith('associationKeyword'))]

So, How can I get a list of properties (oclTypeOf(Property))
ordered by a choosen element (name, a guard, ...) ?

Regards.
Re: How to retreive a list of attribut in a certain order [Solved] [message #872338 is a reply to message #872190] Tue, 15 May 2012 23:36 Go to previous messageGo to next message
Alain Lavoie is currently offline Alain LavoieFriend
Messages: 82
Registered: April 2012
Member
Alain Lavoie a écrit :
> Hi,
>
> I have to generate list of element (properties) in a given
> order (doc and other requirements).
>
> I have made multiple attempts without success. Here is what
> I came from.
>
> [let as : Set(Property) =
> c.attribute->select(self.toString().startsWith('associationKeyword'))]
>
> So, How can I get a list of properties (oclTypeOf(Property))
> ordered by a choosen element (name, a guard, ...) ?
>
> Regards.

Ok, finally, here is the solution:

[let a : OrderedSet(Property) = b->select(p : Property |
p.name.contains('keyword'))->asOrderedSet()->sortedBy(name) ]

AL
Re: How to retreive a list of attribut in a certain order [Solved] [message #873234 is a reply to message #872338] Thu, 17 May 2012 19:01 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

asSet() will probably be quicker, since prior to sortedBy, ordering is
insignificant.

Regards

Ed Willink

On 16/05/2012 00:36, Alain Lavoie wrote:
> Alain Lavoie a écrit :
>> Hi,
>>
>> I have to generate list of element (properties) in a given
>> order (doc and other requirements).
>>
>> I have made multiple attempts without success. Here is what
>> I came from.
>>
>> [let as : Set(Property) =
>> c.attribute->select(self.toString().startsWith('associationKeyword'))]
>>
>> So, How can I get a list of properties (oclTypeOf(Property))
>> ordered by a choosen element (name, a guard, ...) ?
>>
>> Regards.
>
> Ok, finally, here is the solution:
>
> [let a : OrderedSet(Property) = b->select(p : Property |
> p.name.contains('keyword'))->asOrderedSet()->sortedBy(name) ]
>
> AL
Re: How to retreive a list of attribut in a certain order [Solved] [message #875884 is a reply to message #873234] Wed, 23 May 2012 13:49 Go to previous message
Alain Lavoie is currently offline Alain LavoieFriend
Messages: 82
Registered: April 2012
Member
Ed Willink a écrit :
> Hi
>
> asSet() will probably be quicker, since prior to sortedBy, ordering is
> insignificant.
>
> Regards
>
> Ed Willink

Thanks
Previous Topic:Creating an Eclipse Builder with Xpand
Next Topic:[Acceleo] 2 Debugging Environment behaving differently
Goto Forum:
  


Current Time: Tue Apr 23 11:11:29 GMT 2024

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

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

Back to the top