edu.cmu.sei.aadl.instance
Class CreateConnectionsSwitch

java.lang.Object
  extended by edu.cmu.sei.aadl.modelsupport.modeltraversal.ForAllElement
      extended by edu.cmu.sei.aadl.modelsupport.modeltraversal.AadlProcessingSwitch
          extended by edu.cmu.sei.aadl.modelsupport.modeltraversal.AadlProcessingSwitchWithProgress
              extended by edu.cmu.sei.aadl.instance.CreateConnectionsSwitch

public class CreateConnectionsSwitch
extends AadlProcessingSwitchWithProgress

This class adds all connection instances to an instance model.


Field Summary
 
Fields inherited from class edu.cmu.sei.aadl.modelsupport.modeltraversal.AadlProcessingSwitchWithProgress
monitor
 
Fields inherited from class edu.cmu.sei.aadl.modelsupport.modeltraversal.AadlProcessingSwitch
aadl2Switch, copyright, DONE, INSTANCE, instanceSwitch, NOT_DONE
 
Fields inherited from class edu.cmu.sei.aadl.modelsupport.modeltraversal.ForAllElement
DEFAULT_DEFAULT_TRAVERSAL, NO_DEFAULT, PROCESS_BOTTOM_UP_COMPONENT_IMPL, PROCESS_POST_ORDER_ALL, PROCESS_PRE_ORDER_ALL, PROCESS_TOP_DOWN_COMPONENT_CLASSIFIER, PROCESS_TOP_DOWN_COMPONENT_IMPL, resultList
 
Constructor Summary
CreateConnectionsSwitch(org.eclipse.core.runtime.IProgressMonitor pm, AnalysisErrorReporterManager errMgr, java.util.HashMap<InstanceObject,InstanceUtil.InstantiatedClassifier> classifierCache)
          Create a new instance.
 
Method Summary
protected  ConnectionInstance addConnectionInstance(SystemInstance systemInstance, edu.cmu.sei.aadl.instance.CreateConnectionsSwitch.ConnectionInfo connInfo, ConnectionInstanceEnd dstI)
           
 java.util.List<Connection> filterIncomingConnection(java.util.List<Connection> incomingconnlist, Feature feature)
          get incoming connections for specified feature This method does not work on subcomponent, because we need the enclosing subcomponent rather than the enclosing component implementation in order to get the subcomponent inheritance correct Otherwise the incorrect connections get picked up
 java.util.List<Connection> filterOutgoingConnections(java.util.List<Connection> conns, Feature feature)
          Get outgoing connections for specified feature port group connections are non-directional, i.e., they are always added
protected  java.util.List<Connection> filterStartingConnections(java.util.List<Connection> connlist, Subcomponent sub)
          Filter all (port or access) connections that start with a subcomponent.
protected  void finalizeConnectionInstance(ComponentInstance parentci, edu.cmu.sei.aadl.instance.CreateConnectionsSwitch.ConnectionInfo connInfo, ComponentInstance dstCi)
           
protected  void finalizeConnectionInstance(ComponentInstance parentci, edu.cmu.sei.aadl.instance.CreateConnectionsSwitch.ConnectionInfo connInfo, FeatureInstance dstFi)
           
protected  void initSwitches()
          Subclasses override this method to set the switch fields #coreSwitch,#componentSwitch, #connectionSwitch,#featureSwitch,#flowSwitch, AadlProcessingSwitch.instanceSwitch, and #propertySwitchto analysis-specific switch implementations.
 boolean isConnectionEnd(java.util.List<Connection> conns, Feature feature)
          Check if one of the connections in a list has a feature as its end.
 boolean isDestination(java.util.List<Connection> conns, Feature feature)
          Check if one of the connections in a list points to a feature.
 
Methods inherited from class edu.cmu.sei.aadl.modelsupport.modeltraversal.AadlProcessingSwitchWithProgress
checkIfCancelled
 
Methods inherited from class edu.cmu.sei.aadl.modelsupport.modeltraversal.AadlProcessingSwitch
getAadl2Switch, getInstanceSwitch, process
 
