blob: 63d372bac33044fa6cdcd300cdca84e2d9d89122 [file] [log] [blame]
/**
* *******************************************************************************
* 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.commons.m2t.transformers.sw
import com.google.inject.Inject
import com.google.inject.Singleton
import java.util.List
import org.eclipse.app4mc.amalthea.model.ActivityGraphItem
import org.eclipse.app4mc.amalthea.model.ChannelReceive
import org.eclipse.app4mc.amalthea.model.ChannelSend
import org.eclipse.app4mc.amalthea.model.LabelAccess
import org.eclipse.app4mc.amalthea.model.RunnableCall
import org.eclipse.app4mc.amalthea.model.Ticks
import org.eclipse.app4mc.slg.commons.m2t.generators.TicksTranslationUnit
import org.eclipse.app4mc.slg.commons.m2t.generators.TranslationUnit
import org.eclipse.app4mc.slg.commons.m2t.transformers.SLGBaseTransformer
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@Singleton
class ActivityGraphItemTransformer extends SLGBaseTransformer {
static final Logger LOG = LoggerFactory.getLogger(typeof(ActivityGraphItemTransformer))
@Inject RunnableTransformer runnableTransformer
@Inject LabelAccessTransformer labelAccessTransformer
@Inject TicksTransformer ticksTransformer
dispatch def TranslationUnit transform(ActivityGraphItem activityGraphItem) {
LOG.error("Unsupported element inside ActivityGraph : " + activityGraphItem.class.name)
return new TranslationUnit("undefined", "", "", "")
}
dispatch def TranslationUnit transform(RunnableCall runnableCall) {
return runnableTransformer.transform(runnableCall.runnable)
}
dispatch def TranslationUnit transform(Ticks ticks) {
return ticksTransformer.transform(ticks)
}
def List<TicksTranslationUnit> transformAllItems(Ticks ticks) {
return ticksTransformer.transformAllItems(ticks)
}
dispatch def TranslationUnit transform(LabelAccess labelAccess) {
return labelAccessTransformer.transform(labelAccess)
}
dispatch def TranslationUnit transform(ChannelReceive channelReceive) {
LOG.error("Unsupported element inside ActivityGraph : " + channelReceive.class.name)
return new TranslationUnit("undefined", "", "", "")
}
dispatch def TranslationUnit transform(ChannelSend channelSend) {
LOG.error("Unsupported element inside ActivityGraph : " + channelSend.class.name)
return new TranslationUnit("undefined", "", "", "")
}
}