Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » EDataType and '<' operation in OCL expression
EDataType and '<' operation in OCL expression [message #21447] Tue, 07 February 2006 17:07 Go to next message
Radomil Dvorak is currently offline Radomil DvorakFriend
Messages: 249
Registered: July 2009
Senior Member
Hi,

Is '<' operation defined for EDataType which points by
EDataType::instanceClass to a java class which
implements Comparable?
As mentioned in the thread 'order of returned items', the 'sortedBy'
operation on collections implemented by EMFT
understands the definition of '<' operation as implementation of
'java.lang.Comparable' interface.

It works for me in the following example with use of ecore::EDate:
This is the context classifier described in emfatic source.
class Topic {
attr String[1] name;
attr Date startDate;
attr Date endDate;
}

1) the following expression works fine and is evaluated by using
'java.util.Date.compareTo'.
Bag { startDate, endDate }->sortedBy(d|d)->last() = endDate

2) but the expression below fails with: "AnyType: the source of operation:
(lessThan) must be an EClass"
startDate < endDate

Am I wrong to expect that if '<' was found as defined in 'sortedBy' it
should be resolved also in the second expression?

Regards,
/Radek
Re: EDataType and '<' operation in OCL expression [message #21463 is a reply to message #21447] Tue, 07 February 2006 23:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Radek,

You should absolutely expect that '<', '>', '<=', and '>=' would be
supported for EDataTypes implementing the Comparable interface. As I read
the OCL spec, any OCL type (including types defined by a model) should be
able to define these infix operations (also arithmetic and boolean
operations, but that's another matter).

Sounds like a bug!

Cheers,

Christian


Radek Dvorak wrote:

> Hi,
>
> Is '<' operation defined for EDataType which points by
> EDataType::instanceClass to a java class which
> implements Comparable?
> As mentioned in the thread 'order of returned items', the 'sortedBy'
> operation on collections implemented by EMFT
> understands the definition of '<' operation as implementation of
> 'java.lang.Comparable' interface.
>
> It works for me in the following example with use of ecore::EDate:
> This is the context classifier described in emfatic source.
> class Topic {
> attr String[1] name;
> attr Date startDate;
> attr Date endDate;
> }
>
> 1) the following expression works fine and is evaluated by using
> 'java.util.Date.compareTo'.
> Bag { startDate, endDate }->sortedBy(d|d)->last() = endDate
>
> 2) but the expression below fails with: "AnyType: the source of operation:
> (lessThan) must be an EClass"
> startDate < endDate
>
> Am I wrong to expect that if '<' was found as defined in 'sortedBy' it
> should be resolved also in the second expression?
>
> Regards,
> /Radek
Re: EDataType and '<' operation in OCL expression [message #21472 is a reply to message #21463] Wed, 08 February 2006 08:47 Go to previous message
Radomil Dvorak is currently offline Radomil DvorakFriend
Messages: 249
Registered: July 2009
Senior Member
I have raised https://bugs.eclipse.org/bugs/show_bug.cgi?id=126872

Thanks,
/Radek

"Christian W. Damus" <cdamus@ca.ibm.com> wrote in message
news:dsbbcq$u77$1@utils.eclipse.org...
>
> Hi, Radek,
>
> You should absolutely expect that '<', '>', '<=', and '>=' would be
> supported for EDataTypes implementing the Comparable interface. As I read
> the OCL spec, any OCL type (including types defined by a model) should be
> able to define these infix operations (also arithmetic and boolean
> operations, but that's another matter).
>
> Sounds like a bug!
>
> Cheers,
>
> Christian
>
>
> Radek Dvorak wrote:
>
>> Hi,
>>
>> Is '<' operation defined for EDataType which points by
>> EDataType::instanceClass to a java class which
>> implements Comparable?
>> As mentioned in the thread 'order of returned items', the 'sortedBy'
>> operation on collections implemented by EMFT
>> understands the definition of '<' operation as implementation of
>> 'java.lang.Comparable' interface.
>>
>> It works for me in the following example with use of ecore::EDate:
>> This is the context classifier described in emfatic source.
>> class Topic {
>> attr String[1] name;
>> attr Date startDate;
>> attr Date endDate;
>> }
>>
>> 1) the following expression works fine and is evaluated by using
>> 'java.util.Date.compareTo'.
>> Bag { startDate, endDate }->sortedBy(d|d)->last() = endDate
>>
>> 2) but the expression below fails with: "AnyType: the source of
>> operation:
>> (lessThan) must be an EClass"
>> startDate < endDate
>>
>> Am I wrong to expect that if '<' was found as defined in 'sortedBy' it
>> should be resolved also in the second expression?
>>
>> Regards,
>> /Radek
>
Re: EDataType and '<' operation in OCL expression [message #566198 is a reply to message #21447] Tue, 07 February 2006 23:44 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Radek,

You should absolutely expect that '<', '>', '<=', and '>=' would be
supported for EDataTypes implementing the Comparable interface. As I read
the OCL spec, any OCL type (including types defined by a model) should be
able to define these infix operations (also arithmetic and boolean
operations, but that's another matter).

Sounds like a bug!

Cheers,

Christian


Radek Dvorak wrote:

> Hi,
>
> Is '<' operation defined for EDataType which points by
> EDataType::instanceClass to a java class which
> implements Comparable?
> As mentioned in the thread 'order of returned items', the 'sortedBy'
> operation on collections implemented by EMFT
> understands the definition of '<' operation as implementation of
> 'java.lang.Comparable' interface.
>
> It works for me in the following example with use of ecore::EDate:
> This is the context classifier described in emfatic source.
> class Topic {
> attr String[1] name;
> attr Date startDate;
> attr Date endDate;
> }
>
> 1) the following expression works fine and is evaluated by using
> 'java.util.Date.compareTo'.
> Bag { startDate, endDate }->sortedBy(d|d)->last() = endDate
>
> 2) but the expression below fails with: "AnyType: the source of operation:
> (lessThan) must be an EClass"
> startDate < endDate
>
> Am I wrong to expect that if '<' was found as defined in 'sortedBy' it
> should be resolved also in the second expression?
>
> Regards,
> /Radek
Re: EDataType and '<' operation in OCL expression [message #566253 is a reply to message #21463] Wed, 08 February 2006 08:47 Go to previous message
Radomil Dvorak is currently offline Radomil DvorakFriend
Messages: 249
Registered: July 2009
Senior Member
I have raised https://bugs.eclipse.org/bugs/show_bug.cgi?id=126872

Thanks,
/Radek

"Christian W. Damus" <cdamus@ca.ibm.com> wrote in message
news:dsbbcq$u77$1@utils.eclipse.org...
>
> Hi, Radek,
>
> You should absolutely expect that '<', '>', '<=', and '>=' would be
> supported for EDataTypes implementing the Comparable interface. As I read
> the OCL spec, any OCL type (including types defined by a model) should be
> able to define these infix operations (also arithmetic and boolean
> operations, but that's another matter).
>
> Sounds like a bug!
>
> Cheers,
>
> Christian
>
>
> Radek Dvorak wrote:
>
>> Hi,
>>
>> Is '<' operation defined for EDataType which points by
>> EDataType::instanceClass to a java class which
>> implements Comparable?
>> As mentioned in the thread 'order of returned items', the 'sortedBy'
>> operation on collections implemented by EMFT
>> understands the definition of '<' operation as implementation of
>> 'java.lang.Comparable' interface.
>>
>> It works for me in the following example with use of ecore::EDate:
>> This is the context classifier described in emfatic source.
>> class Topic {
>> attr String[1] name;
>> attr Date startDate;
>> attr Date endDate;
>> }
>>
>> 1) the following expression works fine and is evaluated by using
>> 'java.util.Date.compareTo'.
>> Bag { startDate, endDate }->sortedBy(d|d)->last() = endDate
>>
>> 2) but the expression below fails with: "AnyType: the source of
>> operation:
>> (lessThan) must be an EClass"
>> startDate < endDate
>>
>> Am I wrong to expect that if '<' was found as defined in 'sortedBy' it
>> should be resolved also in the second expression?
>>
>> Regards,
>> /Radek
>
Previous Topic:EDataType and '<' operation in OCL expression
Next Topic:CDO performance problems
Goto Forum:
  


Current Time: Mon Sep 26 10:33:30 GMT 2022

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

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

Back to the top