Methods inherited from class edu.cmu.sei.aadl.modelsupport.modeltraversal.ForAllElement
action, cancelled, cancelTraversal, defaultTraversal, defaultTraversal, defaultTraversalAllDeclarativeModels, defaultTraversalAllInstances, error, error, getErrorManager, getResultList, info, info, internalError, internalError, notCancelled, processAllComponentImpl, processBottomUpComponentImpl, processBottomUpComponentImpl, processEList, processObject, processPostOrderAll, processPostOrderAll, processPostOrderAll, processPostOrderAllDeclarativeModels, processPostOrderAllInstances, processPostOrderComponentInstance, processPostOrderComponentInstance, processPreOrderAll, processPreOrderAll, processPreOrderAll, processPreOrderAllDeclarativeModels, processPreOrderAllInstances, processPreOrderComponentInstance, processPreOrderComponentInstance, processResources, processResources, processResourcesIgnoreFailure, processTopDownComponentClassifier, processTopDownComponentClassifierAllDeclarativeModels, processTopDownComponentImpl, processTopDownComponentImpl, processTree, processTreeIgnoreFailure, suchThat, warning, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CreateConnectionsSwitch

public CreateConnectionsSwitch(org.eclipse.core.runtime.IProgressMonitor pm,
                               AnalysisErrorReporterManager errMgr,
                               java.util.HashMap<InstanceObject,InstanceUtil.InstantiatedClassifier> classifierCache)
Create a new instance.

Parameters:
pm - the progress monitor
errMgr - the error manager
classifierCache - cache of known instantiated classifiers, may be null
Method Detail

initSwitches

protected void initSwitches()
Description copied from class: AadlProcessingSwitch
Subclasses override this method to set the switch fields #coreSwitch,#componentSwitch, #connectionSwitch,#featureSwitch,#flowSwitch, AadlProcessingSwitch.instanceSwitch, and #propertySwitchto analysis-specific switch implementations. Implementaions should take care, however, as this method is invoked by the constructor AadlProcessingSwitch.AadlProcessingSwitch(). Only the switches that are actually needed need to be initialized, as the switch fields are previously inialized to default do-nothing switch implementations.

Specified by:
initSwitches in class AadlProcessingSwitch

finalizeConnectionInstance

protected void finalizeConnectionInstance(ComponentInstance parentci,
                                          edu.cmu.sei.aadl.instance.CreateConnectionsSwitch.ConnectionInfo connInfo,
                                          FeatureInstance dstFi)

finalizeConnectionInstance

protected void finalizeConnectionInstance(ComponentInstance parentci,
                                          edu.cmu.sei.aadl.instance.CreateConnectionsSwitch.ConnectionInfo connInfo,
                                          ComponentInstance dstCi)

addConnectionInstance

protected ConnectionInstance addConnectionInstance(SystemInstance systemInstance,
                                                   edu.cmu.sei.aadl.instance.CreateConnectionsSwitch.ConnectionInfo connInfo,
                                                   ConnectionInstanceEnd dstI)

filterStartingConnections

protected java.util.List<Connection> filterStartingConnections(java.util.List<Connection> connlist,
                                                               Subcomponent sub)
Filter all (port or access) connections that start with a subcomponent.

Parameters:
connlist - all connections in the component instance that contains the subcomponent
sub - a subcomponent
Returns:
the connections from connlist that start with the subcomponent

filterIncomingConnection

public java.util.List<Connection> filterIncomingConnection(java.util.List<Connection> incomingconnlist,
                                                           Feature feature)
get incoming connections for specified feature This method does not work on subcomponent, because we need the enclosing subcomponent rather than the enclosing component implementation in order to get the subcomponent inheritance correct Otherwise the incorrect connections get picked up

Parameters:
incomingconnlist -
feature - subcomponent feature that is the destination of a connection
Returns:
connections with feature as destination

filterOutgoingConnections

public java.util.List<Connection> filterOutgoingConnections(java.util.List<Connection> conns,
                                                            Feature feature)
Get outgoing connections for specified feature port group connections are non-directional, i.e., they are always added

Parameters:
conns - a list of connections that go away from a subcomponent
feature - subcomponent feature that can be the source of a connection
Returns:
connections with feature as source for ConnectionInstances

isDestination

public boolean isDestination(java.util.List<Connection> conns,
                             Feature feature)
Check if one of the connections in a list points to a feature.

Parameters:
conns - a list of connections owned by a subcomponent
feature - a subcomponent feature
Returns:
whether one of the connections points to the feature

isConnectionEnd

public boolean isConnectionEnd(java.util.List<Connection> conns,
                               Feature feature)
Check if one of the connections in a list has a feature as its end.

Parameters:
conns - a list of connections owned by a subcomponent
feature - a subcomponent feature
Returns:
whether the feature is an end of one of the connections