Hello,
The program below works as indicated by Guillaume if the multiplicity is
0..1.
However the returnResult has the multiplicity 0..n which means that it is
represented by a collection. You need to test if the collection is empty,
and not if the collection is null.
Try to use ->size()=0
Cheers,
Peter
-----Message d'origine-----
De : Berge Stillingen [mailto:berges@ifi.uio.no]
Envoyé : mardi 1 février 2005 10:42
À : atl_discussion@yahoogroups.com
Objet : Re: [atl_discussion] UML2 transformation
Guillaume Savaton wrote:
> Berge Stillingen a écrit :
>
> >helper context UML2!Operation def:getReturnType() : String =
> >if self.returnResult = null then
> >
> >
> try this :
>
> if self.returnResult.oclIsUndefined() then
>
>
> --
> Guillaume Savaton
>
Thanks for the tip, Guillaume, but it doesn't seem to work. Well, the
transformation runs without any exceptions, but it doesn't return the
result I want.
When I use:
helper context UML2!Operation def: getReturnType() : String =
if self.returnResult.oclIsUndefined() then
'void'
else
'String' -- temporary for testing
endif
;
It always returns 'String', even though I have an operation without a
return result/parameter in my source model:
<ownedOperation name="doNothing"/>
I've tried replacing 'returnResult' with 'ownedParameter' to test that,
as well. It returns the same result.
Any other ideas?
Thanks again.
Berge Stillingen
Yahoo! Groups Links
Received on Tue Feb 01 02:41:03 2005
This archive was generated by hypermail 2.1.8 : Thu Jan 18 2007 - 15:04:54 CET