eclipse-ocl / org.eclipse.ocl

Eclipse Public License 2.0
0 stars 0 forks source link

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

Closed eclipse-ocl-bot closed 1 month ago

eclipse-ocl-bot commented 1 month ago

| --- | --- | | 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 commented 1 month ago

By Christian Damus on Apr 05, 2006 15:23

Committed support for Comparables.

eclipse-ocl-bot commented 1 month ago

By Nick Boldt on Jan 28, 2008 16:35

Move to verified as per bug 206558.

eclipse-ocl-bot commented 1 month ago

By Ed Willink on May 27, 2011 02:38

Closing after over a year in verified state.

eclipse-ocl-bot commented 1 month ago

By Ed Willink on May 27, 2011 02:40

Closing after over a year in verified state.