de.cau.cs.kieler.kaom.importer.ptolemy
Class PtolemyHelper

java.lang.Object
  extended by de.cau.cs.kieler.kaom.importer.ptolemy.PtolemyHelper
All Implemented Interfaces:
org.eclipse.xtend.expression.IExecutionContextAware

public class PtolemyHelper
extends Object
implements org.eclipse.xtend.expression.IExecutionContextAware

Helper methods to inspect Ptolemy models. Could be used from Xtend transformations.

Rating red

Constructor Summary
PtolemyHelper()
          Constructs a new instance.
 
Method Summary
 List<Port> getPorts(List<EObject> entities)
          Returns a list of all the ports of the given entity types or class types.
 List<Port> getPorts(NamedObj actor)
          Returns a list of ports of the given actor.
 NamedObj instantiatePtolemyEntity(ClassType classType)
          Instanciate a Ptolemy Entity for a given ClassType model object.
 NamedObj instantiatePtolemyEntity(EntityType entity)
          Instanciate a Ptolemy Entity for a given EntityType model object.
 NamedObj instantiatePtolemyEntity(String className)
          Instantiate a Ptolemy entity with the given class name.
 void setExecutionContext(org.eclipse.xtend.expression.ExecutionContext context)
          Execution context is set by Xtend component from outside.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PtolemyHelper

public PtolemyHelper()
Constructs a new instance.

Method Detail

getPorts

public List<Port> getPorts(List<EObject> entities)
                    throws ClassNotFoundException
Returns a list of all the ports of the given entity types or class types.

Parameters:
entities - the entity or class types whose ports to return.
Returns:
list of ports.
Throws:
ClassNotFoundException - if the actor could not be resolved.

getPorts

public List<Port> getPorts(NamedObj actor)
                    throws ClassNotFoundException
Returns a list of ports of the given actor. To obtain an actor instance from an entity type, class type or a simple class name, use one of the instantiatePtolemyEntity(...) methods.

Parameters:
actor - the actor whose ports to return.
Returns:
list of ports.
Throws:
ClassNotFoundException - if the actor could not be resolved.

instantiatePtolemyEntity

public NamedObj instantiatePtolemyEntity(EntityType entity)
                                  throws Exception
Instanciate a Ptolemy Entity for a given EntityType model object.

Parameters:
entity - given EMF EntityType model object
Returns:
corresponding Ptolemy object
Throws:
Exception - may throw different Exceptions during parsing

instantiatePtolemyEntity

public NamedObj instantiatePtolemyEntity(ClassType classType)
                                  throws Exception
Instanciate a Ptolemy Entity for a given ClassType model object.

Parameters:
classType - given EMF ClassType model object
Returns:
corresponding Ptolemy object
Throws:
Exception - may throw different Exceptions during parsing

instantiatePtolemyEntity

public NamedObj instantiatePtolemyEntity(String className)
                                  throws Exception
Instantiate a Ptolemy entity with the given class name.

Parameters:
className - the class name of the actor to instantiate.
Returns:
corresponding Ptolemy object.
Throws:
Exception - may throw different exceptions during parsing.

setExecutionContext

public void setExecutionContext(org.eclipse.xtend.expression.ExecutionContext context)
Execution context is set by Xtend component from outside. It can be used to obtain detailed information about the transformation.

This implementation currently does nothing since the execution context is not used at the moment.

Specified by:
setExecutionContext in interface org.eclipse.xtend.expression.IExecutionContextAware
Parameters:
context - the execution context.