add a value to package [message #475891] |
Fri, 14 September 2007 13:22 |
Eclipse User |
|
|
|
Originally posted by: nickkirtley.gmail.com
hi,
I want to add an integer value to a package, to work as a kind of layer
number, so that I know which layer the package is in.
I then want to use this information in an ocl query. How can I add an
integer value to a package to do this? If it's even possible. A work
around is also welcome.
regards,
Nick
|
|
|
Re: add a value to package [message #475894 is a reply to message #475891] |
Fri, 14 September 2007 13:51 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Nick,
It sounds like you have an application that wants use this number for some
kind of model analysis/transformation. The usual way to do this is to
define a Stereotype, such as "Layer", that extends the Package metaclass
and to define a "level : Integer" or some such property on the stereotype.
An OCL query in the context of the Package metaclass, then, can do something
like:
let layerNum : Integer =
if self.extension_Layer.oclIsUndefined() then 0 else
self.extension_Layer.level endif
in
-- do something with "layerNum" here
Note that this requires the UML environment implementation, not Ecore:
org.eclipse.ocl.uml.UMLEnvironmentFactory.
HTH,
Christian
nick kirtley wrote:
> hi,
>
> I want to add an integer value to a package, to work as a kind of layer
> number, so that I know which layer the package is in.
> I then want to use this information in an ocl query. How can I add an
> integer value to a package to do this? If it's even possible. A work
> around is also welcome.
>
> regards,
>
> Nick
|
|
|
Re: add a value to package [message #475897 is a reply to message #475891] |
Fri, 14 September 2007 14:15 |
Eclipse User |
|
|
|
Originally posted by: nickkirtley.gmail.com
hi,
I think a different approach is need.
What I want is a stereotype that extends package. I want that stereotype
to have a value, ie an integer, and then when I apply the stereotype to
package, I want to add a value to that instance of the stereotype. That
way I can add a layer value.
Question is how can I do this?
Nick
|
|
|
Re: add a value to package [message #624786 is a reply to message #475891] |
Fri, 14 September 2007 13:51 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Nick,
It sounds like you have an application that wants use this number for some
kind of model analysis/transformation. The usual way to do this is to
define a Stereotype, such as "Layer", that extends the Package metaclass
and to define a "level : Integer" or some such property on the stereotype.
An OCL query in the context of the Package metaclass, then, can do something
like:
let layerNum : Integer =
if self.extension_Layer.oclIsUndefined() then 0 else
self.extension_Layer.level endif
in
-- do something with "layerNum" here
Note that this requires the UML environment implementation, not Ecore:
org.eclipse.ocl.uml.UMLEnvironmentFactory.
HTH,
Christian
nick kirtley wrote:
> hi,
>
> I want to add an integer value to a package, to work as a kind of layer
> number, so that I know which layer the package is in.
> I then want to use this information in an ocl query. How can I add an
> integer value to a package to do this? If it's even possible. A work
> around is also welcome.
>
> regards,
>
> Nick
|
|
|
Re: add a value to package [message #624789 is a reply to message #475891] |
Fri, 14 September 2007 14:15 |
Eclipse User |
|
|
|
Originally posted by: nickkirtley.gmail.com
hi,
I think a different approach is need.
What I want is a stereotype that extends package. I want that stereotype
to have a value, ie an integer, and then when I apply the stereotype to
package, I want to add a value to that instance of the stereotype. That
way I can add a layer value.
Question is how can I do this?
Nick
|
|
|
Powered by
FUDForum. Page generated in 0.04256 seconds