[ Team LiB ] Previous Section Next Section

Internal Activities

States can react to events without transition, using internal activities: putting the event, guard, and activity inside the state box itself.

Figure 10.2 shows a state with internal activities of the character and help events, as you might find on a UI text field. An internal activity is similar to a self-transition: a transition that loops back to the same state. The syntax for internal activities follows the same logic for event, guard, and procedure.

Figure 10.2. Internal events shown with the typing state of a text field

graphics/10fig02.gif

Figure 10.2 also shows two special activities: the entry and exit activities. The entry activity is executed whenever you enter a state; the exit activity, whenever you leave. However, internal activities do not trigger the entry and exit activities; that is the difference between internal activities and self-transitions.

    [ Team LiB ] Previous Section Next Section