ArchFm: projectionExample.fml

File projectionExample.fml, 1.2 KB (added by acher, 7 years ago)

FAMILIAR projection example (.fml)

Line 
1fmArch150 = FM ( Arch : Ar1 Ar2; Ar1: (Ar3|Ar4); Ar2 : (Ar5|Ar6); )
2fmPlugin = FM ( Plugin : (Pl1|Pl2|Pl3)+ ; Pl1 -> Pl2 ; )
3fmFull = aggregate { fmArch150 fmPlugin } withMapping constraints (Ar3 -> Pl1 ; Pl2 -> Ar5; )
4fmArch = slice fmFull including fmArch150.* // // enforced architectural FM
5
6// let us play with the models...
7sArch = configs fmArch
8nArch = counting fmArch
9
10// we know by construction that fmArch either a refactoring or a specialization of fmArch150
11cmp = compare fmArch150 fmArch
12//assert (cmp eq REFACTORING || cmp eq SPECIALIZATION)
13
14// or, equivalently, that the difference (or complement) bewteen the set of configurations of
15// fmArch and fmArch150 is empty
16dArch = merge diff { fmArch fmArch150 }
17assert (not (isValid dArch))
18
19// we now compute the difference bewteen the set of configurations of fmArch150 and fmArch
20// fmArch150Removal is an FM that compactly represents this difference
21fmArch150Removal = merge diff { fmArch150 fmArch }
22if (compare fmArch fmArch150 eq SPECIALIZATION) then
23            println "configurations removed from fmArch150="
24            smissing = configs fmArch150Removal
25            foreach (s in smissing) do
26                println s
27            end
28else
29        // refactoring
30    println "configurations of fmArch150 have not been modified"
31end