Skip to main content



      Home
Home » Archived » M2M (model-to-model transformation) » Collecting elements from called rule
Collecting elements from called rule [message #103017] Tue, 07 April 2009 08:03 Go to next message
Eclipse UserFriend
Hello,

I am trying to create new model elements in a called rule. I read that I
cannot collect them using 'resolveTemp()' in
( http://dev.eclipse.org/newslists/news.eclipse.modeling.m2m/m sg02367.html).
Is there another way to collect these elements?



I added the code of my called rules below. They are used to recursively
create model elements (a state and a transition) for each element in a
list.


rule splitTransition(t_in: slco!Transition, s:
Sequence(Sequence(slco!Statement))){
using{
s_head: Sequence(slco!Statement) = s.first();
s_tail: Sequence(Sequence(slco!Statement)) = s.subSequence(1,
s.size()-1);
}
to t_out: slco!Transition(
name <- t_in.name,
source <- t_in.source,
trigger <- t_in.trigger,
guard <- t_in.guard,
effect <- s_head
)
do{
if s_tail.size() > 0
then thisModule.splitTransitionRecurse(t_out, t_in.target, s_tail)
else thisModule.splitTransitionEnd(t_out, t_in.target)
endif;
}
}

rule splitTransitionRecurse(t_in: slco!Transition, target_state:
slco!State, s: Sequence(Sequence(slco!Statement))){
using{
s_head: Sequence(slco!Statement) = s.first();
s_tail: Sequence(Sequence(slco!Statement)) = s.subSequence(1,
s.size()-1);
}
to s_out: slco!State(
incoming <- t_in,
outgoing <- t1_out
),
t1_out: slco!Transition(
source <- s_out,
effect <- s_head
)
do{
thisModule.stateId <- thisModule.stateId + 1;
s_out.name <- 'Split_State_' +
thisModule.stateId.toString();
thisModule.transitionId <- thisModule.transitionId + 1;
t1_out.name <- 'Split_Transition_' +
thisModule.transitionId.toString();

if s_tail.size() > 0
then thisModule.splitTransitionRecurse(t1_out, t_in.target, s_tail)
else thisModule.splitTransitionEnd(t1_out, t_in.target)
endif;
}
}

rule splitTransitionEnd(t_in: slco!Transition, target_state: slco!State){
do{
t_in.target <- target_state;
}
}
[ATL] Re: Collecting elements from called rule [message #103035 is a reply to message #103017] Tue, 07 April 2009 08:05 Go to previous message
Eclipse UserFriend
Sorry, forgot the ATL prefix in the subject.
Previous Topic:[ATL] Where is the "Apply" profile or stereotype example
Next Topic:[QVTO]Clone Operation
Goto Forum:
  


Current Time: Sun May 11 22:49:54 EDT 2025

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

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

Back to the top