[ATL] Problems with TupleType [message #50270] |
Mon, 02 July 2007 04:44  |
Eclipse User |
|
|
|
Originally posted by: francopinchetti.yahoo.it
Hello everybody,
I'm writing an ATL transformation in which I'm using the TupleType data
type. I want to create a Sequence of TupleType(mpn : String, slot : Integer,
freeslot : Integer). I have a called rule like this:
rule SecondFunction(mcs : Sequence(TupleType(mpn : String, slot : Integer,
freeslot : Integer))) {
do {
for (cp in .) {
cp.multiplicityCoupleSerializzation().toString().concat('
debug row 1').println(); -- debug row n. 1
mcs->append(cp.multiplicityCoupleSerializzation());
mcs.toString().concat(' debug row 2').println(); -- debug row
n. 2
}
}
}
And that's the helper multiplicityCoupleSerializzation():
helper context ModelFragmentMM!Couple def :
multiplicityCoupleSerializzation() : TupleType(mpn : String, slot : Integer,
freeslot : Integer) =
if (.) then
let sl : Integer = . in
Tuple{mpn = self.propName, slot = sl, freeslot = sl}
else
Tuple{}
endif
;
When I lunch the transformation the console says:
Tuple {freeslot = 1, slot = 1, mpn = '.'} debug row 1
Sequence {} debug row 2
..
Why the append operation on mcs don't work? And why the Tuple returned by
multiplicityCoupleSerializzation() has a different component order compared
to the helper declaration?
Thank you very much
Franco
|
|
|
Re: [ATL] Problems with TupleType [message #50300 is a reply to message #50270] |
Mon, 02 July 2007 05:08   |
Eclipse User |
|
|
|
Hi Franco,
Franco wrote:
> Hello everybody,
>
> I'm writing an ATL transformation in which I'm using the TupleType data
> type. I want to create a Sequence of TupleType(mpn : String, slot : Integer,
> freeslot : Integer). I have a called rule like this:
>
>
>
> rule SecondFunction(mcs : Sequence(TupleType(mpn : String, slot : Integer,
> freeslot : Integer))) {
>
> do {
>
> for (cp in .) {
>
> cp.multiplicityCoupleSerializzation().toString().concat('
> debug row 1').println(); -- debug row n. 1
>
> mcs->append(cp.multiplicityCoupleSerializzation());
>
> mcs.toString().concat(' debug row 2').println(); -- debug row
> n. 2
>
> }
>
> }
>
> }
>
>
>
> And that's the helper multiplicityCoupleSerializzation():
>
>
>
> helper context ModelFragmentMM!Couple def :
> multiplicityCoupleSerializzation() : TupleType(mpn : String, slot : Integer,
> freeslot : Integer) =
>
> if (.) then
>
> let sl : Integer = . in
>
> Tuple{mpn = self.propName, slot = sl, freeslot = sl}
>
> else
>
> Tuple{}
>
> endif
>
> ;
>
>
>
> When I lunch the transformation the console says:
>
>
>
> Tuple {freeslot = 1, slot = 1, mpn = '.'} debug row 1
>
> Sequence {} debug row 2
>
> .
>
>
>
> Why the append operation on mcs don't work? And why the Tuple returned by
> multiplicityCoupleSerializzation() has a different component order compared
> to the helper declaration?
The append operation has a return type (mcs <- mcs->append(...)).
And the Tuple type is not ordered.
See the ATL User Manual for more details on append() operation and Tuple
data type.
>
>
>
> Thank you very much
>
> Franco
>
>
>
--
Éric Vépa
SODIUS
6, rue de la Cornouaille - BP 91941
44319 Nantes, France
Email: evepa@sodius.com
www.mdworkbench.com
Draw more value from your models
|
|
|
|
Powered by
FUDForum. Page generated in 0.04902 seconds