| /** |
| * Copyright (c) 2020-2021 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.Label; |
| import org.eclipse.app4mc.slg.linux.generators.LinuxLabelTranslationUnit; |
| 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 LinuxLabelTransformer extends LinuxBaseTransformer { |
| |
| @Inject private OutputBuffer outputBuffer; |
| |
| public LinuxLabelTranslationUnit transform(final Label label) { |
| final ArrayList<?> key = CollectionLiterals.newArrayList(label); |
| final LinuxLabelTranslationUnit _result; |
| synchronized (_createCache_transform) { |
| if (_createCache_transform.containsKey(key)) { |
| return _createCache_transform.get(key); |
| } |
| LinuxLabelTranslationUnit _linuxLabelTranslationUnit = new LinuxLabelTranslationUnit(this.outputBuffer, |
| label); |
| _result = _linuxLabelTranslationUnit; |
| _createCache_transform.put(key, _result); |
| } |
| _init_transform(_result, label); |
| return _result; |
| } |
| |
| private final HashMap<ArrayList<?>, LinuxLabelTranslationUnit> _createCache_transform = CollectionLiterals |
| .newHashMap(); |
| |
| private void _init_transform(final LinuxLabelTranslationUnit it, final Label label) { |
| } |
| |
| } |