Home » Modeling » Epsilon » Re: EGL question
Re: EGL question [message #528466] |
Tue, 20 April 2010 15:34 |
Louis Rose 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 |
Louis Rose 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 |
Dimitrios Kolovos 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 |
Steffen Zschaler 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 |
Louis Rose 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 |
Dimitrios Kolovos 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 |
Steffen Zschaler 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/
>>>>
>
>
|
|
|
Goto Forum:
Current Time: Fri Sep 20 13:55:15 GMT 2024
Powered by FUDForum. Page generated in 0.04046 seconds
|