Professional Documents
Culture Documents
73 Statechart Diagram: 3.73.1 Semantics
73 Statechart Diagram: 3.73.1 Semantics
3.73.1 Semantics
Statechart diagrams repre sent the be havior of entities cap able of dy namic behavior by
specifying its r esponse to the rec eipt of event in stances. Typically, it is us ed for
describing the behavior of classes, but statecharts may also describe the behavior of
other model entities such as us e-cases, acto rs, su bsystems, operations, or methods.
3.73.2 Notation
A statechart diag ram is a gr aph that re presents a state m achine. States and various
other types of vertices (p seudostates) in the state mac hine graph are rendered by
appropriate state and pseudostate symbols, wh ile tra nsitions are generally rend ered by
directed arcs that inter-connect them. States may also contain subdiagrams by physical
containment or tiling. Note that every state machine has a top state, wh ich contains all
the other elements of the entire state m achine. The graphical rendering of this top state
is optional.
The assoc iation between a state mac hine and its co ntext does not have a sp ecial
notation.
An example statechart diagram for a simple telephone object is depicted in Figure 3-59
on page 3-127.
Active
Timeout
dial digit(n)
DialTone
dial digit(n)
Dialing
do/ play dial tone
lift
dial digit(n)[invalid]
receiver
dial digit(n)[valid]
/get dial tone
/connect
Invalid
Connecting
Idle
busy
Pinned connected
Busy
callee
tone
callee hangs up
caller
answers
hangs up
/disconnect Ringing
Talking
3.73.3 Mapping
A statechart diagram maps into a StateMachine. That StateMachine may be owned by
3.74 State
3.74.1 Semantics
A state is a condition during the life of an object or an interaction during which it
satisfies so me con dition, perf orms some action , or waits for some event. A composite
(Composite states and their notation are described in m ore detail in S ection 3.75,
“Composite States,” on page 3-130.) Conceptually, an object remains in a state for an
interval of time. However, the semantics allow for modeling “flow-through” states that
3.74.2 Notation
A state is shown as a rectangle with rounded corners (Figure 3-60 on page 3-129).
Optionally, it m ay have an attached nam e tab. The nam e tab is a r ectangle, usually
resting on the outside of the top side of a state and it contains the name of that state. It
is normally used to keep the name of a composite state that has concurrent regions, but
may be used in o ther cases as well (the Process state in Figu re 3-65 on page 3-137
illustrates the use of the name tab).
A state may be optionally subdivided into multiple compartments separated from each
Name compartment
This compartment ho lds the ( optional) name of the state, as a string . States without
names are anonymous and are all distinct. It is undesirable to show the same named
state twice in th e same diag ram, as co nfusion may ensue. Name compartments
This compartment holds a list of internal actions or activities that are performed
while the elem ent is in the state . The n otation for each o f these list item s has th e
The ac tion lab el id entifies the circ umstances un der which th e action sp ecified by the
action expression will b e invoked. The action expression may use an y attributes and
links that are in the sco pe of the o wning entity. For list item s where th e action
A number of action labels are reserved for various special purposes and cannot be used
as event n ames. The following are th e reserved actio n labels an d their m eaning:
•
entry
exit
•
do
This label identifies an on going activity (“do activity”) that i s performed as long as
the modeled ele ment is in the state or un til the com putation sp ecified by the ac tion
expression is com pleted (the latter m ay result in a com pletion event bein g
generated).
include
This lab el is used to iden tify a sub machine invocation. The action expression
page 3-142.
In all oth er cases, the action lab el id entifies the e vent that trigg ers the corresponding
"
action expression. These e vents are called in ternal trans itions and are sem antically
equ ivalent to self t ransitions except tha t the state is n ot exited o r re-entered. This
#
means th at th e cor responding exit and entry actions are not per formed. The general
format for the list item of an internal transition is:
#
action-expression
Each event name may appear more than once per state if the guard conditions are
different. The e vent param eters and th e guard con ditions are optional. I f the e vent has
!
variable.
3.74.3 Example
Typing Password
3.74.4 Mapping
A state symbol maps into a State. See Section 3.75, “Composite States,” on page 3-130
The name string in the symbol maps to the name of the state. Two symbols with the
same name map into th e same state . However, each state sy mbol with no name (or an
A list item in the in ternal transitio n com partment maps into a corr esponding Action
asso ciated with a s tate. An “entry” list item (i.e., an item with the “entry” label) maps
to th e “entry” role, an “e xit” list item maps to the “e xit” role, and a “do” item maps to
the “do Activity” role. ( The m apping of “in clude” item s is dis cussed in Section 3.81,
relative to the state. The action expression maps into the ActionSequence and Guard
for the Transition. The event name and arguments map into an Event corresponding to
the event nam e and arguments. The T ransition has a trigger Association to the Ev ent.
3.75.1 Semantics
A composite state is decom posed in to two or m ore concurrent substates (c alled
regions) or into mutually exclusive disjo int s ubstates. A g iven state may only be
refined in one of these two ways. Naturally, any substate of a composite state c an also
A newly-created ob ject ta kes its to pmost d efault transition, originating from the
topmost in itial pseudostate. An o bject that tra nsitions to its ou termost final state is
terminated.
Each region of a state m ay have initial ps eudostates and final states. A tr ansition to the
enclos ing state represents a transitio n to the initial p seudostate. A trans ition to a f inal
state and triggers a completion event on the enclosing state. Completion of the top state
3.75.2 Notation
An expansion of a state shows its internal state machine structure. In addition to the
(optional) name and internal tr ansition compartments, the state may have an add itional
region.
of the state us ing dash ed lines to divide it into regions. Each region is a con current
substate. Each region may have an optional name and must contain a nested state
diagram with disjoint state s. The text compartments of the entir e state ar e sepa rated
from the concurrent substates by a solid line. It is also possible to use a tab notation to
!
place th e name of a c oncurrent state. The tab n otation is more spac e efficient.
An in itial pseudostate is s hown as a sm all so lid filled circle . In a top -level state
machine, the transition from an in itial pseudostate may be lab eled with th e event th at
represents the com pletion of activity in the enclo sing state and it trigg ers a transitio n
on the enclo sing state la beled by the implicit a ctivity com pletion event (usually
In some cases, it i s convenient to hid e the decom position of a com posite state. For
"
example, the state ma chine insid e a com posite state may be very large and may simply
not fit in the graphical space available for the diagram. In that case, the composite state
may be represented by a simple state g raphic with a special “c omposite” icon, usually
in the lower right-hand corner. This icon, consisting of two horizontally placed and
connected states, is an optional visual cue that the state has a decomposition that is not
+
shown in this particular s tatechart diagram (F igure 3-62 on page 3-131). Instead, the
contents of the composite state are shown in a separate diagram. Note that the “hiding”
here is purely a matter of graphical convenience and has no semantic significance in
terms of acce ss restrictions.
3.75.3 Examples
Dialing
digit(n)
HiddenComposite
entry/ start dial tone
'
Figure 3-62 Composite State with hidden decomp osition indicator icon
Taking Class
Incomplete
lab
lab done done
Lab1 Lab2
Passed
3
project done
2
Term
Project
pass
2
Final
Test
fail
Failed
3.75.4 Mapping
A state symbol maps into a State. If the sy mbol has n o subdiagrams in it, it m aps into
An initial pseudostate symbol map into a Pseudostate of kind initial. A final state
0
3.76 Events
3.76.1 Semantics
An event is a noteworthy occurrence. For practical purposes in state diagrams, it is an
occurrence that may trigger a s tate transition. Events m ay be o f several kinds (not
necessarily m utually exclusive).
A designated condition beco ming true (described by a Boolean expression) resu lts
in a ch ange event in stance. The event occurs whe never th e value of the e xpression
changes from false to true. Note that th is is dif ferent from a gu ard cond ition. A
guard condition is e valuated once whenever its event fires. If it is false, then the
+
The receipt of an explicit signal from one object to another results in a signal event
instance. It i s denoted by the sig nature of the e vent as a tr igger on a tr ansition.
• The receipt of a call for an operation implemented as a transition by an object
represents a call event instance.
•
The passage of a designated period of time af ter a d esignated event (often the entry
The event declaration has scope within the package it appears in and may be used in
state diagrams for classes that h ave visibility inside the p ackage. An event is not local 5
to a sing le class.
3.76.2 Notation
A signal or call event can be defined using the following format:
#
A signal can be declared using the «signal» keyword on a class symbol in a class
diagram. The par ameters ar e spec ified as attributes. A sig nal can be specified as a
subclass o f ano ther sign al. This ind icates th at an occurre nce of the su bevent triggers
7
seconds)” o r after (10 seconds sin ce exit from state A).” If no starting point is
7
indicated, then it is the time since the entry to th e current state. Other time events can
be sp ecified as co nditions, such as when (date = J an. 1, 2000).
A condition becoming true is shown with the keyword when followed by a Boolean
8
expression. This may be regarded as a con tinuous test for the con dition until it is tr ue,
Signals can be declared on a cla ss diagram with the keyword «sig nal» on a re ctangle
symbol. These def ine sig nal n ames that m ay be used to trigger tr ansitions. Their
!
para meters are shown in th e attr ibute com partment. They have no operations. They
may appear in a generalization hierarchy.
3.76.3 Example
«signal»
InputEvent
time
:
«signal»
UserInput
device
«signal» «signal»
Mouse Keyboard
Button
9
Character
location character
«signal»
;
«signal» «signal»
Space Alphanumeric Punctuation
3.76.4 Mapping
A class box with stereotype «signal» maps into a Signal. The name and parameters are
given by the n ame string and th e attribute list of th e box. Gen eralization arrows
between sig nal class b oxes map in to Generaliz ation relationships betwee n the Sig nal.
The usage of an event strin g expression in a co ntext req uiring an e vent map s into an
implicit reference of the Event with the given name. It is an error if various uses of the
3.77.1 Semantics
A simple transition is a relationship between two states indicating that an object in the
first state will enter the secon d state and perform specific actions when a sp ecified
event occurs p rovided that cer tain specif ied conditions are satisfied. On su ch a chan ge
of state , the tra nsition is said to “f ire.” The trigg er for a tr ansition is the occurr ence of
the event labeling the transition. The event may have parameters, which are accessible
by the action s specified on the transition as well a s in the c orresponding exit and entry
actions associated with th e sou rce and target states re spectively. Events are processed
one at a tim e. If an event does not trigger any transition, it is discarded. If it can trigger
more than one transition within the sam e sequential region (i.e., not in different
con current re gions), only one will f ire. If these conflicting trans itions are of the sam e
!
3.77.2 Notation
A transition is shown as a solid line originating from the source state and terminated
by an a rrow on the target state. It may be labeled by a transition string that has the
( (
triggering event an d attributes and links of the object tha t owns the state ma chine. The
guard condition may also involve tests o f con current state s of the curr ent machine, or
<
=
in State2”). State names may be fully qualified by the ne sted states that co ntain them,
>
same state name occurs in d ifferent c omposite state regions of the overall m achine.
The action-expression is executed if and when the transition fires. It may be written in
terms of operations, attributes, and links of the owning object and the parameters of the
triggering event, or any other features visib le in its scope. The corresponding action
must be executed entir ely before any other actions are c onsidered. This mo del of
an actio n seq uence comprising a number of distinct acti ons including actions that
explicitly g enerate events, su ch as send ing sig nals or in voking operations. The d etails
of this expression are dep endent on the ac tion lan guage cho sen for the m odel.
3.77.3 Example
right-mouse-down (location) [location in window] / object := pick-object (location);
object.highlight ()
?
The event may be any of the standard event types. Selecting the type depends on the
declaration elsewhere.
3.77.4 Mapping
A transition string and th e transitio n arrow that it labels togeth er map into a Transition
and its atta chments. The arrow connects two state sy mbols. The T ransition has th e
corresponding States as its sou rce (the state a t the tail) and destination (the state at the
@
The event n ame and parameters m ap into an Event elem ent, whic h may be a
The g uard co ndition maps into a Guard elem ent attached to the Transition. Note th at a
enclosed in brackets.
An action expression maps into an Action attached as an “effect” role relative to the
Transition.
A concurrent transition may have multiple source states and target states. It represents
concurrent substates.
3.78.1 Semantics
A concurrent transition is enabled when all the source states are occupied. After a
3.78.2 Notation
A concurrent transition includes a short heavy bar (a synchronization bar, which can
represent synchronization, forking, or both). The bar may have one or more arrows
from states to th e bar (these a re the sou rce sta tes). The bar may have one or more
)
arrows from the b ar to states ( these ar e the destination states ). A transitio n string may
A
be shown near the bar. Individual arr ows d o not have their own transition string s.
3.78.3 Example
Process
A1 A2
-
Setup
Cleanup
B1 B2
3.78.4 Mapping
A bar with multiple transition arrows leaving it maps into a fork pseudostate. A bar
with multiple tr ansition arrows entering it maps into a join pseudostate. The transitions
corr esponding to the inco ming and outgoing arrows attac h to th e pseu dostate as if it
were a regular state. If a bar has multiple incoming and multiple outgoing arrows, then
it m aps into a join connected to a fork p seudostate b y a sin gle transition with no
atta chments.
3.79.1 Semantics
A transition drawn to the boundary of a composite state is equivalent to a transition to
its initial point (or to a complex transition to the initial point of each of its concurrent
*
A transition from a composite state indicates a transition that applies to each of the
states within th e state r egion (at a ny depth). It is “in herited” by the nested states.
Inherited tr ansitions can be masked by the presence of nested transitions with the sam e
"
trigger.
3.79.2 Notation
A transition drawn to a composite state boundary indicates a transition to the
composite state. This is equ ivalent to a tr ansition to th e initial pseu dostate with in th e
com posite state r egion. The initial pseu dostate m ust be p resent. If the state is a
con current co mposite state, then th e transition ind icates a tra nsition to th e initial
!
OMG-UML V1.3 Transitions to and from Composite States March 2000 3-137
3
Transitions may be drawn directly to states with in a com posite state r egion at an y
nesting depth. All entry actions are performed for any states that are entered on any
transition. On a tr ansition within a concurrent com posite state, transitio n arrows from
the synchronization bar may be drawn to on e or more concurrent states. Any other
A transition drawn from a c omposite state boundary ind icates a tra nsition of th e
com posite state . If such a tr ansition fires, any nested states are forcibly terminated an d
!
perf orm their e xit actions, then the tra nsition action s occur and the ne w state is
established.
Transitions may be drawn directly from states within a c omposite state region at a ny
nesting depth to outside states. All exit actions are performed for any states th at are
exited on any transitio n. On a tra nsition from with in a con current composite state,
transition arrows m ay be s pecified from one or m ore con current state s to a
A state region may contain a history state indicator shown as a small circle containing
B
an ‘H.’ The histor y indicator applies to the state region that dir ectly contains it. A
history indicator may have any number of incoming transitions from outside states. It
may have at m ost o ne ou tgoing unlabeled tra nsition. This id entifies the def ault
“previous state” if the region has never been entered. If a transition to the history
indicator fires, it indicates that the object resumes the state it last had within the
composite regio n. Any necessary entry actions are performed. The histo ry ind icator
may also be ‘H*’ for deep histo ry. This ind icates th at the o bject re sumes th e state it
A
last had at any depth within the composite region, rather than being restricted to the
state at the sam e level as the history indicator. A re gion may have both shallo w and
specific visib le enclosing state of the suppressed s tate. Sub sumed trans itions that do
not com e from an un labeled f inal state or go to an unlabeled in itial pseudostate may
(but need not) be shown as coming from or going to stubs. A stub is shown as a small
vertical lin e (bar) drawn inside the boundary of the en closing state. It indicates a
transition connected to a sup pressed in ternal state. Stubs are not used for tr ansitions to
Note that events should be shown on transitions leadin g into a state, either to the state
events sh ould no t be sh own on trans itions leading from a stub bed state to an e xternal
state. Thin k of a transitio n as b elonging to its sou rce state. If the so urce state is
suppressed, then so are the d etails o f the transition. Note also that a transitio n from a
final state is su mmarized b y an u nlabeled transitio n from the com posite state c ontour
(denoting the im plicit event “action com plete” f or the corresponding state) .
3.79.4 Example
See F igure 3-64 on page 3-134 and Figure 3-65 on page 3-137 for examples of
composite tr ansitions. The following are examples of stub bed transitions and the
history indicator.
W E
s
p E
s
E
D
A C
u
t
r F
B
D
may be abstracted as
s
E
p W D
C
C
A
r
B
D
C
interrupt
A A1 D
resume
H
A2
OMG-UML V1.3 Transitions to and from Composite States March 2000 3-139
3
3.79.5 Mapping
An arrow to any state bo undary, nested or no t, maps in to a T ransition between the
corr esponding States and sim ilarly for transitio ns d irectly to his tory states.
A stubbed transition does not map into anything in the model. It is a notational elision
that indicates the presence of tra nsitions to additional states in the m odel th at are no t
3.80.1 Semantics
By definition, a tr ansition connects exactly two vertices in the state m achine graph .
F
However, since some of these vertices may be pseudostates (which are transient in
nature) there is a need for describing chains of transitions that may be executed in the
context of a sin gle run -to-completion s tep. Such a transitio n is known as a compound
transition.
(
continue via a common path , sharing its action, and p ossibly terminating on the sam e
target state. In other cases, it may be useful to split a transition into separate mutually
Both of these examples of graphical factoring in which some transitions are shared
*
determined as the result of an action (calculation) performed after the tr iggering of the
compound transition.
Note th at the splittin g and join ing of path s du e to f actoring is d ifferent from the
and from Concurrent States,” on page 3-136. The sources an d targets of these f actored
transitions are not con current.
3.80.2 Notation
Two or more transitions emanating from different non-concurrent states or
!
pseudostates ca n ter minate o n a co mmon junction point. Th is allo ws their resp ective
compound transitions to share the path that em anates from that jun ction point. A
G
Two or m ore guarded transitio ns em anating from the same jun ction point re present a
static branch point. Normally, the guards are mutually exclusive. This is equivalent to
a set of individual tran sitions, one for each path through the tr ee, whose guard
condition is th e “an d” of all of the con ditions alo ng the path . Note that the sem antics
of static b ranches is that all th e outgoing guards are evaluated before any transition is
H
taken.
Two or more guarded transitio ns emanating from a common dynamic choic e point are
A
used to model dynamic choices. In this case, the g uards of the o utgoing transitio ns are
evaluated at the time the choice point has been reached. The value of these guards may
3.80.3 Examples
In Figure 3-68 a single junction point is used to merge and split transitions. Regardless
of whether the jun ction point was reac hed from state State0 or from state Sta te1, the
If the state machine in this example is in state State1 and b is less than 0 when event
- -
State0 State1
'
[a < 0] [a > 7]
[a = 5]
- - -
In the dy namic ch oice point example in Figure 3-69 on page 3-142, the decision on
"
which branch to take is on ly m ade after the tra nsition from State1 is tak en an d th e
choice point is r eached. Note that th e actio n associated with that in coming tran sition
computes a new value for a. This new value can then be used to determine the outgoing
transition to b e taken. The us e of the predef ined co ndition[else] is recommended to
State1
e1[b < 0]/a := f(m)
'
[a < 0] [else]
[a = 5]
- - -
3.81.1 Semantics
A submachine state r epresents th e invocation of a state ma chine defined elsewhere. It
is similar to a macro call in the sense that it represents a (graphical) shorthand that
implies embedding of a complex specification within another specification. The
submachine must be c ontained in the sam e context as th e invoking state mac hine.
In the general case, an in voked state mac hine can be e ntered at an y of its sub states or
"
through its def ault (initial) pseudostate. Similarly, it can be e xited from any substate or
as a result o f the invoked state mach ine reac hing its f inal state o r by an “in herited” or
“group” transition that applies to all substates in the submachine.
The non-default en try and exits are specified th rough special stu b states.
3.81.2 Notation
The submachine state is depicted as a normal state with the appropriate “include”
declaration within its in ternal transitio ns co mpartment (see Se ction 3.74, “State,” on
!
page 3-127). The expression following the incl ude reser ved word is the n ame of the
invoked submachine.
Optionally, the submachine state may contain one or more entry stub states and one or
more exit stub states. The notation for these is similar to that used for stub ends of
stubbed transitions, except th at the en ds are labeled. The lab els represent the n ames of
the corresponding su bstates within the in voked su bmachine. A pathname may be used
if the substate is no t defined at the top level of the invoked submachine. Naturally, this
L
of the com pletion of the sub machine, it is not necessary to u se the stu b state no tation
for these ca ses. Sim ilarly, a stu b state is n ot requ ired if the exit o ccurs throu gh an
explicit “grou p” transition that em anates f rom the boundary of the su bmachine state
Sub machine states in voking the same submachine m ay occur multiple tim es in the
same state diagram with d ifferent en try and exit con figurations and with d ifferent
internal tr ansitions and exit and entry action specifications in each case.
3.81.3 Example
The following diagram shows a fragment from a statechart diagram in which a
Handle Failure
include / FailureSubmachine
error1/ error2/
'
'
sub1 sub1::sub12
E
subEnd
E
error3/
'
fixed1/
In the abo ve example, the transition triggered by event “er ror1” will term inate on state
"
“sub1” of the FailureSubmachine state machine. Since the entry point does not contain
a path name, this m eans th at “sub1” is d efined at the top level of that submachine. In
con trast, the tr ansition triggered by “error2” will ter minate on the “sub12” substate o f
the “su b1”substate (as ind icated by the path n ame), while the “e rror3” tr ansition
The transition triggered by the event “fixed1” emanates from the “subEnd” substate of
the su bmachine. Fin ally, the transition emanating from the edge o f the submachine
3.81.4 Mapping
A submachine state in a statechart diagram maps directly to a SubmachineState in the
metamodel. The name following the “include” reserved action label represents the state
machine indicated by the “submachine” attribute. Stub states map to the Stub State
3.82.1 Semantics
A synch state is for synchronizing concurrent regions of a state machine. It is used in
conjunction with forks and join s to in sure that o ne region leaves a particular state or
states before another region can enter a particular state or states. Th e firing of outgoing
transitions from a sy nch state can b e limited by specifying a b ound on the dif ference
between the number of tim es outg oing an d in coming trans itions have fired.
3.82.2 Notation
A synch state is s hown as a small cir cle with th e up per bound ins ide it. The bound is
either a p ositive integer or a star ('*') for un limited. Synch states ar e drawn on the
3.82.3 Example
Build House
Install
Foundation Inspect
* *
3.82.4 Mapping
A synch state circle maps into a SynchState, contained by the least common containing
state of the regions it is syn chronizing. The n umber insid e it maps onto th e bound
attribute of the synch state. A star ('* ') inside the syn ch state circle maps to a value of
Unlimited for the bo und attrib ute.
N
3.83.1 Semantics
An activity graph is a variation of a state machine in which the states represent the
!
performance of ac tions or sub activities and th e transitions are trigg ered by the
com pletion of the actions or sub activities. It re presents a state m achine of a p rocedure
itself.
3.83.2 Notation
An activity diag ram is a specia l case o f a state d iagram in wh ich a ll (o r at lea st most)
of the states are actio n or subactivity states and in wh ich all (o r at least mo st) of the
transitions are trigg ered by com pletion of the action s or subactivities in the so urce
states. The entire activity diag ram is attach ed (through the model) to a class, such as a
I
events). Use acti vity d iagrams in situatio ns wh ere all or m ost o f the events represent
the com pletion of internally-generated actions (that is, proced ural flow of control). Use
ordinary state diag rams in situa tions where asyn chronous events occ ur.
3.83.3 Example
Person::Prepare Beverage
Put Coffee P
Put Filter P
of cola
Turn on
Machine
/coffeePot.turnOn
U
Brew coffee
Pour Coffee
Drink
3.83.4 Mapping
An activity d iagram maps in to an ActivityGraph.
3.84.1 Semantics
An action s tate is shorthand for a state with an entry action and at least one outgoing
transition involving th e implicit e vent of com pleting th e entry action (there may be
several such transitions if the y have guard con ditions). Ac tion states s hould n ot have
internal tr ansitions or outgoing transitions b ased o n explicit e vents, use n ormal states
for this situatio n. The normal use of an action state is to m odel a step in the execution
3.84.2 Notation
An actio n state is sho wn as a shape with straig ht top and bottom and with convex arcs
on the tw o sides. The action-expression is placed in the symbol. The action expression
Transitions leaving an action state should not include an event signature. Such
transitions are im plicitly triggered by the completion of the action in the state. T he
language code. It may use only attributes and link s of the owning object.
Note that action state no tation may be used within o rdinary state d iagrams; however,
they are more commonly used with activity diagrams, which are spe cial ca ses of state
diagrams.
3.84.4 Example
3.84.5 Mapping
An action state sym bol maps into an Action State with the action-expression mapped to
the entry actio n of the State. T here is no exit nor any internal transitions. The State i s
normally anonymous.
3.85.1 Semantics
A subactivity sta te invokes an activity graph. When a subactivity state is entered, the
activity graph “nested” in it is executed as an y activity graph would be. The subactivity
state is no t exited until the f inal state of the n ested graph is re ached, or when trigg er
events occur on transitions com ing out of the su bactivity state . Sin ce states in activity
graph s do not normally have trigger events, subactivity states are no rmally exited when
their n ested graph is f inished. A sing le acti vity graph may be invoked by many
subactivity states.
3.85.2 Notation
A subactivity state is sh own in th e same way as an action state with the add ition of an
icon in the lower right corner depicting a nested activity diagram. The name of the
diagram.
This notation is a pplicable to any UML construct that sup ports “nested” str ucture. The
3.85.3 Example
3.85.4 Mapping
A subactivity state symbol maps into a SubactivityState. The name of the subactivity
maps to a submachine link between the SubactivityState and a StateMachine of that
L
3.86 Decisions
3.86.1 Semantics
A state diagram (and by derivation an activity diagram) expresses a decision when
guard conditions are used to ind icate different po ssible transitions that d epend on
Boolean co nditions of the o wning o bject. UML provides a sh orthand for sho wing
3.86.2 Notation
A decision may be sh own by labelin g multiple output transitio ns of an action with
The icon provided for a decision is the traditional diamond shape, with one incoming
condition with n o event trigg er. All pos sible o utcomes sh ould ap pear on one of the
outgoing transitions. A predefined g uard den oted “else” m ay be d efined for at m ost
one ou tgoing transitio n. This trans ition is enabled if all the g uards labelin g th e other
transitions are false.
The same icon can be used to merge decision branches back together, in which case it
is called a merge. A merge has two or more incoming arrows and one outgoing arrow.
Note that a chain of decision s may be part of a com plex transitio n, but only th e first
segment in s uch a chain may contain an event trigger la bel. All se gments m ay have
guard expressions. The transition coming from a merge may not have a trigger label or
guard expressions.
3.86.3 Example
customer’s
total cost Z
account
[cost ≥ $50]
[
Get
authorization
3.86.4 Mapping
A decision symbol maps into a Pseudostate of kind junction. Each label on an outgoing
]
arrow maps into a Guard o n the co rresponding Transition leaving th e Pseud ostate. A
merge symbol also maps into a Pseudostate of kind junction.
\
3.87 Swimlanes
3.87.1 Semantics
Actions and subactivities may be organized into swimlanes. Swim lanes are used to
organize re sponsibility for actions and subactivities acco rding to class. They often
3.87.2 Notation
An activity diagram may be divided visually into “swimlanes,” each separated from
L
neighboring swimlanes by vertical solid lines on both sides. Eac h swimlane represents
responsibility for par t of the overall activity, and may eventually be im plemented by
one or m ore objects. T he relative ordering of the swimlanes has no sem antic
sig nificance, but might indicate some affinity. Each action is assigned to one swimlane.
Transitions may cross lanes. There is no significance to the routing of a transition path.
3.87.3 Example
Customer _
Sales _
Stockroom
Request service
Take order
Pay
Fill order
Deliver order
Collect order
3.87.4 Mapping
A swimlane maps into a Partition of th e States in the ActivityGraph. A state s ymbol in
a swim lane causes the corre sponding S tate to belon g to the corre sponding Partition.
3.88.1 Semantics
Actions operate by and on objects. These objects either have primary responsibility for
initiating an action , or are used or deter mined by the action. Actions usu ally sp ecify
calls sent between the object owning the activity graph, which initiates action s, and the
3.88.2 Notation
drawing a life line and placing action s on lifelines. See Sectio n 3.58, “Seq uence
Diagram,” on page 3-94. Activity diagrams do not show the lifeline, but each action
specifies wh ich object performs its operation. These objects may also be related to the
swim lane in s ome way. The actions within a s wimlane can all be handled by the s ame
Objects that ar e input to or output from an actio n may be sho wn as object symbols. A
dashed arrow is dr awn from an ac tion state to a n output object, an d a dashed ar row is
drawn from an input object to an actio n state. The same object may be (and usually is)
the output of one action and the input of one or more subsequent actions.
The control flow (solid) arrows must be omitted when the object flow (dashed) arrows
supply a r edundant con straint. In other words, when a state p roduces an output that is
input to a subsequent state, that ob ject flow rela tionship im plies a control con straint.
subactivities. It is p ossible to s how one ob ject with arrows to and from all o f the
*
relevant action s and sub activities, but fo r greate r clarity, the object m ay be d isplayed
multiple tim es on a diagram. Ea ch app earance deno tes a different po int d uring the
object’s life. To distinguish the various appearances of the same ob ject, the state of the
object at each point may be placed in brackets and appended to the name of the object
(for example, PurchaseOrder[approved]). This notation may also b e used in
3.88.3 Example
Customer _
Sales _
Stockroom
Request service
Order
[placed]
Take order
Order
[entered]
Pay
a
Deliver order
b
Order
[delivered]
Collect order
/
3.88.4 Mapping
An object f low symbol maps in to an Obje ctFlowState who se inc oming and outgoing
Transitions correspond to the incoming and outgoing arrows. The Transitions have no
attachments. Th e class name and (optional) state name of the object flow symbol map
into a C lass or a C lassifierInState corresponding to the name (s). Solid and dashed
The following icons provide explicit symbols for certain kinds of information that can
be specified o n transitio ns. These ico ns are not necessary for constructin g activity
3.89.1 Notation
with a triangular notch in its sid e (either side). The signature of the sign al is sho wn
ins ide the sy mbol. An u nlabeled transition arrow is dra wn from the previous action
state to th e pentagon and ano ther un labeled tra nsition arrow is d rawn from the
!
pentagon to the next action state. A dashed arrow may be drawn from an object symbol
to the notch on the pen tagon to s how the sender of the sig nal; th is is op tional.
with a triangular point on one s ide (either sid e). The sign ature of the sig nal is sh own
inside the symbol. A unlabeled transition arrow is drawn from the previous action state
to the pentag on and an other un labeled transitio n arrow is d rawn from the pen tagon to
the next action state. A dashed arrow may be drawn from the point on the pentagon to
an object sym bol to s how the receiver of the sig nal, this is o ptional.
d
Turn on
Machine
turnOn
coffeePot
Brew coffee
Pour Coffee
some oth er action or su bactivity is u nderway. (Norm ally an event that is n ot handled
immediately is lost.) This may be thought of as having an internal transition that
handles the event and places it on an internal queue until it is needed or until it is
discarded. Each state specifies a set of events th at are deferred if they occur during the
state and are no t used to trigger a tr ansition. If an event is not includ ed in the set of
defe rrable events for a state, and it d oes n ot trigg er a tra nsition, then it is discar ded
from the queue even if it has already occurr ed. If a transition depends on an event, the
transition fires im mediately if the event is already on th e internal qu eue. I f several
transitions are possible, the lea ding event in th e queue takes prece dence.
A defe rrable event is shown by listing it within th e state f ollowed by a slash and the
special op eration defer. If the event occurs, it is sa ved and it recurs wh en th e object
A "
transitions to another state, where it may be deferred again. When the o bject rea ches a
state in which the event is not deferred, it must be accepted or lost. The indication may
which case it remains deferrable throughout the com posite state. A contained transitio n
may still be trigg ered by a deferrable event, whereup on it is removed from the queue.
interruptible for event processing. In this case, both deferred and undeferred events that
occur during the state are deferred until the state is com pleted. This means th at the
tim ing of the transition will be the sam e regardless of the re lative order of the e vent
and the state c ompletion, and regardless of wheth er events are d eferred.
Turn on
Machine
turnOn
Brew coffee
light goes out / defer
f
Get Cups
light goes out / defer
Pour Coffee
3.89.2 Mapping
A signal receipt symb ol maps into a state with n o actions or inter nal tran sitions. Its
A signal send symbol maps into a SendAction on the incoming transition between it
The SynchState notation may be omitted in Activity Diagrams when a SynchState has
one incoming and one outgoing transition, and an un limited bound. The sem antics and
mapping are the sam e as if th e syn ch state circ les were in cluded, as d efined for state
machine notation.
Build House
h
Install i
Inspect
Foundation
3.91.1 Semantics
The actions of an action state or the activity graph of a subactivity state may be
3.91.2 Notation
If the dynamic concurrency of an actio n or subactivity state is not always exactly one,
"
its multiplicity is shown in the upper right corner of the state. Otherwise, nothing is
shown.
3.91.3 Mapping
A multiplicity string in the up per right corner of an action or subactivity state m aps to
the sam e value in th e dyn amicMultiplicity attrib ute of the state. The p resence of a
multiplicity string also maps to a value of true for the isDynamic attribute of the state.
If no multiplicity is present, the v alue of the isDyn amic attr ibute is false.
"
In Activity Diagrams, transitions outgoing from forks may have guards. This means the
*
region initiated by a fork tra nsition might no t star t, and therefore is no t required to
com plete at the corresponding join. The usual notation and mapping for guards may be
I
structure and run-time imp lementation str ucture. They come in two forms:
1. component diag rams show the str ucture of the co de its elf and
They can also be applied in a broader sense to business modeling in which the “code”
components are the business procedures and documents and the “run-time stru cture” is
the organization units and res ources (human and other) of the business.
3.93.1 Semantics
A component diagram shows the dependencies among software components, including
stereotype. Some components exist at com pile time, some exist at link time, some exist
at run time, and som e exist at mo re than one time . A co mpile-only component is o ne
that is only meaningful at compile time. The run-time component in this c ase would be
an executable program.
A component diagram has only a type form, not an instance form. To show component
instances, use a deployment diagram (possibly a degenerate one without nod es).
3.93.2 Notation
A component diagram is a graph of components connected by dependency
relationships. Components may also be connected to components by physical