Zakir Meer | bbbbdfe | 2019-02-21 14:22:47 +0100 | [diff] [blame^] | 1 | package templates.m2m.sw; |
| 2 | |
| 3 | import java.util.Map |
| 4 | import org.eclipse.app4mc.amalthea.model.ModeLabel |
| 5 | import org.eclipse.app4mc.amalthea.model.ModeLiteral |
| 6 | import org.eclipse.app4mc.amalthea.model.ModeValue |
| 7 | import org.eclipse.app4mc.amalthea.model.ModeValueConjunction |
| 8 | import org.eclipse.app4mc.amalthea.model.ModeValueDisjunction |
| 9 | import org.eclipse.app4mc.amalthea.model.Process |
| 10 | import templates.AbstractAmaltheaInchronTransformer |
| 11 | import templates.utils.AmltCacheModel |
| 12 | |
| 13 | public class ModeValueDisjunctionTransformer extends AbstractAmaltheaInchronTransformer { |
| 14 | |
| 15 | var AmltCacheModel cacheModel |
| 16 | |
| 17 | public 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 | } |