Home » Modeling » UML2 » GeneralizationSet
GeneralizationSet [message #478579] |
Thu, 02 July 2009 10:54 |
Timothy Marc Messages: 547 Registered: July 2009 |
Senior Member |
|
|
Hey all,
a more or less simple question concerning the GeneralizationSet. Let's
consider:
class Super
class Sub1 extends Super
class Sub2 extends Super
Concerning the GeneralizationSet (GS) mechanism, the spec mentioned,
that a GS will covering, if instances of Sub1 are also an instance of
Sub2. So far so good, but...
IMHO, this instance relationsship deals with the UML-internal instance
specification mechanism, am i right? In Java, for example, any check
like (sub1 instanceof sub2) will fail, because there are not directly
compatible (only via an upcast).
But in UML it seems possible, that an instance of a subclass can also be
an instance of any other corelating subclass of this GS, since any
instance specification can point to several classifiers.
Is this correct?
Thx
Timothy
|
|
|
Re: GeneralizationSet [message #478591 is a reply to message #478579] |
Mon, 06 July 2009 15:47 |
Kenn Hussey Messages: 1620 Registered: July 2009 |
Senior Member |
|
|
Timothy,
Yes, the concept of generalization sets is indeed defined in terms of
UML's notion of instances. However, I would not expect an object to be
an instance of both Sub1 and Sub2 at the same time unless those
classifiers are related by a generalization or (interface) realization
relationship.
A covering generalization set means that all instances in the hierarchy
are "covered" by the set. In your example, it would mean that all
instances of Super (or of a specialization of Super) are directly or
indirectly instances of either Super1 or Super2 (assuming the set
includes Super1 and Super2).
Kenn
Timothy Marc wrote:
> Hey all,
>
> a more or less simple question concerning the GeneralizationSet. Let's
> consider:
>
> class Super
> class Sub1 extends Super
> class Sub2 extends Super
>
> Concerning the GeneralizationSet (GS) mechanism, the spec mentioned,
> that a GS will covering, if instances of Sub1 are also an instance of
> Sub2. So far so good, but...
>
> IMHO, this instance relationsship deals with the UML-internal instance
> specification mechanism, am i right? In Java, for example, any check
> like (sub1 instanceof sub2) will fail, because there are not directly
> compatible (only via an upcast).
>
> But in UML it seems possible, that an instance of a subclass can also be
> an instance of any other corelating subclass of this GS, since any
> instance specification can point to several classifiers.
>
> Is this correct?
>
> Thx
> Timothy
|
|
|
Re: GeneralizationSet [message #627772 is a reply to message #478579] |
Mon, 06 July 2009 15:47 |
Kenn Hussey Messages: 1620 Registered: July 2009 |
Senior Member |
|
|
Timothy,
Yes, the concept of generalization sets is indeed defined in terms of
UML's notion of instances. However, I would not expect an object to be
an instance of both Sub1 and Sub2 at the same time unless those
classifiers are related by a generalization or (interface) realization
relationship.
A covering generalization set means that all instances in the hierarchy
are "covered" by the set. In your example, it would mean that all
instances of Super (or of a specialization of Super) are directly or
indirectly instances of either Super1 or Super2 (assuming the set
includes Super1 and Super2).
Kenn
Timothy Marc wrote:
> Hey all,
>
> a more or less simple question concerning the GeneralizationSet. Let's
> consider:
>
> class Super
> class Sub1 extends Super
> class Sub2 extends Super
>
> Concerning the GeneralizationSet (GS) mechanism, the spec mentioned,
> that a GS will covering, if instances of Sub1 are also an instance of
> Sub2. So far so good, but...
>
> IMHO, this instance relationsship deals with the UML-internal instance
> specification mechanism, am i right? In Java, for example, any check
> like (sub1 instanceof sub2) will fail, because there are not directly
> compatible (only via an upcast).
>
> But in UML it seems possible, that an instance of a subclass can also be
> an instance of any other corelating subclass of this GS, since any
> instance specification can point to several classifiers.
>
> Is this correct?
>
> Thx
> Timothy
|
|
|
Goto Forum:
Current Time: Wed Apr 24 21:25:05 GMT 2024
Powered by FUDForum. Page generated in 0.03114 seconds
|