Re: Object Constraint Language and Inheritance
- From: "Achim D. Brucker" <brucker@xxxxxxxxxxxxx>
- Date: Wed, 29 Mar 2006 16:11:57 +0000 (UTC)
Hi,
Ulrich Frank <franku@xxxxxxxxxxxxxxxxx> schrieb:
Namely I have an UML class diagram with an inheritance hierarchie. The
root class is RootClass. For another class, say A, I want to express,
that it is not allowed to have subclasses. My first approach was to use
the ocl method allSupertypes() to forbid subclasses, but in that case I
would have to write it in every class which means I would have to place
it in the RootClass and from there it would be inherited to all other
classes.
if I understand your description correctly, then (caution, neither
type-checked nor proven :-)):
context A
inv: self.allInstancesOf()->forall(c | c.oclIsTypeOf(A))
should do what you want. Nevertheless, the semantics of
oclIsTypeOf() vs. oclIsKindOf() is not that obvious in the standard...
Achim
.
- Follow-Ups:
- Re: Object Constraint Language and Inheritance
- From: Ulrich Frank
- Re: Object Constraint Language and Inheritance
- References:
- Object Constraint Language and Inheritance
- From: Ulrich Frank
- Object Constraint Language and Inheritance
- Prev by Date: Object Constraint Language and Inheritance
- Next by Date: Re: UML class diagrams: hiding the attribute list
- Previous by thread: Object Constraint Language and Inheritance
- Next by thread: Re: Object Constraint Language and Inheritance
- Index(es):