Changing the hierarchy of parts or states in capsule-based UML diagrams

In capsule-based structure diagrams, you can move parts up in the capsule hierarchy to allow other subclass capsules to use its behavior, or down in the capsule hierarchy to duplicate the behavior in all the immediate subcapsules.

Before you begin

In capsule-based state machine diagrams, you can promote or demote a set of inherited states to change which capsule owns that set. You must have a structure diagram or state machine diagram open.

About this task

To change the hierarchy of a capsule parts or states:

Procedure

  1. In the diagram editor, select one or more parts or and connectors, or states.
  2. Right-click the selection; then click Refactor and complete one of the following steps:
    • To move the item up in the hierarchy, click Promote.
    • To move the item down in the hierarchy, click Demote.
  3. In the dialog box that opens, confirm the changes and click OK.

Results

Promoted parts and connectors are moved into the immediate supercapsule and are inherited by all the subclasses of the capsule. Promoted parts are displayed in the primary structure diagram of the superclass capsule. Demoted parts are not longer inherited by the subcapsules, they are removed from the supercapsule, moved into each of its subcapsules, and become part of the structure of the subcapsule. Demoted parts disappear from the immediate context and are displayed as local parts in subclass capsules, in the same position that they were displayed in the superclass.

When you promote a state, the state is redrawn as inherited and is displayed as a local state in the state machine diagram of the superclass capsule. When you demote a state, the selected state and all attached transitions are removed from the immediate context. The subclass capsules show the demoted states as local states in their primary state diagrams.


Feedback