Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of '<', '>', '<=', '>=' operations on EDataType through java.lang.Comparable #37

Closed
eclipse-ocl-bot opened this issue Sep 18, 2024 · 4 comments

Comments

@eclipse-ocl-bot
Copy link
Collaborator

| --- | --- |
| Bugzilla Link | 126872 |
| Status | CLOSED FIXED |
| Importance | P3 normal |
| Reported | Feb 08, 2006 03:39 EDT |
| Modified | May 27, 2011 02:40 EDT |
| Reporter | Radomil Dvorak |

Description

Excerpt from 'eclipse.technology.emft',
thread: 'EDataType and '<' operation in OCL expression'

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:

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?

@eclipse-ocl-bot
Copy link
Collaborator Author

By Christian Damus on Apr 05, 2006 15:23

Committed support for Comparables.

@eclipse-ocl-bot
Copy link
Collaborator Author

By Nick Boldt on Jan 28, 2008 16:35

Move to verified as per bug 206558.

@eclipse-ocl-bot
Copy link
Collaborator Author

By Ed Willink on May 27, 2011 02:38

Closing after over a year in verified state.

@eclipse-ocl-bot
Copy link
Collaborator Author

By Ed Willink on May 27, 2011 02:40

Closing after over a year in verified state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant