Reply To: Selecting a subtype instance in OAL

homepage Forums BridgePoint/xtUML Usage and Training Selecting a subtype instance in OAL Reply To: Selecting a subtype instance in OAL

#6015

I have a supertype, Say ‘Animal’. There are 3 subtypes ‘Cat’, ‘Dog’, ‘Mon-Keigh’. Signal arrives over interface Port2::petAnimal which carries a parameter, say PetType which specifies the subtype. Maybe 0 = Cat, 1 = Dog, 2 = Mon Keigh. The super/sub is formalized over R1 with attribute AnimalType. Since every instance of Animal literally ‘is a’ Cat, Dog or Mon Keigh, and every instance of Cat, Dog or Mon Keigh ‘is a’ instance of Animal, if I have an instance handle of Animal, I should by the definition of ‘is a’ have a handle to the other Cat, Dog or Mon Keigh. The super and sub are literally the same instance. So if I select an instance myLittleBuddy of Animal where AnimalType == param.petType and then myLittleBuddy.stroke(); I should get the right mammal. Or at least it seems like it should work that way. But the OAL can’t see ‘stroke()’ because it isn’t defined in Animal, only Cat, Dog and Mon Keigh.

Now since stroking your kitty Cat is different than stroking your Mon Keigh the behavior should be different in each case.

Obviously, it can be done with Polymorphic Events, which I use elsewhere. But stroking the Mon Keigh isn’t very interesting and has no true dynamic nature so it doesn’t need a state machine. Just an operation with different processing than Cat or Dog.

I could be in the weeds of course. It happens at my age … now where did I put my glasses?