Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] error in definition of Set
[Acceleo] error in definition of Set [message #1411819] Sun, 24 August 2014 14:42 Go to next message
tahereh adamzadeh is currently offline tahereh adamzadehFriend
Messages: 6
Registered: December 2013
Junior Member
Hi
I have a problem with definition of Set or variable.
In the following code:
---------------------
[template public generateElement(d : DangerClass){ a:Set(AgentClass)=Set{};}]
[comment @main/]
[file (d.name + '.java', false, 'UTF-8')]
[for (h:Hazard | d.ownedHazard)]
[for (e:Element | h.entity) ]
[if (e.oclIsKindOf(AgentClass)) {a->including(e);}][/if]
[/for]
[/for]
[/file]
[/template]
---------------
the error ". expected instead of {" is shown.(Line 6)
If I write "[for (e:Element | h.entity) {a->including(e);}]" the error "variable a->including(e); is not valid" will be displayed.
I want to define a set ("a" as Set(AgentClass)) that "a" includes agents and I don`t want to print something.But I want to store agents in a set.
Can anyone help me?
Thanks
Re: [Acceleo] error in definition of Set [message #1413127 is a reply to message #1411819] Wed, 27 August 2014 21:40 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7675
Registered: July 2009
Senior Member
Hi

You might get a much faster response if you provided an executable repro.

The ". expected instead of {" is very accurate. There is no syntax that
allows a { in an [/if clause.

You appear to have completely misunderstood the purpose of Acceleo. It
is a declarative Model to Text language.

You seem to want an imperative model query language. Try
Java/Xtend/QVTo/ATL/...

Regards

Ed Willink


On 24/08/2014 15:42, tahereh adamzadeh wrote:
> Hi I have a problem with definition of Set or variable.
> In the following code:
> ---------------------
> [template public generateElement(d : DangerClass){
> a:Set(AgentClass)=Set{};}]
> [comment @main/]
> [file (d.name + '.java', false, 'UTF-8')]
> [for (h:Hazard | d.ownedHazard)]
> [for (e:Element | h.entity) ]
> [if (e.oclIsKindOf(AgentClass)) {a->including(e);}][/if]
> [/for]
> [/for]
> [/file]
> [/template]
> ---------------
> the error ". expected instead of {" is shown.(Line 6)
> If I write "[for (e:Element | h.entity) {a->including(e);}]" the error
> "variable a->including(e); is not valid" will be displayed.
> I want to define a set ("a" as Set(AgentClass)) that "a" includes agents
> and I don`t want to print something.But I want to store agents in a set.
> Can anyone help me?
> Thanks
Previous Topic:[Acceleo] cannot access the attributes of a uml interface
Next Topic:[Acceleo] Problems with Builder in Kepler
Goto Forum:
  


Current Time: Sun Oct 06 10:47:56 GMT 2024

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

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

Back to the top