Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » what will be the return type for evaluation of different types of Ocl expression
what will be the return type for evaluation of different types of Ocl expression [message #16663] Fri, 27 January 2006 04:08 Go to next message
Shrawanika is currently offline ShrawanikaFriend
Messages: 12
Registered: July 2009
Junior Member
Hi,

How can we know that what will be the return type for
evaluation of different types of Ocl expressions like -

evaluate(context,"self.name") : returns String

evaluate(context,"self.attribute->size()") : returns Integer

evaluate(context,"self.attribute.name") : returns Bag

evaluate(context,"self.attribute") : returns EList of Objects

Here the return type String or Integer can be known but what
about the different collection types like when it is going to return a Bag
or when it is going to be a EList return type? Where we can find this?

Thanks and Regards,
Shrawanika
Re: what will be the return type for evaluation of different types of Ocl expression [message #18127 is a reply to message #16663] Fri, 27 January 2006 13:25 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Shrawanika,

The mappings of OCL collections to Java collections is as follows:

OCL Sequence ==> Java List
OCL Set ==> Java Set
OCL OrderedSet ==> Java LinkedHashSet
OCL Bag ==> Java Collection

Note that, in the LinkedHashSet case, it is still good Java policy just to
treat it as a Set because we want to be free to use a different
implementation if/when one comes along (e.g., if EMF were to create an
EOrderedSet).

For multiplicity-many EStructuralFeatures and EOperations, we map their
ETypes to OCL collection types as follows:

isMany isOrdered isUnique ==> OCL OrderedSet
isMany isOrdered !isUnique ==> OCL Sequence
isMany !isOrdered isUnique ==> OCL Set
isMany !isOrdered !isUnique ==> OCL Bag

Cheers,

Christian


Shrawanika wrote:

> Hi,
>
> How can we know that what will be the return type for
> evaluation of different types of Ocl expressions like -
>
> evaluate(context,"self.name") : returns String
>
> evaluate(context,"self.attribute->size()") : returns Integer
>
> evaluate(context,"self.attribute.name") : returns Bag
>
> evaluate(context,"self.attribute") : returns EList of
> Objects
>
> Here the return type String or Integer can be known but what
> about the different collection types like when it is going to return a Bag
> or when it is going to be a EList return type? Where we can find this?
>
> Thanks and Regards,
> Shrawanika
Re: what will be the return type for evaluation of different types of Ocl expression [message #564455 is a reply to message #16663] Fri, 27 January 2006 13:25 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Shrawanika,

The mappings of OCL collections to Java collections is as follows:

OCL Sequence ==> Java List
OCL Set ==> Java Set
OCL OrderedSet ==> Java LinkedHashSet
OCL Bag ==> Java Collection

Note that, in the LinkedHashSet case, it is still good Java policy just to
treat it as a Set because we want to be free to use a different
implementation if/when one comes along (e.g., if EMF were to create an
EOrderedSet).

For multiplicity-many EStructuralFeatures and EOperations, we map their
ETypes to OCL collection types as follows:

isMany isOrdered isUnique ==> OCL OrderedSet
isMany isOrdered !isUnique ==> OCL Sequence
isMany !isOrdered isUnique ==> OCL Set
isMany !isOrdered !isUnique ==> OCL Bag

Cheers,

Christian


Shrawanika wrote:

> Hi,
>
> How can we know that what will be the return type for
> evaluation of different types of Ocl expressions like -
>
> evaluate(context,"self.name") : returns String
>
> evaluate(context,"self.attribute->size()") : returns Integer
>
> evaluate(context,"self.attribute.name") : returns Bag
>
> evaluate(context,"self.attribute") : returns EList of
> Objects
>
> Here the return type String or Integer can be known but what
> about the different collection types like when it is going to return a Bag
> or when it is going to be a EList return type? Where we can find this?
>
> Thanks and Regards,
> Shrawanika
Previous Topic:Getting some parsing exceptions.....
Next Topic:Antlr Dependency
Goto Forum:
  


Current Time: Thu Sep 29 21:32:48 GMT 2022

Powered by FUDForum. Page generated in 0.02005 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top