Search in sources :

Example 11 with DataSubcomponentType

use of org.osate.aadl2.DataSubcomponentType in project VERDICT by ge-high-assurance.

the class Aadl2Vdm method defineDataImplementationType.

/**
 * @author Vidhya Tekken Valapil
 * populate information related to data implementation types in the vdm
 */
private void defineDataImplementationType(DataImplementation dataImplementation, Model model, HashSet<String> dataTypeDecl) {
    // DEFINE DATA TYPE IN DECLARATIONS IF NOT ALREADY DEFINED
    String dataImplementationName = dataImplementation.getName();
    if (!dataTypeDecl.contains(dataImplementationName)) {
        dataTypeDecl.add(dataImplementationName);
        // vdm data type declaration
        TypeDeclaration dataTypeVdm = new TypeDeclaration();
        dataTypeVdm.setName(dataImplementationName);
        verdict.vdm.vdm_data.DataType dtype = new verdict.vdm.vdm_data.DataType();
        // GET DETAILS OF THE DATA IMPLEMENTATION AND CREATE CORRESPONDING VDM DATATYPE
        EList<DataSubcomponent> subcomponents = dataImplementation.getOwnedDataSubcomponents();
        if (!(subcomponents.isEmpty())) {
            // if the dataType definition has subcomponents
            RecordType recType = new RecordType();
            for (DataSubcomponent dataSubComp : subcomponents) {
                RecordField recField = new RecordField();
                recField.setName(dataSubComp.getName());
                DataSubcomponentType dataSubCompType = dataSubComp.getDataSubcomponentType();
                if (dataSubCompType instanceof org.osate.aadl2.DataType) {
                    org.osate.aadl2.DataType aadlDataType = (org.osate.aadl2.DataType) dataSubCompType;
                    Agree2Vdm agree2vdm = new Agree2Vdm();
                    verdict.vdm.vdm_data.DataType recFieldDtype = agree2vdm.getVdmTypeFromAADLType(aadlDataType);
                    recField.setType(recFieldDtype);
                    resolveAADLDataType(aadlDataType, model, dataTypeDecl);
                    recType.getRecordField().add(recField);
                } else if (dataSubCompType instanceof DataImplementation) {
                    DataImplementation dataSubCompDataImplementation = (DataImplementation) dataSubCompType;
                    verdict.vdm.vdm_data.DataType recFieldDtype = new verdict.vdm.vdm_data.DataType();
                    recFieldDtype.setUserDefinedType(dataSubCompDataImplementation.getName());
                    recField.setType(recFieldDtype);
                    defineDataImplementationType(dataSubCompDataImplementation, model, dataTypeDecl);
                    recType.getRecordField().add(recField);
                } else {
                    System.out.println("Unexpected Data Subcomponent that is not a DataTypeImpl or DataImplementatioImpl.");
                }
            }
            if (recType.getRecordField().size() != 0) {
                dtype.setRecordType(recType);
                dataTypeVdm.setDefinition(dtype);
            }
        } else {
            // if the dataType is base type boolean or integer or char or string
            System.out.println("Data implementation type has no subcomponents");
        }
        // add the typeDeclaration to the model
        model.getTypeDeclaration().add(dataTypeVdm);
    }
}
Also used : RecordField(verdict.vdm.vdm_data.RecordField) DataImplementation(org.osate.aadl2.DataImplementation) DataSubcomponentType(org.osate.aadl2.DataSubcomponentType) RecordType(verdict.vdm.vdm_data.RecordType) DataSubcomponent(org.osate.aadl2.DataSubcomponent) DataType(org.osate.aadl2.DataType) TypeDeclaration(verdict.vdm.vdm_data.TypeDeclaration) DataType(org.osate.aadl2.DataType)

Example 12 with DataSubcomponentType

use of org.osate.aadl2.DataSubcomponentType in project osate2 by osate.

the class EventDataPortImpl method setDataFeatureClassifier.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setDataFeatureClassifier(DataSubcomponentType newDataFeatureClassifier) {
    DataSubcomponentType oldDataFeatureClassifier = dataFeatureClassifier;
    dataFeatureClassifier = newDataFeatureClassifier;
    if (eNotificationRequired()) {
        eNotify(new ENotificationImpl(this, Notification.SET, Aadl2Package.EVENT_DATA_PORT__DATA_FEATURE_CLASSIFIER, oldDataFeatureClassifier, dataFeatureClassifier));
    }
}
Also used : DataSubcomponentType(org.osate.aadl2.DataSubcomponentType) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 13 with DataSubcomponentType

