Presentation is loading. Please wait.

Presentation is loading. Please wait.

INF 329 Sketching Statechart diagrams María Ángeles Martínez Ibáñez.

Similar presentations


Presentation on theme: "INF 329 Sketching Statechart diagrams María Ángeles Martínez Ibáñez."— Presentation transcript:

1 INF 329 Sketching Statechart diagrams María Ángeles Martínez Ibáñez

2 Reminder Statecharts are used to describe the behaviour of a system and describe all of the possible states of an object as events acting upon it. Its basic components are states (in which the system makes an action), transitions (represented by arrows) and triggers (causes transitions).

3 Statechart diagrams have complex node substructures but they can be made much closer to sketches.

4 As a Σ-sketch is composed by a graph, statecharts can be visualized as a tree (is a graph in which any two vertices are connected by exactly one path).

5 To make easier the diagrams’s visualization, many definitions we’ll be given:  S = {s 1, s 2, …, s n } is the set of states in the statechart with n>0

6  Ψ: S → {AND, OR} is a function that defines the hierarchichal descompostiion type of each state s  S. An OR-type descompostiion is used when a state is to be descomposed into a set of exclusive substates. An AND-type descomposition is used to descompose a state into parallel, or orthogonal, substates.

7  R с E x A is the set of labels formed by the set of ordered pairs (e,a) | e  E and a  A, where E is the set of events and A the set of actions.  T с 2 S x R x 2 S is the set of transitions. A transition t=(x,r,Y) is composed of a source set of states X, a target set of states Y and a label r  R.  Event E is the set of event expressions defined inductively as: let E p be the set of primitive events; then if e  E p then e  E; if c  C and e  E then e[c]  E.

8 Module 1

9 First aproximation Module 1 v Idle Active v Or-state DialTone Timeout DialingInvalid Connecting BusyRinging Pinned Talking

10  Set of states S = {Module1, Idle, Active, DialTone, Timeout, Dialing, Invalid, Connecting, Busy, Ringing, Pinned, Talkint}. Module1 is the root state.  Ψ (Module1) = {OR}, Ψ(Active)={OR}  The set of event expressions is given by E = {liftReceiver,callerHangsUp,after, DialDigit,…}  And the set of transitions T = {({Idle},liftReceiver,{Active}),({DialTone},after,{Tim eout}),…}

11 In this particular example we don’t have lots of possible configurations: SC 0 = {Idle,Module1} SC 1 = {DialTone,Active,Module1} SC 2 = {Timeout,Active,Module1} SC 3 = {Dialing,Active,Module1} … SC 9 = {Talking,Active,Module1}

12 To whom it concerns, we can treat the statechart as a tree, where nodes are the different configurations of it, and transitions are functions which change the node in mentioned tree. If we consider the previous example, the new tree will be something like this:

13 SC 0 = {Idle,Module1} SC 1 = {DialTone,Active,Module1} SC 2 = {Timeout,Active,Module1} SC 3 = {Dialing,Active,Module1} … t 1 = ({Idle},liftReceiver,{Active}) t 2 = ({DialTone},after,{Timeout}) t 3 = ({DialTone},callerHangsUp,{Idle}) t 4 = ({DialTone},dialDigit,{Dialing}) … SC 0 SC 1 SC 2 SC 3 … t3t3 t2t2 t4t4

14 Σ-sketch S D ≈ Diagram D For any statechart diagram D, its sketch will be represented by a tree. Firstly is necessary trace a model, for this we’ll draw a “tree” where nodes are the different states that we have in the statechart, the “levels” will mark the hierarchy and.

15 Σ-sketch S D ≈ Diagram D If the “conexión” between the nodes is an OR-state, it will be marked by the predicate [disj], because only can be “active” one of all the states. The opossite happens with AND-state, all the states are “active” at the same time.

16 Σ-sketch S D ≈ Diagram D Once have this previous tree, we are able to define the real statechart’s sketch by, as has been shown, establishing the nodes as the different configurations, and the functions (conexion between nodes) marked with the different events, being the domain of the function the node’s actual configuration, and the codomain the new configuration.

17 Statechart’s signature Σ A statechart diagram D = (Object D, Class D, States D, Initial D, Transitions D ) is given by an object name Object D, a class name Class D, a set of states States D, an initial state Initial D, and a set of transitions Transitions D. States D is a set of tuples S = (name(S), kind(S), entry(S), init(S), state(S), internal(S), exit(S)) where: *name(S) is the name of the state, *kind(S)  {initial, final, simple, concurrent, seq} *entry(S)  Action is called the entry action,

18 Statechart’s signature Σ *init(S)  States D U {undef} is the initial substate, *state(S)  States D in the set of substates of S, *internal(S)  Activity is the internal activity, *exit(S)  Action is the exit action, under the following conditions: *for states S,T  States D with S  T we have name(S)  name(T) and state(S)∩state(T) = emptySet, *for all S  States D.init(S)  state(S) and S  state(S), *kind(S)  {initial, final, simple} => state(S) = emptySet

19 Statechart’s signature Σ *if kind(S)  {initial, final}, we have entry(S) = nil, internal(S) = nil, and exit(S) = nil *kind(S)  {concurrent,seq} => internal(S) =nil, *if kind(S) = concurrent, we have init(S) = undef. Transitions D is a set of tuples t = (source(t), event(t), guard(t),action(t),target(t),intern(t)) where: *source(t)  States D is the source state of t, *event(t)  Events is the triggering event of t, *guard(t)  BoolExp is a Boolean expression,

20 Statechart’s signature Σ *action(t)  Action is an action, *target(t)  States D is the target state of t, and *intern(t)  Bool is a Boolean. event(t) must be of the form op(exp 1, …, exp n )  Events where exp 1, …, exp n  Var are variables (called parameters), which must be mutually distinct. We assume a special event ComplEv  Events (with no parameters) and call a transition t with event(t) = true then t is called an internal transition, otherwise it is called external.


Download ppt "INF 329 Sketching Statechart diagrams María Ángeles Martínez Ibáñez."

Similar presentations


Ads by Google