blob: 9806951a45bd5033f2e19ae88efc953769b91074 [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.Arrays;
import org.eclipse.app4mc.amalthea.model.ActivityGraphItem;
import org.eclipse.app4mc.amalthea.model.LabelAccess;
import org.eclipse.app4mc.amalthea.model.Ticks;
import org.eclipse.app4mc.slg.linux.transformers.LinuxBaseTransformer;
import org.eclipse.app4mc.slg.linux.transformers.LinuxTranslationUnit;
import com.google.inject.Inject;
public class LinuxActivityGraphItemTransformer extends LinuxBaseTransformer {
@Inject private LinuxLabelAccessTransformer linuxLabelAccessTransformer;
@Inject private LinuxTicksTransformer linuxTicksTransformer;
public LinuxTranslationUnit transform(final ActivityGraphItem graphItem) {
if (graphItem instanceof LabelAccess) {
return linuxLabelAccessTransformer.transform((LabelAccess) graphItem);
} else if (graphItem instanceof Ticks) {
return linuxTicksTransformer.transform((Ticks) graphItem);
} else if (graphItem != null) {
String warning = "/*[feature " + graphItem.eClass().getName() + " in not supported]";
return new LinuxTranslationUnit(warning);
} else {
throw new IllegalArgumentException(
"Unhandled parameter types: " + Arrays.<Object>asList(graphItem).toString());
}
}
}