| Getting value from a reference [message #1598] | 
Mon, 18 December 2006 15:44   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: dorazio.nicola.yahoo.it 
 
Hi all, 
I have this km3 classes: 
 
class ServiceCall extends Activity { 
        reference calledService[0-1] : Service oppositeOf serviceCall; 
    } 
 
 
class State { 
        attribute name[0-1] : String; 
        attribute refersTo: String; 
    } 
 
now I need to modify this rule: 
 
rule activity2state 
{ 
    from 
      astep: Klaper!Activity (astep.internalFailProb='0') 
      using{ 
               list: Sequence(Klaper!Behavior) = astep.getSCBehaviorType(); 
       } 
         to 
      state: DTMP!State (name<-astep.name, 
                         refersTo<-'TEST', 
                         dtmp<-thisModule.resolveTemp(astep.behavior,  
'dtmp'), 
} 
 
 
because I want to write inside the refersTo variable the value of the  
reference calledService. How can I do this? 
 
Thanks to all 
 
Best regard 
 
Nicola D'Orazio
 |  
 |  
  | 
| Re: [ATL] Getting value from a reference [message #4505 is a reply to message #1598] | 
Fri, 29 December 2006 03:40   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hi, 
 
Since your rule transforms an Activity and not a ServiceCall, you cannot  
do astep.calledService. You should do this in a rule matching a ServiceCall. 
 
If you use ATL 2006 (see http://wiki.eclipse.org/index.php/ATL_2006),  
then you can use rule inheritance: 
 
rule ServiceCAll2State extends activity2state { 
	from 
		astep : Klaper!ServiceCall 
	to 
	      state: DTMP!State ( 
                         refersTo<- astep.calledService 
		) 
} 
 
If you do not want to use ATL 2006 or rule inheritance, then you will  
have to modify your rule after having copied and pasted it if you want  
to keep a rule matching activities. 
 
 
Regards, 
 
Frédéric Jouault 
 
Nicola D'Orazio wrote: 
> Hi all, 
> I have this km3 classes: 
>  
> class ServiceCall extends Activity { 
>        reference calledService[0-1] : Service oppositeOf serviceCall; 
>    } 
>  
>  
> class State { 
>        attribute name[0-1] : String; 
>        attribute refersTo: String; 
>    } 
>  
> now I need to modify this rule: 
>  
> rule activity2state 
> { 
>    from 
>      astep: Klaper!Activity (astep.internalFailProb='0') 
>      using{ 
>               list: Sequence(Klaper!Behavior) = astep.getSCBehaviorType(); 
>       } 
>         to 
>      state: DTMP!State (name<-astep.name, 
>                         refersTo<-'TEST', 
>                         dtmp<-thisModule.resolveTemp(astep.behavior,  
> 'dtmp'), 
> } 
>  
>  
> because I want to write inside the refersTo variable the value of the  
> reference calledService. How can I do this? 
>  
> Thanks to all 
>  
> Best regard 
>  
> Nicola D'Orazio
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.03991 seconds