blob: 9d56cb51111514439d748419fb28edb2423758b2 [file] [log] [blame]
/**
* 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 java.util.Properties;
import org.eclipse.app4mc.slg.linux.generators.LinuxRunnableTranslationUnit;
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 LinuxRunnableTransformer extends LinuxBaseTransformer {
@Inject private LinuxActivityGraphItemTransformer linuxCallGraphItemTransformer;
@Inject private OutputBuffer outputBuffer;
@Inject private Properties properties;
public LinuxRunnableTranslationUnit transform(final org.eclipse.app4mc.amalthea.model.Runnable runnable) {
final ArrayList<?> key = CollectionLiterals.newArrayList(runnable);
final LinuxRunnableTranslationUnit _result;
synchronized (_createCache_transform) {
if (_createCache_transform.containsKey(key)) {
return _createCache_transform.get(key);
}
LinuxRunnableTranslationUnit _linuxRunnableTranslationUnit = new LinuxRunnableTranslationUnit(
this.outputBuffer, this.linuxCallGraphItemTransformer, runnable, this.properties);
_result = _linuxRunnableTranslationUnit;
_createCache_transform.put(key, _result);
}
_init_transform(_result, runnable);
return _result;
}
private final HashMap<ArrayList<?>, LinuxRunnableTranslationUnit> _createCache_transform = CollectionLiterals
.newHashMap();
private void _init_transform(final LinuxRunnableTranslationUnit it,
final org.eclipse.app4mc.amalthea.model.Runnable runnable) {
}
}