use of org.osate.aadl2.DataSubcomponentType in project osate2 by osate.

the class DataSubcomponentImpl method setDataSubcomponentType.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setDataSubcomponentType(DataSubcomponentType newDataSubcomponentType) {
    DataSubcomponentType oldDataSubcomponentType = dataSubcomponentType;
    dataSubcomponentType = newDataSubcomponentType;
    if (eNotificationRequired()) {
        eNotify(new ENotificationImpl(this, Notification.SET, Aadl2Package.DATA_SUBCOMPONENT__DATA_SUBCOMPONENT_TYPE, oldDataSubcomponentType, dataSubcomponentType));
    }
}
Also used : DataSubcomponentType(org.osate.aadl2.DataSubcomponentType) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 14 with DataSubcomponentType

use of org.osate.aadl2.DataSubcomponentType in project osate2 by osate.

the class DataPortImpl method setDataFeatureClassifier.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setDataFeatureClassifier(DataSubcomponentType newDataFeatureClassifier) {
    DataSubcomponentType oldDataFeatureClassifier = dataFeatureClassifier;
    dataFeatureClassifier = newDataFeatureClassifier;
    if (eNotificationRequired()) {
        eNotify(new ENotificationImpl(this, Notification.SET, Aadl2Package.DATA_PORT__DATA_FEATURE_CLASSIFIER, oldDataFeatureClassifier, dataFeatureClassifier));
    }
}
Also used : DataSubcomponentType(org.osate.aadl2.DataSubcomponentType) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 15 with DataSubcomponentType

use of org.osate.aadl2.DataSubcomponentType in project osate2 by osate.

the class AadlSubcomponentUtil method setClassifier.

