| /** |
| * Copyright (c) 2020 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 org.eclipse.app4mc.slg.linux.transformers.sw; |
| |
| import java.util.ArrayList; |
| import java.util.HashMap; |
| |
| import org.eclipse.app4mc.amalthea.model.Task; |
| import org.eclipse.app4mc.slg.linux.generators.LinuxTaskTranslationUnit; |
| import org.eclipse.app4mc.slg.linux.transformers.LinuxBaseTransformer; |
| import org.eclipse.app4mc.transformation.util.OutputBuffer; |
| import org.eclipse.xtext.xbase.lib.CollectionLiterals; |
| |
| import com.google.inject.Inject; |
| import com.google.inject.Singleton; |
| |
| @Singleton |
| public class LinuxTaskTransformer extends LinuxBaseTransformer { |
| |
| @Inject private OutputBuffer outputBuffer; |
| |
| public LinuxTaskTranslationUnit transform(final Task task) { |
| final ArrayList<?> key = CollectionLiterals.newArrayList(task); |
| final LinuxTaskTranslationUnit _result; |
| synchronized (_createCache_transform) { |
| if (_createCache_transform.containsKey(key)) { |
| return _createCache_transform.get(key); |
| } |
| LinuxTaskTranslationUnit _linuxTaskTranslationUnit = new LinuxTaskTranslationUnit(this.outputBuffer, task); |
| _result = _linuxTaskTranslationUnit; |
| _createCache_transform.put(key, _result); |
| } |
| _init_transform(_result, task); |
| return _result; |
| } |
| |
| private final HashMap<ArrayList<?>, LinuxTaskTranslationUnit> _createCache_transform = CollectionLiterals |
| .newHashMap(); |
| |
| private void _init_transform(final LinuxTaskTranslationUnit it, final Task task) { |
| } |
| |
| } |