blob: 1740ae4481e7a652b38fc8bf1e6efc59c0096a08 [file] [log] [blame]
package templates
import com.inchron.realtime.root.RootFactory
import com.inchron.realtime.root.model.Model
import com.inchron.realtime.root.model.ModelFactory
import com.inchron.realtime.root.model.memory.MemoryFactory
import com.inchron.realtime.root.model.stimulation.StimulationFactory
import org.eclipse.app4mc.amalthea.model.Amalthea
import org.eclipse.app4mc.amalthea.model.AmaltheaFactory
import org.eclipse.app4mc.transformation.extensions.base.templates.AbstractTransformer
import org.eclipse.emf.ecore.EObject
class AbstractAmaltheaInchronTransformer extends AbstractTransformer{
public var Model inchronModel;
public var Amalthea amaltheaModel
/*- Factory initiaization */
public val inchronRootFactory = RootFactory.eINSTANCE
public val inchronModelFactory = ModelFactory.eINSTANCE
public val inchronmemoryFactory = MemoryFactory.eINSTANCE
public val inchronStimulationFactory = StimulationFactory.eINSTANCE
public val amaltheaFactory = AmaltheaFactory.eINSTANCE
public def OSTransformer getOSTransformerInstance(){
return customObjsStore.getInstance(OSTransformer)
}
public def HWTransformer getHWTransformerInstance(){
return customObjsStore.getInstance(HWTransformer)
}
public def SWTransformer getSWTransformerInstance(){
return customObjsStore.getInstance(SWTransformer)
}
public def StimuliTransformer getStimuliTransformerInstance(){
return customObjsStore.getInstance(StimuliTransformer)
}
public def static <T> T getParentContainer(EObject eObject, Class<T> cl)
{
var EObject result = null;
if (eObject != null)
{
for (var EObject parent = eObject.eContainer(); parent != null; parent = parent.eContainer())
{
if(cl.isAssignableFrom(parent.getClass())){
return parent as T;
}
}
}
return result as T;
}
}