use of org.osate.aadl2.instance.ModeInstance in project osate2 by osate.
the class SOMChooserDialog method componentExistsInCurrentMode.
private boolean componentExistsInCurrentMode(ComponentInstance component) {
if (component instanceof SystemInstance) {
return true;
}
ComponentInstance parentComponent = component;
do {
component = parentComponent;
parentComponent = parentComponent.getContainingComponentInstance();
if (selectedModes.containsKey(parentComponent)) {
final ModeInstance mode = selectedModes.get(parentComponent);
if (mode == null || (component.getInModes().size() > 0 && !component.getInModes().contains(mode))) {
return false;
}
}
} while (!(parentComponent instanceof SystemInstance));
return true;
}
use of org.osate.aadl2.instance.ModeInstance in project osate2 by osate.
the class InstancePackageImpl method initializePackageContents.
/**
* Complete the initialization of the package and its meta-model. This
* method is guarded to have no affect on any invocation but its first.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void initializePackageContents() {
if (isInitialized) {
return;
}
isInitialized = true;
// Initialize package
setName(eNAME);
setNsPrefix(eNS_PREFIX);
setNsURI(eNS_URI);
// Obtain other dependent packages
Aadl2Package theAadl2Package = (Aadl2Package) EPackage.Registry.INSTANCE.getEPackage(Aadl2Package.eNS_URI);
// Create type parameters
// Set bounds for type parameters
// Add supertypes to classes
featureInstanceEClass.getESuperTypes().add(getConnectionInstanceEnd());
featureInstanceEClass.getESuperTypes().add(getInstanceObject());
instanceObjectEClass.getESuperTypes().add(theAadl2Package.getNamedElement());
annexInstanceEClass.getESuperTypes().add(theAadl2Package.getNamedElement());
propertyAssociationInstanceEClass.getESuperTypes().add(theAadl2Package.getPropertyAssociation());
connectionInstanceEndEClass.getESuperTypes().add(getInstanceObject());
connectionInstanceEClass.getESuperTypes().add(getFlowElementInstance());
flowElementInstanceEClass.getESuperTypes().add(getInstanceObject());
systemOperationModeEClass.getESuperTypes().add(theAadl2Package.getMode());
modeInstanceEClass.getESuperTypes().add(getInstanceObject());
modeTransitionInstanceEClass.getESuperTypes().add(getConnectionInstanceEnd());
modeTransitionInstanceEClass.getESuperTypes().add(getInstanceObject());
connectionReferenceEClass.getESuperTypes().add(getInstanceObject());
componentInstanceEClass.getESuperTypes().add(getConnectionInstanceEnd());
componentInstanceEClass.getESuperTypes().add(getFlowElementInstance());
flowSpecificationInstanceEClass.getESuperTypes().add(getFlowElementInstance());
endToEndFlowInstanceEClass.getESuperTypes().add(getFlowElementInstance());
systemInstanceEClass.getESuperTypes().add(getComponentInstance());
instanceReferenceValueEClass.getESuperTypes().add(theAadl2Package.getPropertyValue());
// Initialize classes and features; add operations and parameters
initEClass(// $NON-NLS-1$
featureInstanceEClass, // $NON-NLS-1$
FeatureInstance.class, // $NON-NLS-1$
"FeatureInstance", // $NON-NLS-1$
!IS_ABSTRACT, // $NON-NLS-1$
!IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getFeatureInstance_SrcFlowSpec(), getFlowSpecificationInstance(), // $NON-NLS-1$
getFlowSpecificationInstance_Source(), // $NON-NLS-1$
"srcFlowSpec", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, // $NON-NLS-1$
FeatureInstance.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(getFeatureInstance_DstFlowSpec(), getFlowSpecificationInstance(), // $NON-NLS-1$
getFlowSpecificationInstance_Destination(), // $NON-NLS-1$
"dstFlowSpec", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, // $NON-NLS-1$
FeatureInstance.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(// $NON-NLS-1$
getFeatureInstance_FeatureInstance(), // $NON-NLS-1$
getFeatureInstance(), // $NON-NLS-1$
null, // $NON-NLS-1$
"featureInstance", // $NON-NLS-1$
null, 0, -1, FeatureInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEAttribute(// $NON-NLS-1$
getFeatureInstance_Category(), // $NON-NLS-1$
getFeatureCategory(), // $NON-NLS-1$
"category", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
1, FeatureInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEAttribute(// $NON-NLS-1$
getFeatureInstance_Direction(), // $NON-NLS-1$
theAadl2Package.getDirectionType(), // $NON-NLS-1$
"direction", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
1, FeatureInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(// $NON-NLS-1$
getFeatureInstance_Feature(), // $NON-NLS-1$
theAadl2Package.getFeature(), // $NON-NLS-1$
null, // $NON-NLS-1$
"feature", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
1, FeatureInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEAttribute(// $NON-NLS-1$
getFeatureInstance_Index(), // $NON-NLS-1$
theAadl2Package.getInteger(), // $NON-NLS-1$
"index", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
1, FeatureInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEClass(// $NON-NLS-1$
instanceObjectEClass, // $NON-NLS-1$
InstanceObject.class, // $NON-NLS-1$
"InstanceObject", // $NON-NLS-1$
IS_ABSTRACT, // $NON-NLS-1$
!IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(// $NON-NLS-1$
getInstanceObject_AnnexInstance(), // $NON-NLS-1$
getAnnexInstance(), // $NON-NLS-1$
null, // $NON-NLS-1$
"annexInstance", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, InstanceObject.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEClass(// $NON-NLS-1$
annexInstanceEClass, // $NON-NLS-1$
AnnexInstance.class, // $NON-NLS-1$
"AnnexInstance", // $NON-NLS-1$
IS_ABSTRACT, // $NON-NLS-1$
!IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(// $NON-NLS-1$
getAnnexInstance_AnnexSubclause(), // $NON-NLS-1$
theAadl2Package.getAnnexSubclause(), // $NON-NLS-1$
null, // $NON-NLS-1$
"annexSubclause", null, 1, 1, AnnexInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEClass(// $NON-NLS-1$
propertyAssociationInstanceEClass, // $NON-NLS-1$
PropertyAssociationInstance.class, // $NON-NLS-1$
"PropertyAssociationInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getPropertyAssociationInstance_PropertyAssociation(), theAadl2Package.getPropertyAssociation(), // $NON-NLS-1$
null, // $NON-NLS-1$
"propertyAssociation", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
1, // $NON-NLS-1$
PropertyAssociationInstance.class, // $NON-NLS-1$
!IS_TRANSIENT, // $NON-NLS-1$
!IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEClass(// $NON-NLS-1$
connectionInstanceEndEClass, // $NON-NLS-1$
ConnectionInstanceEnd.class, // $NON-NLS-1$
"ConnectionInstanceEnd", // $NON-NLS-1$
IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getConnectionInstanceEnd_SrcConnectionInstance(), getConnectionInstance(), // $NON-NLS-1$
getConnectionInstance_Source(), // $NON-NLS-1$
"srcConnectionInstance", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, // $NON-NLS-1$
ConnectionInstanceEnd.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(getConnectionInstanceEnd_DstConnectionInstance(), getConnectionInstance(), // $NON-NLS-1$
getConnectionInstance_Destination(), // $NON-NLS-1$
"dstConnectionInstance", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, ConnectionInstanceEnd.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEClass(// $NON-NLS-1$
connectionInstanceEClass, // $NON-NLS-1$
ConnectionInstance.class, // $NON-NLS-1$
"ConnectionInstance", // $NON-NLS-1$
!IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getConnectionInstance_InSystemOperationMode(), getSystemOperationMode(), null, // $NON-NLS-1$
"inSystemOperationMode", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, // $NON-NLS-1$
ConnectionInstance.class, // $NON-NLS-1$
!IS_TRANSIENT, // $NON-NLS-1$
!IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(// $NON-NLS-1$
getConnectionInstance_InModeTransition(), // $NON-NLS-1$
getModeTransitionInstance(), // $NON-NLS-1$
null, // $NON-NLS-1$
"inModeTransition", null, 0, -1, ConnectionInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEAttribute(// $NON-NLS-1$
getConnectionInstance_Complete(), // $NON-NLS-1$
theAadl2Package.getBoolean(), // $NON-NLS-1$
"complete", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
1, ConnectionInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEAttribute(// $NON-NLS-1$
getConnectionInstance_Kind(), // $NON-NLS-1$
getConnectionKind(), // $NON-NLS-1$
"kind", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
1, ConnectionInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(getConnectionInstance_Destination(), getConnectionInstanceEnd(), // $NON-NLS-1$
getConnectionInstanceEnd_DstConnectionInstance(), // $NON-NLS-1$
"destination", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
1, ConnectionInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(getConnectionInstance_ConnectionReference(), getConnectionReference(), null, // $NON-NLS-1$
"connectionReference", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
-1, // $NON-NLS-1$
ConnectionInstance.class, // $NON-NLS-1$
!IS_TRANSIENT, // $NON-NLS-1$
!IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(// $NON-NLS-1$
getConnectionInstance_Bidirectional(), // $NON-NLS-1$
theAadl2Package.getBoolean(), // $NON-NLS-1$
"bidirectional", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
1, ConnectionInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(getConnectionInstance_Source(), getConnectionInstanceEnd(), // $NON-NLS-1$
getConnectionInstanceEnd_SrcConnectionInstance(), // $NON-NLS-1$
"source", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
1, // $NON-NLS-1$
ConnectionInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEClass(// $NON-NLS-1$
flowElementInstanceEClass, // $NON-NLS-1$
FlowElementInstance.class, // $NON-NLS-1$
"FlowElementInstance", // $NON-NLS-1$
IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEClass(// $NON-NLS-1$
systemOperationModeEClass, // $NON-NLS-1$
SystemOperationMode.class, // $NON-NLS-1$
"SystemOperationMode", // $NON-NLS-1$
!IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(// $NON-NLS-1$
getSystemOperationMode_CurrentMode(), // $NON-NLS-1$
getModeInstance(), // $NON-NLS-1$
null, // $NON-NLS-1$
"currentMode", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, SystemOperationMode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(// $NON-NLS-1$
modeInstanceEClass, // $NON-NLS-1$
ModeInstance.class, // $NON-NLS-1$
"ModeInstance", // $NON-NLS-1$
!IS_ABSTRACT, // $NON-NLS-1$
!IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getModeInstance_SrcModeTransition(), getModeTransitionInstance(), // $NON-NLS-1$
getModeTransitionInstance_Source(), // $NON-NLS-1$
"srcModeTransition", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, // $NON-NLS-1$
ModeInstance.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(getModeInstance_DstModeTransition(), getModeTransitionInstance(), // $NON-NLS-1$
getModeTransitionInstance_Destination(), // $NON-NLS-1$
"dstModeTransition", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, // $NON-NLS-1$
ModeInstance.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEAttribute(// $NON-NLS-1$//$NON-NLS-2$
getModeInstance_Initial(), // $NON-NLS-1$//$NON-NLS-2$
theAadl2Package.getBoolean(), // $NON-NLS-1$//$NON-NLS-2$
"initial", // $NON-NLS-1$//$NON-NLS-2$
"false", // $NON-NLS-1$//$NON-NLS-2$
1, // $NON-NLS-1$//$NON-NLS-2$
1, ModeInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(// $NON-NLS-1$
getModeInstance_Mode(), // $NON-NLS-1$
theAadl2Package.getMode(), // $NON-NLS-1$
null, // $NON-NLS-1$
"mode", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
1, // $NON-NLS-1$
ModeInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEAttribute(// $NON-NLS-1$//$NON-NLS-2$
getModeInstance_Derived(), // $NON-NLS-1$//$NON-NLS-2$
theAadl2Package.getBoolean(), // $NON-NLS-1$//$NON-NLS-2$
"derived", // $NON-NLS-1$//$NON-NLS-2$
"false", // $NON-NLS-1$//$NON-NLS-2$
1, // $NON-NLS-1$//$NON-NLS-2$
1, ModeInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(// $NON-NLS-1$
getModeInstance_Parent(), // $NON-NLS-1$
getModeInstance(), // $NON-NLS-1$
null, // $NON-NLS-1$
"parent", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, ModeInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEClass(// $NON-NLS-1$
modeTransitionInstanceEClass, // $NON-NLS-1$
ModeTransitionInstance.class, // $NON-NLS-1$
"ModeTransitionInstance", // $NON-NLS-1$
!IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getModeTransitionInstance_Destination(), getModeInstance(), getModeInstance_DstModeTransition(), // $NON-NLS-1$
"destination", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
1, // $NON-NLS-1$
ModeTransitionInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(getModeTransitionInstance_ModeTransition(), theAadl2Package.getModeTransition(), null, // $NON-NLS-1$
"modeTransition", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
1, // $NON-NLS-1$
ModeTransitionInstance.class, // $NON-NLS-1$
!IS_TRANSIENT, // $NON-NLS-1$
!IS_VOLATILE, // $NON-NLS-1$
IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(// $NON-NLS-1$
getModeTransitionInstance_Trigger(), // $NON-NLS-1$
getFeatureInstance(), // $NON-NLS-1$
null, // $NON-NLS-1$
"trigger", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, ModeTransitionInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(getModeTransitionInstance_Source(), getModeInstance(), getModeInstance_SrcModeTransition(), // $NON-NLS-1$
"source", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
1, // $NON-NLS-1$
ModeTransitionInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEClass(// $NON-NLS-1$
connectionReferenceEClass, // $NON-NLS-1$
ConnectionReference.class, // $NON-NLS-1$
"ConnectionReference", // $NON-NLS-1$
!IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(// $NON-NLS-1$
getConnectionReference_Context(), // $NON-NLS-1$
getComponentInstance(), // $NON-NLS-1$
null, // $NON-NLS-1$
"context", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
1, ConnectionReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(// $NON-NLS-1$
getConnectionReference_Connection(), // $NON-NLS-1$
theAadl2Package.getConnection(), // $NON-NLS-1$
null, // $NON-NLS-1$
"connection", // $NON-NLS-1$
null, 1, 1, ConnectionReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(// $NON-NLS-1$
getConnectionReference_Source(), // $NON-NLS-1$
getConnectionInstanceEnd(), // $NON-NLS-1$
null, // $NON-NLS-1$
"source", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
1, ConnectionReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(// $NON-NLS-1$
getConnectionReference_Destination(), // $NON-NLS-1$
getConnectionInstanceEnd(), // $NON-NLS-1$
null, // $NON-NLS-1$
"destination", // $NON-NLS-1$
null, 1, 1, ConnectionReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEAttribute(// $NON-NLS-1$
getConnectionReference_Reverse(), // $NON-NLS-1$
theAadl2Package.getBoolean(), // $NON-NLS-1$
"reverse", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
1, ConnectionReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEClass(// $NON-NLS-1$
componentInstanceEClass, // $NON-NLS-1$
ComponentInstance.class, // $NON-NLS-1$
"ComponentInstance", // $NON-NLS-1$
!IS_ABSTRACT, // $NON-NLS-1$
!IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(// $NON-NLS-1$
getComponentInstance_FeatureInstance(), // $NON-NLS-1$
getFeatureInstance(), // $NON-NLS-1$
null, // $NON-NLS-1$
"featureInstance", // $NON-NLS-1$
null, 0, -1, ComponentInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(// $NON-NLS-1$
getComponentInstance_ComponentInstance(), // $NON-NLS-1$
getComponentInstance(), // $NON-NLS-1$
null, // $NON-NLS-1$
"componentInstance", null, 0, -1, ComponentInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(// $NON-NLS-1$
getComponentInstance_ModeInstance(), // $NON-NLS-1$
getModeInstance(), // $NON-NLS-1$
null, // $NON-NLS-1$
"modeInstance", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, ComponentInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(getComponentInstance_ModeTransitionInstance(), getModeTransitionInstance(), null, // $NON-NLS-1$
"modeTransitionInstance", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, // $NON-NLS-1$
ComponentInstance.class, // $NON-NLS-1$
!IS_TRANSIENT, // $NON-NLS-1$
!IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEAttribute(// $NON-NLS-1$
getComponentInstance_Category(), // $NON-NLS-1$
theAadl2Package.getComponentCategory(), // $NON-NLS-1$
"category", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
1, ComponentInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(// $NON-NLS-1$
getComponentInstance_InMode(), // $NON-NLS-1$
getModeInstance(), // $NON-NLS-1$
null, // $NON-NLS-1$
"inMode", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, ComponentInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(getComponentInstance_FlowSpecification(), getFlowSpecificationInstance(), null, // $NON-NLS-1$
"flowSpecification", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, // $NON-NLS-1$
ComponentInstance.class, // $NON-NLS-1$
!IS_TRANSIENT, // $NON-NLS-1$
!IS_VOLATILE, // $NON-NLS-1$
IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(// $NON-NLS-1$
getComponentInstance_EndToEndFlow(), // $NON-NLS-1$
getEndToEndFlowInstance(), // $NON-NLS-1$
null, // $NON-NLS-1$
"endToEndFlow", // $NON-NLS-1$
null, 0, -1, ComponentInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(// $NON-NLS-1$
getComponentInstance_ConnectionInstance(), // $NON-NLS-1$
getConnectionInstance(), // $NON-NLS-1$
null, // $NON-NLS-1$
"connectionInstance", null, 0, -1, ComponentInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(// $NON-NLS-1$
getComponentInstance_Subcomponent(), // $NON-NLS-1$
theAadl2Package.getSubcomponent(), // $NON-NLS-1$
null, // $NON-NLS-1$
"subcomponent", null, 0, 1, ComponentInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEAttribute(// $NON-NLS-1$
getComponentInstance_Index(), // $NON-NLS-1$
theAadl2Package.getInteger(), // $NON-NLS-1$
"index", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, ComponentInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(// $NON-NLS-1$
getComponentInstance_Classifier(), // $NON-NLS-1$
theAadl2Package.getComponentClassifier(), // $NON-NLS-1$
null, // $NON-NLS-1$
"classifier", null, 0, 1, ComponentInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEClass(// $NON-NLS-1$
flowSpecificationInstanceEClass, // $NON-NLS-1$
FlowSpecificationInstance.class, // $NON-NLS-1$
"FlowSpecificationInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getFlowSpecificationInstance_Source(), getFeatureInstance(), getFeatureInstance_SrcFlowSpec(), // $NON-NLS-1$
"source", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
1, // $NON-NLS-1$
FlowSpecificationInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(getFlowSpecificationInstance_Destination(), getFeatureInstance(), // $NON-NLS-1$
getFeatureInstance_DstFlowSpec(), // $NON-NLS-1$
"destination", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
1, // $NON-NLS-1$
FlowSpecificationInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(getFlowSpecificationInstance_FlowSpecification(), theAadl2Package.getFlowSpecification(), null, // $NON-NLS-1$
"flowSpecification", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
1, // $NON-NLS-1$
FlowSpecificationInstance.class, // $NON-NLS-1$
!IS_TRANSIENT, // $NON-NLS-1$
!IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(// $NON-NLS-1$
getFlowSpecificationInstance_InMode(), // $NON-NLS-1$
getModeInstance(), // $NON-NLS-1$
null, // $NON-NLS-1$
"inMode", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, FlowSpecificationInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(getFlowSpecificationInstance_InModeTransition(), getModeTransitionInstance(), null, // $NON-NLS-1$
"inModeTransition", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, // $NON-NLS-1$
FlowSpecificationInstance.class, // $NON-NLS-1$
!IS_TRANSIENT, // $NON-NLS-1$
!IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEClass(// $NON-NLS-1$
endToEndFlowInstanceEClass, // $NON-NLS-1$
EndToEndFlowInstance.class, // $NON-NLS-1$
"EndToEndFlowInstance", // $NON-NLS-1$
!IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(// $NON-NLS-1$
getEndToEndFlowInstance_FlowElement(), // $NON-NLS-1$
getFlowElementInstance(), // $NON-NLS-1$
null, // $NON-NLS-1$
"flowElement", // $NON-NLS-1$
null, 0, -1, EndToEndFlowInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(// $NON-NLS-1$
getEndToEndFlowInstance_InMode(), // $NON-NLS-1$
getModeInstance(), // $NON-NLS-1$
null, // $NON-NLS-1$
"inMode", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, EndToEndFlowInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(getEndToEndFlowInstance_InSystemOperationMode(), getSystemOperationMode(), null, // $NON-NLS-1$
"inSystemOperationMode", // $NON-NLS-1$
null, // $NON-NLS-1$
0, // $NON-NLS-1$
-1, // $NON-NLS-1$
EndToEndFlowInstance.class, // $NON-NLS-1$
!IS_TRANSIENT, // $NON-NLS-1$
!IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(// $NON-NLS-1$
getEndToEndFlowInstance_EndToEndFlow(), // $NON-NLS-1$
theAadl2Package.getEndToEndFlow(), // $NON-NLS-1$
null, // $NON-NLS-1$
"endToEndFlow", null, 1, 1, EndToEndFlowInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEClass(// $NON-NLS-1$
systemInstanceEClass, // $NON-NLS-1$
SystemInstance.class, // $NON-NLS-1$
"SystemInstance", // $NON-NLS-1$
!IS_ABSTRACT, // $NON-NLS-1$
!IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(// $NON-NLS-1$
getSystemInstance_SystemOperationMode(), // $NON-NLS-1$
getSystemOperationMode(), // $NON-NLS-1$
null, // $NON-NLS-1$
"systemOperationMode", null, 0, -1, SystemInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getSystemInstance_ComponentImplementation(), theAadl2Package.getComponentImplementation(), null, // $NON-NLS-1$
"componentImplementation", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
1, // $NON-NLS-1$
SystemInstance.class, // $NON-NLS-1$
!IS_TRANSIENT, // $NON-NLS-1$
!IS_VOLATILE, // $NON-NLS-1$
IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEClass(// $NON-NLS-1$
instanceReferenceValueEClass, // $NON-NLS-1$
InstanceReferenceValue.class, // $NON-NLS-1$
"InstanceReferenceValue", // $NON-NLS-1$
!IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getInstanceReferenceValue_ReferencedInstanceObject(), getInstanceObject(), null, // $NON-NLS-1$
"referencedInstanceObject", // $NON-NLS-1$
null, // $NON-NLS-1$
1, // $NON-NLS-1$
1, // $NON-NLS-1$
InstanceReferenceValue.class, // $NON-NLS-1$
!IS_TRANSIENT, // $NON-NLS-1$
!IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
// Initialize enums and add enum literals
// $NON-NLS-1$
initEEnum(connectionKindEEnum, ConnectionKind.class, "ConnectionKind");
addEEnumLiteral(connectionKindEEnum, ConnectionKind.FEATURE_CONNECTION);
addEEnumLiteral(connectionKindEEnum, ConnectionKind.ACCESS_CONNECTION);
addEEnumLiteral(connectionKindEEnum, ConnectionKind.PARAMETER_CONNECTION);
addEEnumLiteral(connectionKindEEnum, ConnectionKind.PORT_CONNECTION);
addEEnumLiteral(connectionKindEEnum, ConnectionKind.MODE_TRANSITION_CONNECTION);
addEEnumLiteral(connectionKindEEnum, ConnectionKind.FEATURE_GROUP_CONNECTION);
// $NON-NLS-1$
initEEnum(featureCategoryEEnum, FeatureCategory.class, "FeatureCategory");
addEEnumLiteral(featureCategoryEEnum, FeatureCategory.DATA_PORT);
addEEnumLiteral(featureCategoryEEnum, FeatureCategory.EVENT_PORT);
addEEnumLiteral(featureCategoryEEnum, FeatureCategory.EVENT_DATA_PORT);
addEEnumLiteral(featureCategoryEEnum, FeatureCategory.PARAMETER);
addEEnumLiteral(featureCategoryEEnum, FeatureCategory.BUS_ACCESS);
addEEnumLiteral(featureCategoryEEnum, FeatureCategory.DATA_ACCESS);
addEEnumLiteral(featureCategoryEEnum, FeatureCategory.SUBPROGRAM_ACCESS);
addEEnumLiteral(featureCategoryEEnum, FeatureCategory.SUBPROGRAM_GROUP_ACCESS);
addEEnumLiteral(featureCategoryEEnum, FeatureCategory.FEATURE_GROUP);
addEEnumLiteral(featureCategoryEEnum, FeatureCategory.ABSTRACT_FEATURE);
// Create resource
createResource(eNS_URI);
// Create annotations
// http://www.eclipse.org/uml2/2.0.0/UML
createUMLAnnotations();
// duplicates
createDuplicatesAnnotations();
}
use of org.osate.aadl2.instance.ModeInstance in project osate2 by osate.
the class Binpack method binPackSystem.
protected AssignmentResult binPackSystem(final SystemInstance root, Expansor expansor, LowLevelBinPacker packer, final AnalysisErrorReporterManager errManager, final SystemOperationMode som) {
existsProcessorWithMIPS = false;
existsProcessorWithoutMIPS = false;
existsThreadWithReferenceProcessor = false;
existsThreadWithoutReferenceProcessor = false;
/*
* Map from AADL ComponentInstances representing threads to
* the bin packing SoftwareNode that models the thread.
*/
final Map<ComponentInstance, AADLThread> threadToSoftwareNode = new HashMap<>();
/*
* Set of thread components. This is is the keySet of
* threadToSoftwareNode.
*/
final Set<ComponentInstance> threads = threadToSoftwareNode.keySet();
/*
* Map from AADL ComponentInstances representing threads to
* the set of AADL ComponentInstances that cannot be collocated
* with it.
*/
final Map<ComponentInstance, Set<ComponentInstance>> notCollocated = new HashMap<>();
/*
* Map from AADL ComponentInstance representing processors to
* the bin packing Processor that models them.
*/
final Map<ComponentInstance, AADLProcessor> procToHardware = new HashMap<>();
/*
* Map from AADL BusInstance representing Buses to
* The bin packing Link that models them.
*/
final Map<ComponentInstance, AADLBus> busToHardware = new HashMap<>();
/*
* One site to rule them all! We don't care about the site
* architecture, so just create one site to hold everything.
* We aren't worried about power or space issues either, so
* we just set them to 100.0 because those are nice values.
* The site accepts AADL processors.
*/
final SiteArchitecture siteArchitecture = new SiteArchitecture();
AADLProcessor ap = AADLProcessor.PROTOTYPE;
final Site theSite = new Site(100.0, 100.0, new SiteGuest[] { ap });
siteArchitecture.addSite(theSite);
/*
* The hardware is fixed based on the AADL specification, so we
* use the NoExpansionExpansor to keep the hardware from being
* generated for us.
*/
expansor.setSiteArchitecture(siteArchitecture);
/*
* Populate the problem space based on the AADL specification. First
* we walk the instance model and add all the processors. Then we
* walk the instance model again to add all the threads.
*/
OutDegreeAssignmentProblem problem1 = new OutDegreeAssignmentProblem(new OutDegreeComparator(), new BandwidthComparator(), new CapacityComparator());
problem1.setErrorReporter(new BinPackErrorReporter());
final OutDegreeAssignmentProblem problem = problem1;
// Add procs
final ForAllElement addProcessors = new ForAllElement(errManager) {
@Override
public void process(Element obj) {
ComponentInstance ci = (ComponentInstance) obj;
// the createInstance method already assigns a default MIPS if none exists
double mips = GetProperties.getProcessorMIPS(ci);
// checking consistency;
existsProcessorWithMIPS |= (mips != 0);
existsProcessorWithoutMIPS |= (mips == 0);
final AADLProcessor proc = AADLProcessor.createInstance(ci);
if (proc != null) {
System.out.println("Processor cycles Per sec:" + proc.getCyclesPerSecond());
siteArchitecture.addSiteGuest(proc, theSite);
problem.getHardwareGraph().add(proc);
// add reverse mapping
procToHardware.put(ci, proc);
}
}
};
addProcessors.processPreOrderComponentInstance(root, ComponentCategory.PROCESSOR);
/*
* Get all the links
*/
final ForAllElement addBuses = new ForAllElement(errManager) {
@Override
public void process(Element obj) {
ComponentInstance bi = (ComponentInstance) obj;
final AADLBus bus = AADLBus.createInstance(bi);
busToHardware.put(bi, bus);
}
};
addBuses.processPreOrderComponentInstance(root, ComponentCategory.BUS);
/*
* create the links between processors and busses
* (i.e., process connections)
*/
for (final Iterator<ConnectionInstance> i = root.getAllConnectionInstances().iterator(); i.hasNext(); ) {
final ConnectionInstance connInst = i.next();
if (connInst.getKind() == ConnectionKind.ACCESS_CONNECTION) {
InstanceObject src = connInst.getSource();
InstanceObject dst = connInst.getDestination();
AADLBus bus = null;
AADLProcessor processor = null;
// swap if i got them in the opposite order
if (src instanceof FeatureInstance) {
InstanceObject tmp = dst;
dst = src;
src = tmp;
}
bus = busToHardware.get(src);
FeatureInstance fi = (FeatureInstance) dst;
processor = procToHardware.get(fi.getContainingComponentInstance());
if (bus != null && processor != null) {
bus.add(processor);
processor.attachToLink(bus);
}
}
}
for (Iterator<AADLBus> iBus = busToHardware.values().iterator(); iBus.hasNext(); ) {
AADLBus bus = iBus.next();
problem.addLink(bus);
siteArchitecture.addSiteGuest(bus, theSite);
}
// Add threads
final ForAllElement addThreads = new ForAllElement(errManager) {
@Override
public void process(Element obj) {
final ComponentInstance ci = (ComponentInstance) obj;
/**
* JD - check the modes according to what was
* suggested by Dave.
*/
boolean selected = true;
if (som.getCurrentModes().size() > 0) {
selected = false;
for (ModeInstance mi : ci.getInModes()) {
if (mi == som.getCurrentModes().get(0)) {
selected = true;
}
}
}
if (!selected) {
return;
}
final AADLThread thread = AADLThread.createInstance(ci);
double refmips = GetProperties.getReferenceMIPS(ci);
// validate consistency
existsThreadWithReferenceProcessor |= (refmips != 0);
existsThreadWithoutReferenceProcessor |= (refmips == 0);
problem.getSoftwareGraph().add(thread);
// logInfo(thread.getReport());
// add reverse mapping
threadToSoftwareNode.put(ci, thread);
// Process NOT_COLLOCATED property.
RecordValue disjunctFrom = GetProperties.getNotCollocated(ci);
if (disjunctFrom == null) {
return;
}
final Set<ComponentInstance> disjunctSet = new HashSet<>();
ListValue tvl = (ListValue) PropertyUtils.getRecordFieldValue(disjunctFrom, "Targets");
for (PropertyExpression ref : tvl.getOwnedListElements()) {
/*
* Add all the instances rooted at the named instance.
* For example, the thread may be declared to be disjunct
* from another process, so we really want to be disjunct
* from the other threads contained in that process.
*/
final InstanceReferenceValue rv = (InstanceReferenceValue) ref;
final ComponentInstance refCI = (ComponentInstance) rv.getReferencedInstanceObject();
disjunctSet.addAll(refCI.getAllComponentInstances());
}
if (!disjunctSet.isEmpty()) {
notCollocated.put(ci, disjunctSet);
}
}
};
addThreads.processPreOrderComponentInstance(root, ComponentCategory.THREAD);
// only some processors have mips
if (existsProcessorWithMIPS && existsProcessorWithoutMIPS) {
errManager.error(root, "Not all processors have MIPSCapacity");
return null;
}
// only some threads with reference processor
if (existsThreadWithReferenceProcessor && existsThreadWithoutReferenceProcessor) {
errManager.error(root, "Not all threads have execution time reference processor");
return null;
}
// threads and processors mips spec not consistent
if (existsProcessorWithMIPS && existsThreadWithoutReferenceProcessor) {
errManager.error(root, "There are some processors with MIPSCapacity but some threads without execution time reference processors");
return null;
}
if (existsProcessorWithoutMIPS && existsThreadWithReferenceProcessor) {
errManager.error(root, "There are some threads with execution time reference processors but not all processors have MIPSCapacity");
return null;
}
// Add thread connections (Messages)
for (final Iterator<ConnectionInstance> i = root.getAllConnectionInstances().iterator(); i.hasNext(); ) {
final ConnectionInstance connInst = i.next();
if (connInst.getKind() == ConnectionKind.PORT_CONNECTION) {
if (!(connInst.getSource() instanceof FeatureInstance && connInst.getDestination() instanceof FeatureInstance)) {
continue;
}
final FeatureInstance src = (FeatureInstance) connInst.getSource();
final FeatureInstance dst = (FeatureInstance) connInst.getDestination();
final ComponentInstance ci = src.getContainingComponentInstance();
AADLThread t1 = threadToSoftwareNode.get(ci);
AADLThread t2 = threadToSoftwareNode.get(dst.getContainingComponentInstance());
if (t1 != null && t2 != null) {
Feature srcAP = src.getFeature();
// TODO: get the property directly
Classifier cl = srcAP.getClassifier();
if (cl instanceof DataClassifier) {
DataClassifier srcDC = (DataClassifier) cl;
double dataSize = 0.0;
double threadPeriod = 0.0;
try {
dataSize = AadlContribUtils.getDataSize(srcDC, SizeUnits.BYTES);
} catch (Exception e) {
errManager.warning(connInst, "No Data Size for connection");
}
try {
threadPeriod = GetProperties.getPeriodinNS(ci);
} catch (Exception e) {
errManager.warning(connInst, "No Period for connection");
}
// Now I can create the Message
Message msg = new Message((long) dataSize, (long) threadPeriod, (long) threadPeriod, t1, t2);
System.out.println(">>>>>>>>>> Adding message (" + Long.toString((long) dataSize) + "/" + Long.toString((long) threadPeriod) + ") between " + t1.getName() + " and " + t2.getName() + " based on connection " + connInst.getName());
problem.addMessage(msg);
} else {
errManager.warning(connInst, "No Data Classifier for connection");
}
}
}
}
// Add collocation constraints
for (final Iterator<ComponentInstance> constrained = notCollocated.keySet().iterator(); constrained.hasNext(); ) {
final ComponentInstance ci = constrained.next();
final SoftwareNode sn = threadToSoftwareNode.get(ci);
final Set<ComponentInstance> disjunctFrom = notCollocated.get(ci);
for (final Iterator<ComponentInstance> dfIter = disjunctFrom.iterator(); dfIter.hasNext(); ) {
/*
* Items in the disjunctFrom set do not have to be thread
* instances because of the way we add items to it (see above).
* We are only interested in the thread instances here, in
* particular because we only create SoftwareNodes for the
* thread instances, and we don't want to get null return
* values from the threadToSoftwareNode map.
*/
final ComponentInstance ci2 = dfIter.next();
if (ci2.getCategory() == ComponentCategory.THREAD) {
final SoftwareNode sn2 = threadToSoftwareNode.get(ci2);
final SoftwareNode[] disjunction = new SoftwareNode[] { sn, sn2 };
problem.addConstraint(new Disjoint(disjunction));
}
}
}
/*
* Add Allowed_Processor_Binding and
* Allowed_Processor_Binding_Class constraints
*/
for (final Iterator<ComponentInstance> i = threads.iterator(); i.hasNext(); ) {
final ComponentInstance thr = i.next();
final SoftwareNode thrSN = threadToSoftwareNode.get(thr);
Collection<ComponentInstance> allowed = getActualProcessorBindings(thr);
if (allowed.size() == 0) {
allowed = getAllowedProcessorBindings(thr);
}
if (allowed.size() > 0) {
final Object[] allowedProcs = new Object[allowed.size()];
int idx = 0;
for (Iterator<ComponentInstance> j = allowed.iterator(); j.hasNext(); idx++) {
final ComponentInstance proc = j.next();
allowedProcs[idx] = procToHardware.get(proc);
}
problem.addConstraint(new SetConstraint(new SoftwareNode[] { thrSN }, allowedProcs));
}
}
// Try to bin pack
final NFCHoBinPacker highPacker = new NFCHoBinPacker(packer);
final boolean res = highPacker.solve(problem);
return new AssignmentResult(problem, res);
}
use of org.osate.aadl2.instance.ModeInstance in project osate2 by osate.
the class SystemOperationModeItemProvider method getChildren.
/**
* Manually added to show the individual modes of a SystemOperationMode.
*/
public Collection<?> getChildren(Object object) {
SystemOperationMode som = (SystemOperationMode) object;
List<SubModeItemProvider> result = new ArrayList<SubModeItemProvider>();
for (ModeInstance subMode : som.getCurrentModes()) {
result.add(new SubModeItemProvider(adapterFactory, som, subMode));
}
return result;
}
use of org.osate.aadl2.instance.ModeInstance in project osate2 by osate.
the class InstantiateModel method createSystemOperationModes.
// --------------------------------------------------------------------------------------------
// Methods related to system operation modes
// --------------------------------------------------------------------------------------------
/*
* Create the system operation mode objects for the instance model.
*/
protected void createSystemOperationModes(final SystemInstance root, final int limit) throws InterruptedException {
class SOMBuilder {
class Node {
ComponentInstance ci;
Node parentNode;
State state;
Node(ComponentInstance ci, Node parentNode) {
this.ci = ci;
this.parentNode = parentNode;
}
}
class State {
boolean active;
// mode is ignored if !active
ModeInstance mode;
State(boolean active) {
this.active = active;
}
}
ArrayList<Node> workState = new ArrayList<>();
int modalCount;
int createSoms() throws InterruptedException {
Node rootNode = new Node(null, null);
rootNode.state = new State(true);
initWorkState(root, rootNode);
modalCount = workState.size();
if (modalCount == 0) {
/*
* We have no modal components, but we need to create a special SOM to
* represent our single normal operating state.
*/
final SystemOperationMode som = InstanceFactory.eINSTANCE.createSystemOperationMode();
som.setName(NORMAL_SOM_NAME);
root.getSystemOperationModes().add(som);
return 0;
} else {
return enumerateSoms(0, 0);
}
}
protected int enumerateSoms(int depth, int index) throws InterruptedException {
if (monitor.isCanceled()) {
throw new InterruptedException();
}
Node node = workState.get(depth);
State parentState = node.parentNode.state;
Iterator<ModeInstance> modes = parentState.active ? getActiveModes(node.ci, parentState.mode) : Collections.emptyIterator();
boolean active = parentState.active && modes.hasNext();
State state = new State(active);
node.state = state;
if (depth + 1 == modalCount) {
// here we add one or more SOMs
if (active) {
while (modes.hasNext()) {
if (monitor.isCanceled()) {
throw new InterruptedException();
}
state.mode = modes.next();
root.getSystemOperationModes().add(createSOM(index + 1));
if (index < 0 || ++index >= limit) {
return -1;
}
}
} else {
root.getSystemOperationModes().add(createSOM(index + 1));
if (index < 0 || ++index >= limit) {
return -1;
}
}
} else {
if (active) {
while (modes.hasNext()) {
state.mode = modes.next();
index = enumerateSoms(depth + 1, index);
if (index < 0) {
return -1;
}
}
} else {
index = enumerateSoms(depth + 1, index);
}
}
node.state = null;
return index;
}
protected Iterator<ModeInstance> getActiveModes(ComponentInstance ci, ModeInstance parentMode) {
List<ModeInstance> modes = ci.getModeInstances();
if (parentMode == null) {
// system instance
return modes.iterator();
} else if (!ci.getInModes().isEmpty() && !ci.getInModes().contains(parentMode)) {
// component not active in parent mode
return Collections.emptyIterator();
} else {
// limit derived modes to mapping
return modes.stream().filter(mi -> {
return !mi.isDerived() || mi.getParents().contains(parentMode);
}).iterator();
}
}
protected void initWorkState(ComponentInstance ci, Node parentNode) throws InterruptedException {
if (monitor.isCanceled()) {
throw new InterruptedException();
}
if (!ci.getModeInstances().isEmpty()) {
parentNode = new Node(ci, parentNode);
workState.add(parentNode);
}
for (ComponentInstance sub : ci.getComponentInstances()) {
initWorkState(sub, parentNode);
}
}
protected SystemOperationMode createSOM(int somNo) throws InterruptedException {
final SystemOperationMode som;
som = InstanceFactory.eINSTANCE.createSystemOperationMode();
for (Node node : workState) {
if (monitor.isCanceled()) {
throw new InterruptedException();
}
if (!node.state.active) {
continue;
}
ModeInstance mi = node.state.mode;
List<SystemOperationMode> soms = mode2som.get(mi);
if (soms == null) {
soms = new ArrayList<SystemOperationMode>();
mode2som.put(mi, soms);
}
soms.add(som);
som.getCurrentModes().add(mi);
}
som.setName("som_" + somNo);
return som;
}
}
int index = new SOMBuilder().createSoms();
if (index < 0) {
errManager.warning(root, "List of system operation modes is incomplete (see project property 'Instantiation')");
}
}
Aggregations