Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Re: EGL question
Re: EGL question [message #528466] Tue, 20 April 2010 15:34 Go to next message
Louis Rose is currently offline Louis RoseFriend
Messages: 440
Registered: July 2009
Location: York, United Kingdom
Senior Member
Hi Steffen,

Good to hear from you. I hope you're well.

There's not support for sequence separation characters for loops, but
there is the EolCollection#concat method. In this case, the following
should do what you want:

[%=class.extends.concat(',');%]

Cheers,
Louis.


Steffen Zschaler wrote:
> Hi Louis,
>
> Does EGL provide support for sequence separation characters in for
> loops? For example, in generating an extends clause, could I write
> something like
>
> [%for (sc in class.extends; separator=',') {%]
> [%=sc.name%]
> [%}%]
>
>
> instead of having to keep writing this:
>
> [%first := true;
> for (sc in class.extends) {
> if (first)
> first := false
> else
> out.print (',');
> %]
> [%=sc.name%]
> [%}%]
>
>
> Cheers,
>
> Steffen
>
> --
> Dr. rer. nat. Steffen Zschaler
> Marie Curie Fellow
>
> Lancaster University
> Lancaster, United Kingdom
>
> Email szschaler@acm.org
> Phone +44 (01524) 510354
> WWW http://www.steffen-zschaler.de/
>
Re: EGL question [message #528467 is a reply to message #528466] Tue, 20 April 2010 15:36 Go to previous messageGo to next message
Louis Rose is currently offline Louis RoseFriend
Messages: 440
Registered: July 2009
Location: York, United Kingdom
Senior Member
Whoops, that should be:

[%=class.extends.concat(',')%]

(semi-colon terminators are omitted in dynamic sections)

Louis Rose wrote:
> Hi Steffen,
>
> Good to hear from you. I hope you're well.
>
> There's not support for sequence separation characters for loops, but
> there is the EolCollection#concat method. In this case, the following
> should do what you want:
>
> [%=class.extends.concat(',');%]
>
> Cheers,
> Louis.
>
>
> Steffen Zschaler wrote:
>> Hi Louis,
>>
>> Does EGL provide support for sequence separation characters in for
>> loops? For example, in generating an extends clause, could I write
>> something like
>>
>> [%for (sc in class.extends; separator=',') {%]
>> [%=sc.name%]
>> [%}%]
>>
>> instead of having to keep writing this:
>>
>> [%first := true;
>> for (sc in class.extends) {
>> if (first) first := false
>> else
>> out.print (',');
>> %]
>> [%=sc.name%]
>> [%}%]
>>
>> Cheers,
>>
>> Steffen
>>
>> --
>> Dr. rer. nat. Steffen Zschaler
>> Marie Curie Fellow
>>
>> Lancaster University
>> Lancaster, United Kingdom
>>
>> Email szschaler@acm.org
>> Phone +44 (01524) 510354
>> WWW http://www.steffen-zschaler.de/
>>
Re: EGL question [message #528468 is a reply to message #528467] Tue, 20 April 2010 15:39 Go to previous messageGo to next message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Steffen,

In for loops, two additional implicit variables are available:

* loopCount : Integer (starts at 1)
* hasMore : Boolean (false if in the last loop, true otherwise)

Having said this, the concat() method suggested by Louis is still the
most efficient option for the scenario you mentioned.

Cheers,
Dimitris

Louis Rose wrote:
> Whoops, that should be:
>
> [%=class.extends.concat(',')%]
>
> (semi-colon terminators are omitted in dynamic sections)
>
> Louis Rose wrote:
>> Hi Steffen,
>>
>> Good to hear from you. I hope you're well.
>>
>> There's not support for sequence separation characters for loops, but
>> there is the EolCollection#concat method. In this case, the following
>> should do what you want:
>>
>> [%=class.extends.concat(',');%]
>>
>> Cheers,
>> Louis.
>>
>>
>> Steffen Zschaler wrote:
>>> Hi Louis,
>>>
>>> Does EGL provide support for sequence separation characters in for
>>> loops? For example, in generating an extends clause, could I write
>>> something like
>>>
>>> [%for (sc in class.extends; separator=',') {%]
>>> [%=sc.name%]
>>> [%}%]
>>> instead of having to keep writing this:
>>>
>>> [%first := true;
>>> for (sc in class.extends) {
>>> if (first) first := false
>>> else
>>> out.print (',');
>>> %]
>>> [%=sc.name%]
>>> [%}%]
>>> Cheers,
>>>
>>> Steffen
>>>
>>> --
>>> Dr. rer. nat. Steffen Zschaler
>>> Marie Curie Fellow
>>>
>>> Lancaster University
>>> Lancaster, United Kingdom
>>>
>>> Email szschaler@acm.org
>>> Phone +44 (01524) 510354
>>> WWW http://www.steffen-zschaler.de/
>>>


--
Spread the word: http://www.eclipse.org/gmt/epsilon/spreadtheword
Follow Epsilon on Twitter: http://twitter.com/epsilonews
Re: EGL question [message #528598 is a reply to message #528468] Wed, 21 April 2010 08:36 Go to previous message
Steffen Zschaler is currently offline Steffen ZschalerFriend
Messages: 266
Registered: July 2009
Senior Member
Thanks folks!

Steffen

On 20/04/2010 16:39, Dimitris Kolovos wrote:
> Hi Steffen,
>
> In for loops, two additional implicit variables are available:
>
> * loopCount : Integer (starts at 1)
> * hasMore : Boolean (false if in the last loop, true otherwise)
>
> Having said this, the concat() method suggested by Louis is still the
> most efficient option for the scenario you mentioned.
>
> Cheers,
> Dimitris
>
> Louis Rose wrote:
>> Whoops, that should be:
>>
>> [%=class.extends.concat(',')%]
>>
>> (semi-colon terminators are omitted in dynamic sections)
>>
>> Louis Rose wrote:
>>> Hi Steffen,
>>>
>>> Good to hear from you. I hope you're well.
>>>
>>> There's not support for sequence separation characters for loops,
>>> but there is the EolCollection#concat method. In this case, the
>>> following should do what you want:
>>>
>>> [%=class.extends.concat(',');%]
>>>
>>> Cheers,
>>> Louis.
>>>
>>>
>>> Steffen Zschaler wrote:
>>>> Hi Louis,
>>>>
>>>> Does EGL provide support for sequence separation characters in for
>>>> loops? For example, in generating an extends clause, could I write
>>>> something like
>>>>
>>>> [%for (sc in class.extends; separator=',') {%]
>>>> [%=sc.name%]
>>>> [%}%]
>>>> instead of having to keep writing this:
>>>>
>>>> [%first := true;
>>>> for (sc in class.extends) {
>>>> if (first) first := false
>>>> else
>>>> out.print (',');
>>>> %]
>>>> [%=sc.name%]
>>>> [%}%]
>>>> Cheers,
>>>>
>>>> Steffen
>>>>
>>>> --
>>>> Dr. rer. nat. Steffen Zschaler
>>>> Marie Curie Fellow
>>>>
>>>> Lancaster University
>>>> Lancaster, United Kingdom
>>>>
>>>> Email szschaler@acm.org
>>>> Phone +44 (01524) 510354
>>>> WWW http://www.steffen-zschaler.de/
>>>>
>
>
Re: EGL question [message #588420 is a reply to message #528466] Tue, 20 April 2010 15:36 Go to previous message
Louis Rose is currently offline Louis RoseFriend
Messages: 440
Registered: July 2009
Location: York, United Kingdom
Senior Member
Whoops, that should be:

[%=class.extends.concat(',')%]

(semi-colon terminators are omitted in dynamic sections)

Louis Rose wrote:
> Hi Steffen,
>
> Good to hear from you. I hope you're well.
>
> There's not support for sequence separation characters for loops, but
> there is the EolCollection#concat method. In this case, the following
> should do what you want:
>
> [%=class.extends.concat(',');%]
>
> Cheers,
> Louis.
>
>
> Steffen Zschaler wrote:
>> Hi Louis,
>>
>> Does EGL provide support for sequence separation characters in for
>> loops? For example, in generating an extends clause, could I write
>> something like
>>
>> [%for (sc in class.extends; separator=',') {%]
>> [%=sc.name%]
>> [%}%]
>>
>> instead of having to keep writing this:
>>
>> [%first := true;
>> for (sc in class.extends) {
>> if (first) first := false
>> else
>> out.print (',');
>> %]
>> [%=sc.name%]
>> [%}%]
>>
>> Cheers,
>>
>> Steffen
>>
>> --
>> Dr. rer. nat. Steffen Zschaler
>> Marie Curie Fellow
>>
>> Lancaster University
>> Lancaster, United Kingdom
>>
>> Email szschaler@acm.org
>> Phone +44 (01524) 510354
>> WWW http://www.steffen-zschaler.de/
>>
Re: EGL question [message #588422 is a reply to message #528467] Tue, 20 April 2010 15:39 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Steffen,

In for loops, two additional implicit variables are available:

* loopCount : Integer (starts at 1)
* hasMore : Boolean (false if in the last loop, true otherwise)

Having said this, the concat() method suggested by Louis is still the
most efficient option for the scenario you mentioned.

Cheers,
Dimitris

Louis Rose wrote:
> Whoops, that should be:
>
> [%=class.extends.concat(',')%]
>
> (semi-colon terminators are omitted in dynamic sections)
>
> Louis Rose wrote:
>> Hi Steffen,
>>
>> Good to hear from you. I hope you're well.
>>
>> There's not support for sequence separation characters for loops, but
>> there is the EolCollection#concat method. In this case, the following
>> should do what you want:
>>
>> [%=class.extends.concat(',');%]
>>
>> Cheers,
>> Louis.
>>
>>
>> Steffen Zschaler wrote:
>>> Hi Louis,
>>>
>>> Does EGL provide support for sequence separation characters in for
>>> loops? For example, in generating an extends clause, could I write
>>> something like
>>>
>>> [%for (sc in class.extends; separator=',') {%]
>>> [%=sc.name%]
>>> [%}%]
>>> instead of having to keep writing this:
>>>
>>> [%first := true;
>>> for (sc in class.extends) {
>>> if (first) first := false
>>> else
>>> out.print (',');
>>> %]
>>> [%=sc.name%]
>>> [%}%]
>>> Cheers,
>>>
>>> Steffen
>>>
>>> --
>>> Dr. rer. nat. Steffen Zschaler
>>> Marie Curie Fellow
>>>
>>> Lancaster University
>>> Lancaster, United Kingdom
>>>
>>> Email szschaler@acm.org
>>> Phone +44 (01524) 510354
>>> WWW http://www.steffen-zschaler.de/
>>>


--
Spread the word: http://www.eclipse.org/gmt/epsilon/spreadtheword
Follow Epsilon on Twitter: http://twitter.com/epsilonews
Re: EGL question [message #588430 is a reply to message #528468] Wed, 21 April 2010 08:36 Go to previous message
Steffen Zschaler is currently offline Steffen ZschalerFriend
Messages: 266
Registered: July 2009
Senior Member
Thanks folks!

Steffen

On 20/04/2010 16:39, Dimitris Kolovos wrote:
> Hi Steffen,
>
> In for loops, two additional implicit variables are available:
>
> * loopCount : Integer (starts at 1)
> * hasMore : Boolean (false if in the last loop, true otherwise)
>
> Having said this, the concat() method suggested by Louis is still the
> most efficient option for the scenario you mentioned.
>
> Cheers,
> Dimitris
>
> Louis Rose wrote:
>> Whoops, that should be:
>>
>> [%=class.extends.concat(',')%]
>>
>> (semi-colon terminators are omitted in dynamic sections)
>>
>> Louis Rose wrote:
>>> Hi Steffen,
>>>
>>> Good to hear from you. I hope you're well.
>>>
>>> There's not support for sequence separation characters for loops,
>>> but there is the EolCollection#concat method. In this case, the
>>> following should do what you want:
>>>
>>> [%=class.extends.concat(',');%]
>>>
>>> Cheers,
>>> Louis.
>>>
>>>
>>> Steffen Zschaler wrote:
>>>> Hi Louis,
>>>>
>>>> Does EGL provide support for sequence separation characters in for
>>>> loops? For example, in generating an extends clause, could I write
>>>> something like
>>>>
>>>> [%for (sc in class.extends; separator=',') {%]
>>>> [%=sc.name%]
>>>> [%}%]
>>>> instead of having to keep writing this:
>>>>
>>>> [%first := true;
>>>> for (sc in class.extends) {
>>>> if (first) first := false
>>>> else
>>>> out.print (',');
>>>> %]
>>>> [%=sc.name%]
>>>> [%}%]
>>>> Cheers,
>>>>
>>>> Steffen
>>>>
>>>> --
>>>> Dr. rer. nat. Steffen Zschaler
>>>> Marie Curie Fellow
>>>>
>>>> Lancaster University
>>>> Lancaster, United Kingdom
>>>>
>>>> Email szschaler@acm.org
>>>> Phone +44 (01524) 510354
>>>> WWW http://www.steffen-zschaler.de/
>>>>
>
>
Previous Topic:Re: EGL question
Next Topic:Using resource factories
Goto Forum:
  


Current Time: Thu Apr 25 02:20:55 GMT 2024

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

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

Back to the top