Home » Modeling » UML2 » UML and multiple/diamond inheritance
UML and multiple/diamond inheritance [message #475206] |
Thu, 23 August 2007 11:05  |
Eclipse User |
|
|
|
Hi newsgroup,
I'm working on a heavyweight extension of the UML metamodel.
So my problem is that I have the case in which two classes
called A and B inherit from uml::Class, and another class X is
inheriting from A and B. (Aka. diamond inheritance)
What happens in X, if a feature of uml::Class is redefined (and renamed)
only in A, but not in B? Are both features available?
( I'd like to have only the redefined one to be there in X! ;) )
Besides, is there a problem, if A as well as B contain features with
the same name and type?
Kind regards, Andreas
|
|
| |
Re: UML and multiple/diamond inheritance [message #475265 is a reply to message #475206] |
Tue, 28 August 2007 19:12  |
Eclipse User |
|
|
|
Andreas,
I would expect that only the redefinition of the feature (from A) is
"available" in X. If both A and B contain features with the same name/type,
I'd say that yes, you have a problem - this situation is best avoided in
general. In practice, this can perhaps be addressed by defining a new
feature (again with the same name and type) that redefines both of the
inherited features. Otherwise, the UML2 code generator will rename one of
the inherited features to make it distinct.
Note that mapping redefinitions to an implementation in a language like Java
isn't trivial; in the UML2 code generator, we've tried to support some of
the common scenarios (e.g. those found in UML itself), but I'm sure some
scenarios aren't being handled properly. If you run into problems, let us
know!
Kenn
"Andreas Werner" <andreas.werner@itso-berlin.de> wrote in message
news:a580138911d908c9b3bef5affd18@news.eclipse.org...
> Hi newsgroup,
> I'm working on a heavyweight extension of the UML metamodel.
> So my problem is that I have the case in which two classes called A and B
> inherit from uml::Class, and another class X is inheriting from A and B.
> (Aka. diamond inheritance)
>
> What happens in X, if a feature of uml::Class is redefined (and renamed)
> only in A, but not in B? Are both features available? ( I'd like to have
> only the redefined one to be there in X! ;) )
>
> Besides, is there a problem, if A as well as B contain features with the
> same name and type?
>
> Kind regards, Andreas
>
>
|
|
|
Re: UML and multiple/diamond inheritance [message #624526 is a reply to message #475206] |
Fri, 24 August 2007 11:13  |
Eclipse User |
|
|
|
Hi Andreas,
I think that whether both features are available in X would depend on the
properties of the features involved. If you look at
SequenceNode:executableNode redefining StructuredActivityNode:node. Both
are containment features and one redefines the other and both
executableNode and node are available in the specializing SequenceNode.
You can deal with features of identical name and type with the various
options you can pass to the merge process.
You might want to check out UMLUtil.isRedefinitionValid and experiment with
the "Different Property Uniqueness" and "Invalid Redefinitions" options.
I will try to document these options in more detail at some later point.
I hope this helps in some way :). Kenn would be able to produce a more
coherent response since he knows such details intimately.
- James.
"Andreas Werner" <andreas.werner@itso-berlin.de> wrote in message
news:a580138911d908c9b3bef5affd18@news.eclipse.org...
> Hi newsgroup,
>
> I'm working on a heavyweight extension of the UML metamodel.
>
> So my problem is that I have the case in which two classes
> called A and B inherit from uml::Class, and another class X is
> inheriting from A and B. (Aka. diamond inheritance)
>
> What happens in X, if a feature of uml::Class is redefined (and renamed)
> only in A, but not in B? Are both features available?
> ( I'd like to have only the redefined one to be there in X! ;) )
>
> Besides, is there a problem, if A as well as B contain features with
> the same name and type?
>
> Kind regards, Andreas
>
>
|
|
|
Re: UML and multiple/diamond inheritance [message #624555 is a reply to message #475206] |
Tue, 28 August 2007 19:12  |
Eclipse User |
|
|
|
Andreas,
I would expect that only the redefinition of the feature (from A) is
"available" in X. If both A and B contain features with the same name/type,
I'd say that yes, you have a problem - this situation is best avoided in
general. In practice, this can perhaps be addressed by defining a new
feature (again with the same name and type) that redefines both of the
inherited features. Otherwise, the UML2 code generator will rename one of
the inherited features to make it distinct.
Note that mapping redefinitions to an implementation in a language like Java
isn't trivial; in the UML2 code generator, we've tried to support some of
the common scenarios (e.g. those found in UML itself), but I'm sure some
scenarios aren't being handled properly. If you run into problems, let us
know!
Kenn
"Andreas Werner" <andreas.werner@itso-berlin.de> wrote in message
news:a580138911d908c9b3bef5affd18@news.eclipse.org...
> Hi newsgroup,
> I'm working on a heavyweight extension of the UML metamodel.
> So my problem is that I have the case in which two classes called A and B
> inherit from uml::Class, and another class X is inheriting from A and B.
> (Aka. diamond inheritance)
>
> What happens in X, if a feature of uml::Class is redefined (and renamed)
> only in A, but not in B? Are both features available? ( I'd like to have
> only the redefined one to be there in X! ;) )
>
> Besides, is there a problem, if A as well as B contain features with the
> same name and type?
>
> Kind regards, Andreas
>
>
|
|
|
Goto Forum:
Current Time: Wed Jul 23 19:19:31 EDT 2025
Powered by FUDForum. Page generated in 0.05432 seconds
|