blob: 7c9f76b4777b6ec101a70d7b2ee6d70f7e506d3b [file] [log] [blame]
/**
********************************************************************************
* Copyright (c) 2018-2019 Robert Bosch GmbH.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Robert Bosch GmbH - initial API and implementation
********************************************************************************
*/
package templates.m2m.sw
import com.google.inject.Inject
import com.inchron.realtime.root.model.Component
import org.eclipse.app4mc.amalthea.model.RunnableCall
import org.eclipse.app4mc.amalthea.model.Ticks
import templates.AbstractAmaltheaInchronTransformer
import templates.m2m.sw.runnableItem.RunnableCallTransformer
import templates.m2m.sw.runnableItem.TicksTransformer
import org.eclipse.app4mc.amalthea.model.RunnableItem
import com.inchron.realtime.root.model.CallSequenceItem
import org.eclipse.app4mc.amalthea.model.RunnableModeSwitch
import java.util.List
import org.eclipse.app4mc.amalthea.model.CustomEventTrigger
import com.google.inject.Singleton
@Singleton
class RunnableItemTransformer extends AbstractAmaltheaInchronTransformer{
@Inject RunnableCallTransformer runnableCallTransformer
@Inject TicksTransformer ticksTransformer
@Inject ModeSwitchTransformer modeSwitchTransformer
@Inject CustomEventTriggerTransformer customEventTriggerTransformer
def List<CallSequenceItem> transformRunnableItem(Component inchronComponent, org.eclipse.app4mc.amalthea.model.Process amltTask,
RunnableItem amltRunnableItem) {
val List<CallSequenceItem> list=newArrayList
if (amltRunnableItem instanceof RunnableCall) {
var inchronFunctionCall = runnableCallTransformer.createFunctionCall(inchronComponent, amltTask,
amltRunnableItem)
list.add(inchronFunctionCall)
} else if (amltRunnableItem instanceof Ticks) {
var inchronResourceConsumption = ticksTransformer.createResourceConsumption(amltTask, amltRunnableItem)
list.add(inchronResourceConsumption)
}else if(amltRunnableItem instanceof RunnableModeSwitch){
var inchronFunctionCall = modeSwitchTransformer.transformRunnableModeSwitch(inchronComponent, amltTask,amltRunnableItem)
list.add(inchronFunctionCall)
} else if(amltRunnableItem instanceof CustomEventTrigger){
var inchronFunctionCall = customEventTriggerTransformer.transformCustomEventTrigger(inchronComponent, amltTask,amltRunnableItem)
list.add(inchronFunctionCall)
}
return list
}
}