|
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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.02740 seconds