| /** |
| * 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.slg.commons.m2t.CustomObjectsStore; |
| import org.eclipse.app4mc.slg.config.ConfigModel; |
| import org.eclipse.app4mc.slg.linux.generators.LinuxRealisiticSyntheticTranslationUnit; |
| 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 LinuxRealisticCodeTransformer extends LinuxBaseTransformer { |
| |
| @Inject private OutputBuffer outputBuffer; |
| @Inject private CustomObjectsStore customObjsStore; |
| |
| public LinuxRealisiticSyntheticTranslationUnit transform() { |
| final ArrayList<?> key = CollectionLiterals.newArrayList(); |
| final LinuxRealisiticSyntheticTranslationUnit _result; |
| synchronized (_createCache_transform) { |
| if (_createCache_transform.containsKey(key)) { |
| return _createCache_transform.get(key); |
| } |
| ConfigModel _instance = this.customObjsStore.<ConfigModel>getInstance(ConfigModel.class); |
| LinuxRealisiticSyntheticTranslationUnit _linuxRealisiticSyntheticTranslationUnit = new LinuxRealisiticSyntheticTranslationUnit( |
| this.outputBuffer, _instance); |
| _result = _linuxRealisiticSyntheticTranslationUnit; |
| _createCache_transform.put(key, _result); |
| } |
| _init_transform(_result); |
| return _result; |
| } |
| |
| private final HashMap<ArrayList<?>, LinuxRealisiticSyntheticTranslationUnit> _createCache_transform = CollectionLiterals |
| .newHashMap(); |
| |
| private void _init_transform(final LinuxRealisiticSyntheticTranslationUnit it) { |
| } |
| |
| } |