Generate Multiple Elementshttps://www.eclipse.org/forums/index.php/mv/msg/474693/1039633/#msg_1039633
don't know how to define my rule . I want to get the file like:
<place name="a",id="1",ref="....">
<place name="b",id="2",ref="....">
<place name="c",id="3",ref="....">
The number of generated place elements was determined by the value of
atrribute capacity of source element.The reference need intialized with
other pattern element .
rule{
from s;MM!node
to t1:NN!place(
.........
)

}
How to define this rule?
Look forward to your reply!
]]>yesheng chai2013-04-12T11:38:09-00:00Re: Generate Multiple Elementshttps://www.eclipse.org/forums/index.php/mv/msg/474693/1039810/#msg_1039810
The order of the Place elements are not going to be determined by the NodeToPlace rule, it is only creating a Place out of a Node as it has to be.
This order is going to be determined by the reference (in another model element) that will actually "contain" these Place elements.
For instance:

xxx has a attribute cap.If the value of cap is 2,I want to get like:
<YYY ....>
<YYY ....>
If the value of cap is 3,I want to get like:
<YYY ....>
<YYY ....>
<YYY ....>
The value of cap is determined by input file.
How to define my rule?]]>yesheng chai2013-04-13T12:05:00-00:00Re: Generate Multiple Elementshttps://www.eclipse.org/forums/index.php/mv/msg/474693/1041992/#msg_1041992
In that specific case, you can use a (unique) lazy rule that you can call multiple times as explained from http://wiki.eclipse.org/ATL/User_Guide_-_The_ATL_Language#Lazy_Rules.
However, note that the preferred type of rule in ATL is matched rules and that so-called lazy rules have to be used only when actually needed.

Best regards,

Hugo]]>Hugo Bruneliere2013-04-15T21:31:25-00:00Re: Generate Multiple Elementshttps://www.eclipse.org/forums/index.php/mv/msg/474693/1042084/#msg_1042084
Can you reply to the post whose name is "no one knows how to solve this problem" ?]]>yesheng chai2013-04-16T01:02:16-00:00