|
Re: OCL expression for return type [message #56761 is a reply to message #56653] |
Mon, 26 May 2008 13:22 |
Eclipse User |
|
|
|
Originally posted by: cdamus.zeligsoft.com
Hi, tm,
This is one of those points where the OCL and UML specifications don't
agree on the definition of operation bodies.
The OCL specification of an operation body condition constraint is:
context core::A::foo() : String
self.name
In UML, all constraints are required to be boolean-valued, which is why
UML requires the "result = " part that makes it look like a
post-condition constraint.
HTH,
Christian
On Sun, 2008-05-25 at 12:32 +0200, Timothy Marc wrote:
> Hi all,
>
> i've read the parts of OCL Specification that deals with the return type
> of an Operation. IMHO, this section is a bit confusing, so i think i
> didn't get it at all.
>
> I have an Operation foo in class A, which should return the property
> name of that class. Now, i want to add this as a constraint into my uml
> model with value:
>
> context core::A::foo:String() result = self.name
>
> Does this mean the same as in-code:
>
> class A{
> String name;
> String foo(){
> return this.name;
> }
> }
>
> Thx
>
> -tm
|
|
|
Powered by
FUDForum. Page generated in 0.03132 seconds