blob: 5d0f31954fcf1b1e7d8ee51486b920582e6a745d [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2018 Robert Bosch GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Robert Bosch GmbH - initial API and implementation
*******************************************************************************/
package templates
import SampleModel.Model
import SampleModel.SampleModelFactory
import org.eclipse.app4mc.amalthea.model.AmaltheaFactory
import org.eclipse.app4mc.amalthea.model.MappingModel
import org.eclipse.app4mc.amalthea.model.TaskScheduler
import org.eclipse.app4mc.transformation.extensions.base.templates.AbstractTransformer
public class MappingTransformer extends AbstractTransformer {
def HWTransformer hwTransformer() {
return customObjsStore.getInstance(HWTransformer)
}
def OSTransformer osTransformer() {
return customObjsStore.getInstance(OSTransformer)
}
/*- Factory initialization */
val outputModelFactory = SampleModelFactory.eINSTANCE
val amaltheaFactory = AmaltheaFactory.eINSTANCE
public def transfromMappingModel(MappingModel amltMappingModel, Model simulationModel) {
amltMappingModel?.schedulerAllocation?.forEach [ amltSA |
if (amltSA.scheduler instanceof TaskScheduler) {
val simulationModelScheduler = osTransformer.createScheduler(amltSA.scheduler as TaskScheduler)
if (simulationModelScheduler.eContainer === null) {
simulationModel.schedulers.add(simulationModelScheduler)
}
}
]
}
}