Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
1-30_Teoria.doc
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
2.59 Mб
Скачать

20. Main elements of state machine diagram: definitions, description, examples.

Def: State machine diagram shows flow of control from state to state within single object.is the technique to describe the behavior of a system/

Des:main elements;’

A state is denoted by a round-cornered rectangle with the name of the state written inside it/ A submachine state specifies the insertion of the specification of a submachine state machine. The state machine that contains the submachine state is called the containing state machine.

Initial and Final States

The initial state is denoted by a filled black circle and may be labeled with a name. The final state is denoted by a circle with a dot inside and may also be labeled with a name.

Transitions

Transitions from one state to the next are denoted by lines with arrowheads. A transition may have a trigger, a guard and an effect, as below.

"Trigger" is the cause of the transition, which could be a signal, an event, a change in some condition, or the passage of time. "Guard" is a condition which must be true in order for the trigger to cause the transition. "Effect" is an action which will be invoked directly on the object that owns the state machine as a result of the transition.

Self-Transitions

A state can have a transition that returns to itself, as in the following diagram. This is most useful when an effect is associated with the transition.

Choice: choice vertices which, when reached, result in the dynamic evaluation of the guards of the triggers of its outgoing transitions. This realizes a dynamic conditional branch.

An entry point pseudostate is an entry point of a state machine or composite state. In each region of the state machine or composite state it has a single transition to a vertex within the same region. An exit point pseudostate is an exit point of a state machine or composite state.

fork vertices serve to split an incoming transition into two or more transitions terminating on orthogonal target vertices (i.e., vertices in different regions of a composite state). The segments outgoing from a fork vertex must not have guards or triggers.

join vertices serve to merge several transitions emanating from source vertices in different orthogonal regions. The transitions entering a join vertex cannot have guards or triggers.

Ex:

21. Internal activities, activity states, superstates, concurrent states: definitions, description, examples.

Internal activities- Entry and exit events trigger internal activities

Can also define your own internal activities

Unlike self-transitions, internal activities do not trigger entry and exit special events

Activity states

• When object in a particular state, not always idly waiting for the next event

– Could be engaged in carrying out some activity

– Such a state is called an activity state

• “Searching” state is an activity state

• Ongoing activity indicated by “do/<activity>”

– Called a do-activity

• Once do-activity completed, transition without a label is taken

• If “cancel” event occurs during “do/search for new hardware” then do-activity is aborted immediately

• Do-activities can be interrupted but regular activities (actions) cannot

Superstates-

Sometimes, several states share common transitions

• Can move shared behaviour into a superstate

• Without superstate here, would have to have a “cancel” transition on each state within “Enter connection details”

Concurrent states-

• Composite state can be decomposed into two or more orthogonal, concurrent state machine diagrams

– Concurrent state machines separated by dashed line indicating concurrent boundary

• The choices CD/Radio and Time/Alarm time are orthogonal

• History pseudostate indicates that CD/Radio state machine goes back to state clock was in when switched off

– History pseudostate points to state that is active when no history

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]