public static void setClassifier(final Subcomponent sc, final SubcomponentType selectedSubcomponentType) {
    // Import as necessary
    if (selectedSubcomponentType != null) {
        // Import its package if necessary
        final AadlPackage pkg = (AadlPackage) sc.getElementRoot();
        if (selectedSubcomponentType instanceof ComponentClassifier && selectedSubcomponentType.getNamespace() != null && pkg != null) {
            final PackageSection section = pkg.getPublicSection();
            final AadlPackage selectedClassifierPkg = (AadlPackage) selectedSubcomponentType.getNamespace().getOwner();
            if (selectedClassifierPkg != null && pkg != selectedClassifierPkg) {
                AadlImportsUtil.addImportIfNeeded(section, selectedClassifierPkg);
            }
        }
    }
    if (sc instanceof SystemSubcomponent) {
        ((SystemSubcomponent) sc).setSystemSubcomponentType((SystemSubcomponentType) selectedSubcomponentType);
    } else if (sc instanceof AbstractSubcomponent) {
        ((AbstractSubcomponent) sc).setAbstractSubcomponentType((AbstractSubcomponentType) selectedSubcomponentType);
    } else if (sc instanceof ThreadGroupSubcomponent) {
        ((ThreadGroupSubcomponent) sc).setThreadGroupSubcomponentType((ThreadGroupSubcomponentType) selectedSubcomponentType);
    } else if (sc instanceof ThreadSubcomponent) {
        ((ThreadSubcomponent) sc).setThreadSubcomponentType((ThreadSubcomponentType) selectedSubcomponentType);
    } else if (sc instanceof SubprogramSubcomponent) {
        ((SubprogramSubcomponent) sc).setSubprogramSubcomponentType((SubprogramSubcomponentType) selectedSubcomponentType);
    } else if (sc instanceof SubprogramGroupSubcomponent) {
        ((SubprogramGroupSubcomponent) sc).setSubprogramGroupSubcomponentType((SubprogramGroupSubcomponentType) selectedSubcomponentType);
    } else if (sc instanceof DataSubcomponent) {
        ((DataSubcomponent) sc).setDataSubcomponentType((DataSubcomponentType) selectedSubcomponentType);
    } else if (sc instanceof VirtualBusSubcomponent) {
        ((VirtualBusSubcomponent) sc).setVirtualBusSubcomponentType((VirtualBusSubcomponentType) selectedSubcomponentType);
    } else if (sc instanceof VirtualProcessorSubcomponent) {
        ((VirtualProcessorSubcomponent) sc).setVirtualProcessorSubcomponentType((VirtualProcessorSubcomponentType) selectedSubcomponentType);
    } else if (sc instanceof BusSubcomponent) {
        ((BusSubcomponent) sc).setBusSubcomponentType((BusSubcomponentType) selectedSubcomponentType);
    } else if (sc instanceof ProcessSubcomponent) {
        ((ProcessSubcomponent) sc).setProcessSubcomponentType((ProcessSubcomponentType) selectedSubcomponentType);
    } else if (sc instanceof ProcessorSubcomponent) {
        ((ProcessorSubcomponent) sc).setProcessorSubcomponentType((ProcessorSubcomponentType) selectedSubcomponentType);
    } else if (sc instanceof DeviceSubcomponent) {
        ((DeviceSubcomponent) sc).setDeviceSubcomponentType((DeviceSubcomponentType) selectedSubcomponentType);
    } else if (sc instanceof MemorySubcomponent) {
        ((MemorySubcomponent) sc).setMemorySubcomponentType((MemorySubcomponentType) selectedSubcomponentType);
    } else {
        throw new RuntimeException("Unexpected type: " + sc.getClass().getName());
    }
}
Also used : ComponentClassifier(org.osate.aadl2.ComponentClassifier) ThreadSubcomponentType(org.osate.aadl2.ThreadSubcomponentType) PackageSection(org.osate.aadl2.PackageSection) AbstractSubcomponent(org.osate.aadl2.AbstractSubcomponent) ProcessorSubcomponentType(org.osate.aadl2.ProcessorSubcomponentType) VirtualProcessorSubcomponentType(org.osate.aadl2.VirtualProcessorSubcomponentType) SubprogramGroupSubcomponent(org.osate.aadl2.SubprogramGroupSubcomponent) AbstractSubcomponentType(org.osate.aadl2.AbstractSubcomponentType) VirtualBusSubcomponentType(org.osate.aadl2.VirtualBusSubcomponentType) BusSubcomponentType(org.osate.aadl2.BusSubcomponentType) DeviceSubcomponent(org.osate.aadl2.DeviceSubcomponent) MemorySubcomponentType(org.osate.aadl2.MemorySubcomponentType) ThreadGroupSubcomponent(org.osate.aadl2.ThreadGroupSubcomponent) SubprogramGroupSubcomponentType(org.osate.aadl2.SubprogramGroupSubcomponentType) ProcessorSubcomponent(org.osate.aadl2.ProcessorSubcomponent) VirtualProcessorSubcomponent(org.osate.aadl2.VirtualProcessorSubcomponent) MemorySubcomponent(org.osate.aadl2.MemorySubcomponent) SubprogramSubcomponent(org.osate.aadl2.SubprogramSubcomponent) VirtualBusSubcomponentType(org.osate.aadl2.VirtualBusSubcomponentType) AadlPackage(org.osate.aadl2.AadlPackage) VirtualBusSubcomponent(org.osate.aadl2.VirtualBusSubcomponent) VirtualProcessorSubcomponent(org.osate.aadl2.VirtualProcessorSubcomponent) BusSubcomponent(org.osate.aadl2.BusSubcomponent) VirtualBusSubcomponent(org.osate.aadl2.VirtualBusSubcomponent) ThreadSubcomponent(org.osate.aadl2.ThreadSubcomponent) SystemSubcomponent(org.osate.aadl2.SystemSubcomponent) ProcessSubcomponent(org.osate.aadl2.ProcessSubcomponent) DataSubcomponent(org.osate.aadl2.DataSubcomponent)

Aggregations

DataSubcomponentType (org.osate.aadl2.DataSubcomponentType)13 DataPort (org.osate.aadl2.DataPort)7 DataSubcomponent (org.osate.aadl2.DataSubcomponent)7 EventDataPort (org.osate.aadl2.EventDataPort)7 DataImplementation (org.osate.aadl2.DataImplementation)6 EventPort (org.osate.aadl2.EventPort)5 LPort (com.ge.research.osate.verdict.dsl.verdict.LPort)4 SLPort (com.ge.research.osate.verdict.dsl.verdict.SLPort)4 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)4 DataType (org.osate.aadl2.DataType)4 DataTypeImpl (org.osate.aadl2.impl.DataTypeImpl)4 SubprogramSubcomponent (org.osate.aadl2.SubprogramSubcomponent)3 SystemSubcomponent (org.osate.aadl2.SystemSubcomponent)3 DataImplementationImpl (org.osate.aadl2.impl.DataImplementationImpl)3 Port (verdict.vdm.vdm_model.Port)3 DataAccess (org.osate.aadl2.DataAccess)2 NamedElement (org.osate.aadl2.NamedElement)2 PropertyExpression (org.osate.aadl2.PropertyExpression)2 Subcomponent (org.osate.aadl2.Subcomponent)2 RecordType (verdict.vdm.vdm_data.RecordType)2