OCL 2.0's commonSuperType and multiple inheritance



Date view Thread view Subject view Author view Attachment view

From: Joachim Hoessler (hoessler@cs.tu-berlin.de)
Date: Fri 05 Dec 2003 - 01:11:18 GMT


Hello!

I'm a little bit confused about the definition of the operation
commonSuperType in the latest version of OCL 2.0, p. 56:

context Classifier
def: commonSuperType (c : Classifier) : Classifier =
  Classifier.allInstances()->select (cst |
    c.conformsTo (cst) and
    self.conformsTo (cst) and
    not Classifier.allInstances()->exists (clst |
      c.conformsTo (clst) and
      self.conformsTo (clst) and
      clst.conformsTo (cst) and
      clst <> cst
     )
  )->any (true)

For example, suppose we had a class X which derives from class A and B,
and another class Y, also deriving from class A and B. According to the
definition above, the common supertype of X and Y would be either A or B?
I think it would be more precise to define commonSupertype as the most
specific but unique common supertype. That would be OclAny in the example
above.

Or am I missing something?

Regards,
Joachim Hoessler

Date view Thread view Subject view Author view Attachment view