blob: 06ee7130fddd1b58cb7a20de06d6640e817a4e5c [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2018, 2020 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.OSModel
import org.eclipse.app4mc.transformation.extensions.base.templates.AbstractTransformer
import org.eclipse.app4mc.transformation.extensions.base.templates.ISubTransformer
import org.osgi.service.component.annotations.Component
import org.osgi.service.component.annotations.ServiceScope
import org.eclipse.app4mc.amalthea.model.TaskScheduler
@Component(scope=ServiceScope.PROTOTYPE,service =OSTransformer)
public class OSTransformer extends AbstractTransformer implements ISubTransformer{
/*- Factory initiaization */
val outputModelFactory = SampleModelFactory.eINSTANCE
public def transfromOSModel(OSModel amaltheaOSModel, Model simulationModel) {
amaltheaOSModel.operatingSystems.forEach [ amltOs |
amltOs.taskSchedulers.forEach [a|
var simulationScheduler = createScheduler(a as TaskScheduler)
if (simulationScheduler.eContainer === null) {
simulationModel.schedulers.add(simulationScheduler)
}
]
]
}
def create outputModelFactory.createScheduler createScheduler(TaskScheduler amltTs) {
name = amltTs.name
}
}