Composite Class [message #37346] |
Sat, 12 May 2007 00:58 |
Eclipse User |
|
|
|
Originally posted by: mpitanga.gmail.com
Hi,
I have the following situation:
Class A {
method1,
method2
}
Class B {
method3,
method4
}
and I need to create a third Class, for example:
Class C {
method1, // copy from Class A
method2, // copy from Class A
method3, // copy from Class B
method4 // copy from Class B
}
ps. Class A and Class B belong to the same model.
In the end of the transformation process my model will have 3 classes
Class A {
method1,
method2
}
Class B {
method3,
method4
}
Class C {
method1, // copy from Class A
method2, // copy from Class A
method3, // copy from Class B
method4 // copy from Class C
}
has someone an example?
Thanks
|
|
|
[ATL] Re: Composite Class [message #37380 is a reply to message #37346] |
Sat, 12 May 2007 10:42 |
Eclipse User |
|
|
|
Originally posted by: mpitanga.gmail.com
"Marcelo Alves" <mpitanga@gmail.com> wrote in message
news:f233ea$j4a$1@build.eclipse.org...
> Hi,
>
> I have the following situation:
>
> Class A {
> method1,
> method2
> }
>
> Class B {
> method3,
> method4
> }
>
> and I need to create a third Class, for example:
>
> Class C {
> method1, // copy from Class A
> method2, // copy from Class A
> method3, // copy from Class B
> method4 // copy from Class B
> }
>
> ps. Class A and Class B belong to the same model.
>
> In the end of the transformation process my model will have 3 classes
>
> Class A {
> method1,
> method2
> }
>
> Class B {
> method3,
> method4
> }
>
> Class C {
> method1, // copy from Class A
> method2, // copy from Class A
> method3, // copy from Class B
> method4 // copy from Class C
> }
>
> has someone an example?
>
> Thanks
>
>
|
|
|
Re: [ATL] Re: Composite Class [message #37482 is a reply to message #37380] |
Mon, 14 May 2007 10:10 |
Eclipse User |
|
|
|
Originally posted by: rchevrel.sodius.com
I Marcello,
I'm not sure to completely understand what you want to do but you can try:
-----------------------------------
-- to keep the existing classes
rule ClassToClass {
from
in_cls : MMa!Class
to
out_cls : MMa!Class (
methods <- in_cls.methods...
)
}
-----------------------------------
-- to create the composites classes
rule ClassToComposite {
from
in_cls1 : MMa!Class,
in_cls2 : MMa:Class (
cls1 <> cls2
)
to
out_comp_cls : MMa!Class (
methods <- in_cls1.methods->union(in_cls2.methods)...
)
}
-----------------------------------
rule MethodToMethod {
....
}
-----------------------------------
It can work only if MMA!Class.methods is not a container feature
(because an element cannot be contained by two element).
If it is a container feature, you have to duplicate the "method"
(probably with a CalledRule). Send a mail more precise if you have some
problems.
Cordially,
*Régis CHEVREL* <mailto:rchevrel@sodius.com>
SODIUS*
*6, rue Cornouaille
44319 Nantes - France
Phone: +33 (0)2 28 23 54 34
***www.mdworkbench.com* <http://www.mdworkbench.com/>* *
Draw more value from your model
|
|
|
Re: [ATL] Re: Composite Class [message #37515 is a reply to message #37482] |
Mon, 14 May 2007 12:13 |
Eclipse User |
|
|
|
Originally posted by: mpitanga.gmail.com
Hi Régis,
Thank you for reply
You said:
"It can work only if MMA!Class.methods is not a container feature (because
an element cannot be contained by two element).
If it is a container feature, you have to duplicate the "method" (probably
with a CalledRule). "
and this is my problem.
is possible duplicate a container feature and to point for another class?
Thanks,
Marcelo
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03507 seconds