| /******************************************************************************* |
| * 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 |
| } |
| |
| } |