Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL]Problem with toSequence operator
[ATL]Problem with toSequence operator [message #52174] Thu, 12 July 2007 07:56 Go to next message
beaperez Mising name is currently offline beaperez Mising nameFriend
Messages: 81
Registered: July 2009
Member
Hello,
I am trying to convert a string into a Sequence. I use the toSequence
operator (varSequence = varString.toSequence()), but I get the
java.lang.NullPointerException. I have also tried with 'hello'.toSequence()
and I get the same error.
I have seen the post
http://www.sciences.univ-nantes.fr/lina/atl/www/atl_discussi on_archive/0695.html
but I don't know how to use recursion in ATL without a collection.
can anybody help my?
Thank you in advance.
Re: [ATL]Problem with toSequence operator [message #52228 is a reply to message #52174] Thu, 12 July 2007 13:36 Go to previous messageGo to next message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hello,

I have tried 'hello'.toSequence() on the latest version of ATL, and on
the (older) version available on the AMMA homepage:
http://www.sciences.univ-nantes.fr/lina/atl/atldemo/oclonlin e/?query=%27hello%27.toSequence%28%29

It worked in both cases.

Could you please try with another version of ATL (e.g., the latest),
and/or send us more information about the issue (e.g., the complete
stack trace)?

Thanks.


Regards,

Frédéric Jouault


Bea wrote:
> Hello,
> I am trying to convert a string into a Sequence. I use the toSequence
> operator (varSequence = varString.toSequence()), but I get the
> java.lang.NullPointerException. I have also tried with 'hello'.toSequence()
> and I get the same error.
> I have seen the post
> http://www.sciences.univ-nantes.fr/lina/atl/www/atl_discussi on_archive/0695.html
> but I don't know how to use recursion in ATL without a collection.
> can anybody help my?
> Thank you in advance.
>
>
>
>
Re: [ATL]Problem with toSequence operator [message #52254 is a reply to message #52228] Thu, 12 July 2007 14:20 Go to previous messageGo to next message
beaperez Mising name is currently offline beaperez Mising nameFriend
Messages: 81
Registered: July 2009
Member
I have install ATL in Eclipse 3.2 according with the page
http://wiki.eclipse.org/index.php/ATL/How_Install_ATL_From_C VS/

In other versions of ATL, it worked but I have problems with this version.
has anybody tried to obtain the same result using recursion?
Thank you


"Fr
Re: [ATL]Problem with toSequence operator [message #52280 is a reply to message #52254] Thu, 12 July 2007 14:32 Go to previous messageGo to next message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hello,

Something like this should work:

helper context String def: toSequence() : Sequence(String) =
let size : Integer = self.size() in
if self.size() > 1 then
Sequence {self.substring(1, size - 1).toSequence(),
self.substring(size, size)->asSequence()}->flatten()
else if self.size() = 1 then
Sequence {self}
else
Sequence {}
endif endif;


Regards,

Frédéric Jouault

Bea wrote:
> I have install ATL in Eclipse 3.2 according with the page
> http://wiki.eclipse.org/index.php/ATL/How_Install_ATL_From_C VS/
>
> In other versions of ATL, it worked but I have problems with this version.
> has anybody tried to obtain the same result using recursion?
> Thank you
>
>
> "Frédéric Jouault" <frederic.jouault@univ-nantes.fr> escribió en el mensaje
> news:f75ap2$o4i$1@build.eclipse.org...
>> Hello,
>>
>> I have tried 'hello'.toSequence() on the latest version of ATL, and on the
>> (older) version available on the AMMA homepage:
>> http://www.sciences.univ-nantes.fr/lina/atl/atldemo/oclonlin e/?query=%27hello%27.toSequence%28%29
>>
>> It worked in both cases.
>>
>> Could you please try with another version of ATL (e.g., the latest),
>> and/or send us more information about the issue (e.g., the complete stack
>> trace)?
>>
>> Thanks.
>>
>>
>> Regards,
>>
>> Frédéric Jouault
>>
>>
>> Bea wrote:
>>> Hello,
>>> I am trying to convert a string into a Sequence. I use the toSequence
>>> operator (varSequence = varString.toSequence()), but I get the
>>> java.lang.NullPointerException. I have also tried with
>>> 'hello'.toSequence() and I get the same error.
>>> I have seen the post
>>> http://www.sciences.univ-nantes.fr/lina/atl/www/atl_discussi on_archive/0695.html
>>> but I don't know how to use recursion in ATL without a collection.
>>> can anybody help my?
>>> Thank you in advance.
>>>
>>>
>>>
>
Re: [ATL]Problem with toSequence operator [message #52308 is a reply to message #52280] Thu, 12 July 2007 15:29 Go to previous message
beaperez Mising name is currently offline beaperez Mising nameFriend
Messages: 81
Registered: July 2009
Member
Thank you Frederic, it works (althought I have had to redefine the helper
without defining a context and adding the string as the parameter).

"Fr
Previous Topic:[ATL]: Installation from source
Next Topic:[ATL]println() in declarative expressions?
Goto Forum:
  


Current Time: Wed Apr 24 18:44:28 GMT 2024

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

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

Back to the top