-
Notifications
You must be signed in to change notification settings - Fork 0
/
HSM2FSM.atl
42 lines (34 loc) · 1.83 KB
/
HSM2FSM.atl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
module HSM2FSM;
create OUT : FSM from IN : HSM;
rule SM2SM {
from sm1 : HSM!StateMachine
to sm2 : FSM!StateMachine
}
rule RS2RS {
from rs1 : HSM!RegularState
to rs2 : FSM!RegularState ( name <- rs1.name,stateMachine <- rs1.stateMachine )
}
-- Initial states of composite states become regular states in the flattened SM
rule IS2RS {
from is1 : HSM!InitialState (not is1.compositeState.oclIsUndefined())
to is2 : FSM!RegularState ( stateMachine <- is1.stateMachine, name <- is1.name )
}
-- mapping each transition, that between two noncomposite states, of the source model into the target model.
rule T2TA {
from t1 : HSM!Transition ( not t1.source.oclIsTypeOf(HSM!CompositeState) and not t1.target.oclIsTypeOf(HSM!CompositeState))
to t2 : FSM!Transition ( label <- t1.label, stateMachine <- t1.stateMachine, source <- t1.source, target <- t1.target )
}
-- mapping each transition, whose source is a composite state, of the source model into the target model.
rule T2TB {
from t1 : HSM!Transition, src : HSM!CompositeState, trg : HSM!AbstractState, c : HSM!AbstractState
( t1.source = src and t1.target = trg and c.compositeState = src and
not c.oclIsTypeOf(HSM!CompositeState) and not trg.oclIsTypeOf(HSM!CompositeState))
to t2 : FSM!Transition
( label <- t1.label, stateMachine <- t1.stateMachine, source <- c, target <- trg ) }
-- mapping each transition, whose target is a composite state, of the source model into the target model.
rule T2TC {
from t1 : HSM!Transition, src : HSM!AbstractState, trg : HSM!CompositeState, c : HSM!InitialState
( t1.source = src and t1.target = trg and c.compositeState = trg
and not src.oclIsTypeOf(HSM!CompositeState) )
to t2 : FSM!Transition
( label <- t1.label, stateMachine <- t1.stateMachine, source <- src, target <- c }