blob: 087f87f0fe92310433cf7b79c0dfc65a5f06e305 [file] [log] [blame]
Zakir Meerbbbbdfe2019-02-21 14:22:47 +01001package templates.m2m.sw;
2
3import java.util.Map
4import org.eclipse.app4mc.amalthea.model.ModeLabel
5import org.eclipse.app4mc.amalthea.model.ModeLiteral
6import org.eclipse.app4mc.amalthea.model.ModeValue
7import org.eclipse.app4mc.amalthea.model.ModeValueConjunction
8import org.eclipse.app4mc.amalthea.model.ModeValueDisjunction
9import org.eclipse.app4mc.amalthea.model.Process
10import templates.AbstractAmaltheaInchronTransformer
11import templates.utils.AmltCacheModel
12
13public class ModeValueDisjunctionTransformer extends AbstractAmaltheaInchronTransformer {
14
15var AmltCacheModel cacheModel
16
17public def create inchronModelFactory.createModeCondition createModeCondition(ModeValueDisjunction amltModeValueDisjunction,Process amltTask,
18 Map<Process, com.inchron.realtime.root.model.Process> amltProcess_inchronProcessMap){
19
20 cacheModel = customObjsStore.getInstance(AmltCacheModel)
21
22 amltModeValueDisjunction?.entries?.forEach[amltModeValueDisjunctionEntry|{
23
24 val inchronModeConjunction=inchronModelFactory.createModeConjunction
25 //Adding ModeConjunction
26 it.conjunctions.add(inchronModeConjunction)
27
28
29 if(amltModeValueDisjunctionEntry instanceof ModeValue){
30
31 }else if(amltModeValueDisjunctionEntry instanceof ModeValueConjunction){
32
33 amltModeValueDisjunctionEntry?.entries?.forEach[amltModeValueEntry|{
34
35 var amltModeLiteral=amltModeValueEntry.value
36 var amltModeValueProvider=amltModeValueEntry.valueProvider
37 //Adding Mode
38 inchronModeConjunction.modes.add(createMode(amltModeLiteral,amltModeValueProvider))
39
40 }]
41 }
42 }]
43 }
44
45
46
47 public def create inchronModelFactory.createMode createMode(ModeLiteral amltModeLiteral, ModeLabel amltModeLabel){
48
49 it.name=amltModeLiteral.name
50
51 var inchronModeGroup=cacheModel.getInchronModeGroup(amltModeLiteral?.containingMode?.name)
52
53 if(inchronModeGroup!==null){
54 inchronModeGroup.modes.add(it)
55 }
56
57 }
58}