Search in sources :

Example 1 with DefaultAnnexLibrary

use of org.osate.aadl2.DefaultAnnexLibrary in project AGREE by loonwerks.

the class AGREESimulationState method buildPackageToConstantsMap.

private static Map<String, Map<String, ConstStatement>> buildPackageToConstantsMap(final IProject[] projects) {
    // Build a mapping between lower case package names and a map between constant names to constant statements
    final Map<String, Map<String, ConstStatement>> packageToConstantsMap = new HashMap<>();
    try {
        final Set<IFile> aadlFiles = new HashSet<>();
        getAadlFiles(projects, aadlFiles);
        for (final IFile aadlFile : aadlFiles) {
            // final Resource aadlRes = OsateResourceUtil.getResource(aadlFile);
            final Resource aadlRes = getResource(URI.createPlatformResourceURI(aadlFile.getFullPath().toString(), false));
            if (aadlRes != null && !aadlRes.getContents().isEmpty()) {
                final EObject content = aadlRes.getContents().get(0);
                if (content instanceof AadlPackage) {
                    // Find all AGREE Libraries
                    final AadlPackage pkg = (AadlPackage) content;
                    if (pkg.getPublicSection() != null && pkg.getName() != null) {
                        final Map<String, ConstStatement> constants = new HashMap<>();
                        packageToConstantsMap.put(pkg.getQualifiedName().toLowerCase(), constants);
                        for (final AnnexLibrary lib : pkg.getPublicSection().getOwnedAnnexLibraries()) {
                            // Look for AGREE annex libraries
                            if (lib instanceof DefaultAnnexLibrary && "agree".equalsIgnoreCase(lib.getName())) {
                                final AnnexLibrary parsedLib = ((DefaultAnnexLibrary) lib).getParsedAnnexLibrary();
                                if (parsedLib instanceof AgreeContractLibrary) {
                                    final AgreeContractLibrary agreeContractLib = (AgreeContractLibrary) parsedLib;
                                    if (agreeContractLib.getContract() instanceof AgreeContract) {
                                        final AgreeContract agreeContract = (AgreeContract) agreeContractLib.getContract();
                                        for (final SpecStatement spec : agreeContract.getSpecs()) {
                                            if (spec instanceof ConstStatement) {
                                                final ConstStatement constStatement = (ConstStatement) spec;
                                                // Check that the statement is of a supported type
                                                if (getType(constStatement) != null) {
                                                    constants.put(constStatement.getName().toLowerCase(), constStatement);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    } catch (CoreException e) {
        throw new AGREESimulatorException(null, e, "Unable to build constants map");
    }
    return packageToConstantsMap;
}
Also used : AgreeContract(com.rockwellcollins.atc.agree.agree.AgreeContract) IFile(org.eclipse.core.resources.IFile) AadlPackage(org.osate.aadl2.AadlPackage) HashMap(java.util.HashMap) AgreeContractLibrary(com.rockwellcollins.atc.agree.agree.AgreeContractLibrary) Resource(org.eclipse.emf.ecore.resource.Resource) IResource(org.eclipse.core.resources.IResource) SpecStatement(com.rockwellcollins.atc.agree.agree.SpecStatement) ConstStatement(com.rockwellcollins.atc.agree.agree.ConstStatement) CoreException(org.eclipse.core.runtime.CoreException) EObject(org.eclipse.emf.ecore.EObject) DefaultAnnexLibrary(org.osate.aadl2.DefaultAnnexLibrary) AnnexLibrary(org.osate.aadl2.AnnexLibrary) Map(java.util.Map) HashMap(java.util.HashMap) AGREESimulatorException(edu.uah.rsesc.aadlsimulator.agree.sim.AGREESimulatorException) HashSet(java.util.HashSet) DefaultAnnexLibrary(org.osate.aadl2.DefaultAnnexLibrary)

Example 2 with DefaultAnnexLibrary

use of org.osate.aadl2.DefaultAnnexLibrary in project AMASE by loonwerks.

the class SafetyAnnexContentAssist method annexCompletionSuggestions.

@Override
public List<String> annexCompletionSuggestions(EObject defaultAnnex, int offset) {
    // get one character back
    offset = (offset <= 0) ? 0 : offset - 1;
    EObjectAtOffsetHelper helper = getOffsetHelper();
    EObject grammerObject = null;
    // EObjectAtOffsetHelper
    if (defaultAnnex instanceof DefaultAnnexLibrary) {
        AnnexLibrary annexLib = ((DefaultAnnexLibrary) defaultAnnex).getParsedAnnexLibrary();
        XtextResource resource = (XtextResource) annexLib.eResource();
        grammerObject = helper.resolveContainedElementAt(resource, offset);
    } else if (defaultAnnex instanceof DefaultAnnexSubclause) {
        AnnexSubclause annexSub = ((DefaultAnnexSubclause) defaultAnnex).getParsedAnnexSubclause();
        XtextResource resource = (XtextResource) annexSub.eResource();
        grammerObject = helper.resolveContainedElementAt(resource, offset);
    }
    List<String> results = new ArrayList<>();
    if (grammerObject instanceof SelectionExpr) {
        results.addAll(getNestedDotIDCandidates((SelectionExpr) grammerObject));
    }
    return results;
}
Also used : EObjectAtOffsetHelper(org.eclipse.xtext.resource.EObjectAtOffsetHelper) EObject(org.eclipse.emf.ecore.EObject) ArrayList(java.util.ArrayList) XtextResource(org.eclipse.xtext.resource.XtextResource) DefaultAnnexLibrary(org.osate.aadl2.DefaultAnnexLibrary) AnnexLibrary(org.osate.aadl2.AnnexLibrary) SelectionExpr(com.rockwellcollins.atc.agree.agree.SelectionExpr) DefaultAnnexSubclause(org.osate.aadl2.DefaultAnnexSubclause) DefaultAnnexSubclause(org.osate.aadl2.DefaultAnnexSubclause) AnnexSubclause(org.osate.aadl2.AnnexSubclause) DefaultAnnexLibrary(org.osate.aadl2.DefaultAnnexLibrary)

Example 3 with DefaultAnnexLibrary

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

the class AbstractAadl2SemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == Aadl2Package.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case Aadl2Package.AADL_BOOLEAN:
                if (rule == grammarAccess.getPropertyTypeRule() || rule == grammarAccess.getBooleanTypeRule()) {
                    sequence_BooleanType(context, (AadlBoolean) semanticObject);
                    return;
                } else if (rule == grammarAccess.getUnnamedPropertyTypeRule() || rule == grammarAccess.getUnnamedBooleanTypeRule()) {
                    sequence_UnnamedBooleanType(context, (AadlBoolean) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.AADL_INTEGER:
                if (rule == grammarAccess.getPropertyTypeRule() || rule == grammarAccess.getIntegerTypeRule()) {
                    sequence_IntegerType(context, (AadlInteger) semanticObject);
                    return;
                } else if (rule == grammarAccess.getUnnamedPropertyTypeRule() || rule == grammarAccess.getUnnamedIntegerTypeRule()) {
                    sequence_UnnamedIntegerType(context, (AadlInteger) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.AADL_PACKAGE:
                sequence_AadlPackage(context, (AadlPackage) semanticObject);
                return;
            case Aadl2Package.AADL_REAL:
                if (rule == grammarAccess.getPropertyTypeRule() || rule == grammarAccess.getRealTypeRule()) {
                    sequence_RealType(context, (AadlReal) semanticObject);
                    return;
                } else if (rule == grammarAccess.getUnnamedPropertyTypeRule() || rule == grammarAccess.getUnnamedRealTypeRule()) {
                    sequence_UnnamedRealType(context, (AadlReal) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.AADL_STRING:
                if (rule == grammarAccess.getPropertyTypeRule() || rule == grammarAccess.getStringTypeRule()) {
                    sequence_StringType(context, (AadlString) semanticObject);
                    return;
                } else if (rule == grammarAccess.getUnnamedPropertyTypeRule() || rule == grammarAccess.getUnnamedStringTypeRule()) {
                    sequence_UnnamedStringType(context, (AadlString) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.ABSTRACT_FEATURE:
                sequence_AbstractFeature(context, (AbstractFeature) semanticObject);
                return;
            case Aadl2Package.ABSTRACT_IMPLEMENTATION:
                sequence_AbstractImplementation(context, (AbstractImplementation) semanticObject);
                return;
            case Aadl2Package.ABSTRACT_PROTOTYPE:
                sequence_AbstractPrototype(context, (AbstractPrototype) semanticObject);
                return;
            case Aadl2Package.ABSTRACT_SUBCOMPONENT:
                sequence_AbstractSubcomponent(context, (AbstractSubcomponent) semanticObject);
                return;
            case Aadl2Package.ABSTRACT_TYPE:
                sequence_AbstractType(context, (AbstractType) semanticObject);
                return;
            case Aadl2Package.ACCESS_CONNECTION:
                sequence_AccessConnection(context, (AccessConnection) semanticObject);
                return;
            case Aadl2Package.ACCESS_SPECIFICATION:
                sequence_AccessSpecification(context, (AccessSpecification) semanticObject);
                return;
            case Aadl2Package.ARRAY_DIMENSION:
                sequence_ArrayDimension(context, (ArrayDimension) semanticObject);
                return;
            case Aadl2Package.ARRAY_RANGE:
                sequence_ArrayRange(context, (ArrayRange) semanticObject);
                return;
            case Aadl2Package.ARRAY_SIZE:
                sequence_ArraySize(context, (ArraySize) semanticObject);
                return;
            case Aadl2Package.BASIC_PROPERTY:
                sequence_RecordField(context, (BasicProperty) semanticObject);
                return;
            case Aadl2Package.BASIC_PROPERTY_ASSOCIATION:
                sequence_FieldPropertyAssociation(context, (BasicPropertyAssociation) semanticObject);
                return;
            case Aadl2Package.BOOLEAN_LITERAL:
                sequence_BooleanLiteral(context, (BooleanLiteral) semanticObject);
                return;
            case Aadl2Package.BUS_ACCESS:
                sequence_BusAccess(context, (BusAccess) semanticObject);
                return;
            case Aadl2Package.BUS_IMPLEMENTATION:
                sequence_BusImplementation(context, (BusImplementation) semanticObject);
                return;
            case Aadl2Package.BUS_PROTOTYPE:
                sequence_BusPrototype(context, (BusPrototype) semanticObject);
                return;
            case Aadl2Package.BUS_SUBCOMPONENT:
                sequence_BusSubcomponent(context, (BusSubcomponent) semanticObject);
                return;
            case Aadl2Package.BUS_TYPE:
                sequence_BusType(context, (BusType) semanticObject);
                return;
            case Aadl2Package.CLASSIFIER_TYPE:
                if (rule == grammarAccess.getPropertyTypeRule() || rule == grammarAccess.getClassifierTypeRule()) {
                    sequence_ClassifierType(context, (ClassifierType) semanticObject);
                    return;
                } else if (rule == grammarAccess.getUnnamedPropertyTypeRule() || rule == grammarAccess.getUnnamedClassifierTypeRule()) {
                    sequence_UnnamedClassifierType(context, (ClassifierType) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.CLASSIFIER_VALUE:
                if (rule == grammarAccess.getConstantPropertyExpressionRule() || rule == grammarAccess.getPropertyExpressionRule() || rule == grammarAccess.getComponentClassifierTermRule()) {
                    sequence_ComponentClassifierTerm(context, (ClassifierValue) semanticObject);
                    return;
                } else if (rule == grammarAccess.getQCReferenceRule() || rule == grammarAccess.getPropertyOwnerRule()) {
                    sequence_QCReference(context, (ClassifierValue) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.COMPONENT_IMPLEMENTATION_REFERENCE:
                sequence_ComponentImplementationReference(context, (ComponentImplementationReference) semanticObject);
                return;
            case Aadl2Package.COMPONENT_PROTOTYPE_ACTUAL:
                sequence_ComponentReference(context, (ComponentPrototypeActual) semanticObject);
                return;
            case Aadl2Package.COMPONENT_PROTOTYPE_BINDING:
                sequence_ComponentPrototypeBinding(context, (ComponentPrototypeBinding) semanticObject);
                return;
            case Aadl2Package.COMPONENT_TYPE_RENAME:
                sequence_CTRename(context, (ComponentTypeRename) semanticObject);
                return;
            case Aadl2Package.COMPUTED_VALUE:
                sequence_ComputedTerm(context, (ComputedValue) semanticObject);
                return;
            case Aadl2Package.CONNECTED_ELEMENT:
                if (rule == grammarAccess.getConnectedElementChainRule()) {
                    sequence_ConnectedElementChain(context, (ConnectedElement) semanticObject);
                    return;
                } else if (rule == grammarAccess.getConnectedElementRule()) {
                    sequence_ConnectedElement(context, (ConnectedElement) semanticObject);
                    return;
                } else if (rule == grammarAccess.getAbstractConnectionEndRule()) {
                    sequence_ConnectedElement_InternalEvent_ProcessorPort(context, (ConnectedElement) semanticObject);
                    return;
                } else if (rule == grammarAccess.getNestedConnectedElementRule()) {
                    sequence_ConnectedElement_NestedConnectedElement(context, (ConnectedElement) semanticObject);
                    return;
                } else if (rule == grammarAccess.getProcessorConnectionEndRule()) {
                    sequence_ConnectedElement_ProcessorPort(context, (ConnectedElement) semanticObject);
                    return;
                } else if (rule == grammarAccess.getAccessConnectionEndRule()) {
                    sequence_ConnectedElement_ProcessorSubprogram(context, (ConnectedElement) semanticObject);
                    return;
                } else if (rule == grammarAccess.getInternalEventRule()) {
                    sequence_InternalEvent(context, (ConnectedElement) semanticObject);
                    return;
                } else if (rule == grammarAccess.getProcessorPortRule()) {
                    sequence_ProcessorPort(context, (ConnectedElement) semanticObject);
                    return;
                } else if (rule == grammarAccess.getProcessorSubprogramRule()) {
                    sequence_ProcessorSubprogram(context, (ConnectedElement) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.CONTAINED_NAMED_ELEMENT:
                sequence_ContainmentPath(context, (ContainedNamedElement) semanticObject);
                return;
            case Aadl2Package.CONTAINMENT_PATH_ELEMENT:
                sequence_ContainmentPathElement(context, (ContainmentPathElement) semanticObject);
                return;
            case Aadl2Package.DATA_ACCESS:
                sequence_DataAccess(context, (DataAccess) semanticObject);
                return;
            case Aadl2Package.DATA_IMPLEMENTATION:
                sequence_DataImplementation(context, (DataImplementation) semanticObject);
                return;
            case Aadl2Package.DATA_PORT:
                sequence_DataPort(context, (DataPort) semanticObject);
                return;
            case Aadl2Package.DATA_PROTOTYPE:
                sequence_DataPrototype(context, (DataPrototype) semanticObject);
                return;
            case Aadl2Package.DATA_SUBCOMPONENT:
                sequence_DataSubcomponent(context, (DataSubcomponent) semanticObject);
                return;
            case Aadl2Package.DATA_TYPE:
                sequence_DataType(context, (DataType) semanticObject);
                return;
            case Aadl2Package.DEFAULT_ANNEX_LIBRARY:
                sequence_DefaultAnnexLibrary(context, (DefaultAnnexLibrary) semanticObject);
                return;
            case Aadl2Package.DEFAULT_ANNEX_SUBCLAUSE:
                sequence_DefaultAnnexSubclause(context, (DefaultAnnexSubclause) semanticObject);
                return;
            case Aadl2Package.DEVICE_IMPLEMENTATION:
                sequence_DeviceImplementation(context, (DeviceImplementation) semanticObject);
                return;
            case Aadl2Package.DEVICE_PROTOTYPE:
                sequence_DevicePrototype(context, (DevicePrototype) semanticObject);
                return;
            case Aadl2Package.DEVICE_SUBCOMPONENT:
                sequence_DeviceSubcomponent(context, (DeviceSubcomponent) semanticObject);
                return;
            case Aadl2Package.DEVICE_TYPE:
                sequence_DeviceType(context, (DeviceType) semanticObject);
                return;
            case Aadl2Package.END_TO_END_FLOW:
                sequence_EndToEndFlow(context, (EndToEndFlow) semanticObject);
                return;
            case Aadl2Package.END_TO_END_FLOW_SEGMENT:
                if (rule == grammarAccess.getETEConnectionFlowRule()) {
                    sequence_ETEConnectionFlow(context, (EndToEndFlowSegment) semanticObject);
                    return;
                } else if (rule == grammarAccess.getETESubcomponentFlowRule()) {
                    sequence_ETESubcomponentFlow(context, (EndToEndFlowSegment) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.ENUMERATION_LITERAL:
                sequence_EnumerationLiteral(context, (EnumerationLiteral) semanticObject);
                return;
            case Aadl2Package.ENUMERATION_TYPE:
                if (rule == grammarAccess.getPropertyTypeRule() || rule == grammarAccess.getEnumerationTypeRule()) {
                    sequence_EnumerationType(context, (EnumerationType) semanticObject);
                    return;
                } else if (rule == grammarAccess.getUnnamedPropertyTypeRule() || rule == grammarAccess.getUnnamedEnumerationTypeRule()) {
                    sequence_UnnamedEnumerationType(context, (EnumerationType) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.EVENT_DATA_PORT:
                sequence_EventDataPort(context, (EventDataPort) semanticObject);
                return;
            case Aadl2Package.EVENT_DATA_SOURCE:
                sequence_EventDataSource(context, (EventDataSource) semanticObject);
                return;
            case Aadl2Package.EVENT_PORT:
                sequence_EventPort(context, (EventPort) semanticObject);
                return;
            case Aadl2Package.EVENT_SOURCE:
                sequence_EventSource(context, (EventSource) semanticObject);
                return;
            case Aadl2Package.FEATURE_CONNECTION:
                sequence_FeatureConnection(context, (FeatureConnection) semanticObject);
                return;
            case Aadl2Package.FEATURE_GROUP:
                sequence_FeatureGroup(context, (FeatureGroup) semanticObject);
                return;
            case Aadl2Package.FEATURE_GROUP_CONNECTION:
                sequence_FeatureGroupConnection(context, (FeatureGroupConnection) semanticObject);
                return;
            case Aadl2Package.FEATURE_GROUP_PROTOTYPE:
                sequence_FeatureGroupPrototype(context, (FeatureGroupPrototype) semanticObject);
                return;
            case Aadl2Package.FEATURE_GROUP_PROTOTYPE_ACTUAL:
                sequence_FeatureGroupPrototypeActual(context, (FeatureGroupPrototypeActual) semanticObject);
                return;
            case Aadl2Package.FEATURE_GROUP_PROTOTYPE_BINDING:
                sequence_FeatureGroupPrototypeBinding(context, (FeatureGroupPrototypeBinding) semanticObject);
                return;
            case Aadl2Package.FEATURE_GROUP_TYPE:
                sequence_FeatureGroupType(context, (FeatureGroupType) semanticObject);
                return;
            case Aadl2Package.FEATURE_GROUP_TYPE_RENAME:
                sequence_FGTRename(context, (FeatureGroupTypeRename) semanticObject);
                return;
            case Aadl2Package.FEATURE_PROTOTYPE:
                sequence_FeaturePrototype(context, (FeaturePrototype) semanticObject);
                return;
            case Aadl2Package.FEATURE_PROTOTYPE_BINDING:
                sequence_FeaturePrototypeBinding(context, (FeaturePrototypeBinding) semanticObject);
                return;
            case Aadl2Package.FEATURE_PROTOTYPE_REFERENCE:
                sequence_FeaturePrototypeReference(context, (FeaturePrototypeReference) semanticObject);
                return;
            case Aadl2Package.FLOW_END:
                sequence_FlowEnd(context, (FlowEnd) semanticObject);
                return;
            case Aadl2Package.FLOW_IMPLEMENTATION:
                if (rule == grammarAccess.getFlowPathImplRule()) {
                    sequence_FlowPathImpl(context, (FlowImplementation) semanticObject);
                    return;
                } else if (rule == grammarAccess.getFlowImplementationRule()) {
                    sequence_FlowPathImpl_FlowSinkImpl_FlowSourceImpl(context, (FlowImplementation) semanticObject);
                    return;
                } else if (rule == grammarAccess.getFlowSinkImplRule()) {
                    sequence_FlowSinkImpl(context, (FlowImplementation) semanticObject);
                    return;
                } else if (rule == grammarAccess.getFlowSourceImplRule()) {
                    sequence_FlowSourceImpl(context, (FlowImplementation) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.FLOW_SEGMENT:
                if (rule == grammarAccess.getConnectionFlowRule()) {
                    sequence_ConnectionFlow(context, (FlowSegment) semanticObject);
                    return;
                } else if (rule == grammarAccess.getSubcomponentFlowRule()) {
                    sequence_SubcomponentFlow(context, (FlowSegment) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.FLOW_SPECIFICATION:
                if (rule == grammarAccess.getFlowSpecificationRule()) {
                    sequence_FlowPathSpec_FlowSinkSpec_FlowSourceSpec_FlowSpecRefinement(context, (FlowSpecification) semanticObject);
                    return;
                } else if (rule == grammarAccess.getFlowPathSpecRule()) {
                    sequence_FlowPathSpec(context, (FlowSpecification) semanticObject);
                    return;
                } else if (rule == grammarAccess.getFlowSinkSpecRule()) {
                    sequence_FlowSinkSpec(context, (FlowSpecification) semanticObject);
                    return;
                } else if (rule == grammarAccess.getFlowSourceSpecRule()) {
                    sequence_FlowSourceSpec(context, (FlowSpecification) semanticObject);
                    return;
                } else if (rule == grammarAccess.getFlowSpecRefinementRule()) {
                    sequence_FlowSpecRefinement(context, (FlowSpecification) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.GROUP_EXTENSION:
                sequence_GroupExtension(context, (GroupExtension) semanticObject);
                return;
            case Aadl2Package.IMPLEMENTATION_EXTENSION:
                sequence_ImplementationExtension(context, (ImplementationExtension) semanticObject);
                return;
            case Aadl2Package.INTEGER_LITERAL:
                if (rule == grammarAccess.getNumberValueRule() || rule == grammarAccess.getIntegerLitRule()) {
                    sequence_IntegerLit(context, (IntegerLiteral) semanticObject);
                    return;
                } else if (rule == grammarAccess.getConstantPropertyExpressionRule() || rule == grammarAccess.getPropertyExpressionRule() || rule == grammarAccess.getIntegerTermRule() || rule == grammarAccess.getNumAltRule()) {
                    sequence_IntegerTerm(context, (IntegerLiteral) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.LIST_TYPE:
                sequence_ListType(context, (ListType) semanticObject);
                return;
            case Aadl2Package.LIST_VALUE:
                sequence_ListTerm(context, (ListValue) semanticObject);
                return;
            case Aadl2Package.MEMORY_IMPLEMENTATION:
                sequence_MemoryImplementation(context, (MemoryImplementation) semanticObject);
                return;
            case Aadl2Package.MEMORY_PROTOTYPE:
                sequence_MemoryPrototype(context, (MemoryPrototype) semanticObject);
                return;
            case Aadl2Package.MEMORY_SUBCOMPONENT:
                sequence_MemorySubcomponent(context, (MemorySubcomponent) semanticObject);
                return;
            case Aadl2Package.MEMORY_TYPE:
                sequence_MemoryType(context, (MemoryType) semanticObject);
                return;
            case Aadl2Package.METACLASS_REFERENCE:
                if (rule == grammarAccess.getAllReferenceRule()) {
                    sequence_AllReference(context, (MetaclassReference) semanticObject);
                    return;
                } else if (rule == grammarAccess.getQMReferenceRule() || rule == grammarAccess.getPropertyOwnerRule()) {
                    sequence_QMReference(context, (MetaclassReference) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.MODAL_PROPERTY_VALUE:
                if (rule == grammarAccess.getModalPropertyValueRule()) {
                    sequence_ModalPropertyValue(context, (ModalPropertyValue) semanticObject);
                    return;
                } else if (rule == grammarAccess.getOptionalModalPropertyValueRule()) {
                    sequence_OptionalModalPropertyValue(context, (ModalPropertyValue) semanticObject);
                    return;
                } else if (rule == grammarAccess.getPropertyValueRule()) {
                    sequence_PropertyValue(context, (ModalPropertyValue) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.MODE:
                sequence_Mode(context, (Mode) semanticObject);
                return;
            case Aadl2Package.MODE_BINDING:
                sequence_ModeRef(context, (ModeBinding) semanticObject);
                return;
            case Aadl2Package.MODE_TRANSITION:
                sequence_ModeTransition(context, (ModeTransition) semanticObject);
                return;
            case Aadl2Package.MODE_TRANSITION_TRIGGER:
                sequence_Trigger(context, (ModeTransitionTrigger) semanticObject);
                return;
            case Aadl2Package.NAMED_VALUE:
                if (rule == grammarAccess.getConstantValueRule() || rule == grammarAccess.getNumAltRule()) {
                    sequence_ConstantValue(context, (NamedValue) semanticObject);
                    return;
                } else if (rule == grammarAccess.getConstantPropertyExpressionRule() || rule == grammarAccess.getPropertyExpressionRule() || rule == grammarAccess.getLiteralorReferenceTermRule()) {
                    sequence_LiteralorReferenceTerm(context, (NamedValue) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.NUMERIC_RANGE:
                if (rule == grammarAccess.getIntegerRangeRule()) {
                    sequence_IntegerRange(context, (NumericRange) semanticObject);
                    return;
                } else if (rule == grammarAccess.getRealRangeRule()) {
                    sequence_RealRange(context, (NumericRange) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.OPERATION:
                sequence_SignedConstant(context, (Operation) semanticObject);
                return;
            case Aadl2Package.PACKAGE_RENAME:
                if (rule == grammarAccess.getPackageRenameRule()) {
                    sequence_PackageRename(context, (PackageRename) semanticObject);
                    return;
                } else if (rule == grammarAccess.getRenameAllRule()) {
                    sequence_RenameAll(context, (PackageRename) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.PARAMETER:
                sequence_Parameter(context, (org.osate.aadl2.Parameter) semanticObject);
                return;
            case Aadl2Package.PARAMETER_CONNECTION:
                sequence_ParameterConnection(context, (ParameterConnection) semanticObject);
                return;
            case Aadl2Package.PORT_CONNECTION:
                sequence_PortConnection(context, (PortConnection) semanticObject);
                return;
            case Aadl2Package.PORT_PROXY:
                sequence_PortProxy(context, (PortProxy) semanticObject);
                return;
            case Aadl2Package.PORT_SPECIFICATION:
                sequence_PortSpecification(context, (PortSpecification) semanticObject);
                return;
            case Aadl2Package.PRIVATE_PACKAGE_SECTION:
                sequence_PrivatePackageSection(context, (PrivatePackageSection) semanticObject);
                return;
            case Aadl2Package.PROCESS_IMPLEMENTATION:
                sequence_ProcessImplementation(context, (ProcessImplementation) semanticObject);
                return;
            case Aadl2Package.PROCESS_PROTOTYPE:
                sequence_ProcessPrototype(context, (ProcessPrototype) semanticObject);
                return;
            case Aadl2Package.PROCESS_SUBCOMPONENT:
                sequence_ProcessSubcomponent(context, (ProcessSubcomponent) semanticObject);
                return;
            case Aadl2Package.PROCESS_TYPE:
                sequence_ProcessType(context, (ProcessType) semanticObject);
                return;
            case Aadl2Package.PROCESSOR_IMPLEMENTATION:
                sequence_ProcessorImplementation(context, (ProcessorImplementation) semanticObject);
                return;
            case Aadl2Package.PROCESSOR_PROTOTYPE:
                sequence_ProcessorPrototype(context, (ProcessorPrototype) semanticObject);
                return;
            case Aadl2Package.PROCESSOR_SUBCOMPONENT:
                sequence_ProcessorSubcomponent(context, (ProcessorSubcomponent) semanticObject);
                return;
            case Aadl2Package.PROCESSOR_TYPE:
                sequence_ProcessorType(context, (ProcessorType) semanticObject);
                return;
            case Aadl2Package.PROPERTY:
                sequence_PropertyDefinition(context, (Property) semanticObject);
                return;
            case Aadl2Package.PROPERTY_ASSOCIATION:
                if (rule == grammarAccess.getBasicPropertyAssociationRule()) {
                    sequence_BasicPropertyAssociation(context, (PropertyAssociation) semanticObject);
                    return;
                } else if (rule == grammarAccess.getPModelRule() || rule == grammarAccess.getContainedPropertyAssociationRule()) {
                    sequence_ContainedPropertyAssociation(context, (PropertyAssociation) semanticObject);
                    return;
                } else if (rule == grammarAccess.getPropertyAssociationRule()) {
                    sequence_PropertyAssociation(context, (PropertyAssociation) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.PROPERTY_CONSTANT:
                sequence_PropertyConstant(context, (PropertyConstant) semanticObject);
                return;
            case Aadl2Package.PROPERTY_SET:
                sequence_PropertySet(context, (PropertySet) semanticObject);
                return;
            case Aadl2Package.PUBLIC_PACKAGE_SECTION:
                sequence_PublicPackageSection(context, (PublicPackageSection) semanticObject);
                return;
            case Aadl2Package.RANGE_TYPE:
                if (rule == grammarAccess.getPropertyTypeRule() || rule == grammarAccess.getRangeTypeRule()) {
                    sequence_RangeType(context, (RangeType) semanticObject);
                    return;
                } else if (rule == grammarAccess.getUnnamedPropertyTypeRule() || rule == grammarAccess.getUnnamedRangeTypeRule()) {
                    sequence_UnnamedRangeType(context, (RangeType) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.RANGE_VALUE:
                sequence_NumericRangeTerm(context, (RangeValue) semanticObject);
                return;
            case Aadl2Package.REAL_LITERAL:
                if (rule == grammarAccess.getNumberValueRule() || rule == grammarAccess.getRealLitRule()) {
                    sequence_RealLit(context, (RealLiteral) semanticObject);
                    return;
                } else if (rule == grammarAccess.getConstantPropertyExpressionRule() || rule == grammarAccess.getPropertyExpressionRule() || rule == grammarAccess.getRealTermRule() || rule == grammarAccess.getNumAltRule()) {
                    sequence_RealTerm(context, (RealLiteral) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.REALIZATION:
                sequence_Realization(context, (Realization) semanticObject);
                return;
            case Aadl2Package.RECORD_TYPE:
                if (rule == grammarAccess.getPropertyTypeRule() || rule == grammarAccess.getRecordTypeRule()) {
                    sequence_RecordType(context, (RecordType) semanticObject);
                    return;
                } else if (rule == grammarAccess.getUnnamedPropertyTypeRule() || rule == grammarAccess.getUnnamedRecordTypeRule()) {
                    sequence_UnnamedRecordType(context, (RecordType) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.RECORD_VALUE:
                if (rule == grammarAccess.getOldRecordTermRule()) {
                    sequence_OldRecordTerm(context, (RecordValue) semanticObject);
                    return;
                } else if (rule == grammarAccess.getConstantPropertyExpressionRule() || rule == grammarAccess.getPropertyExpressionRule() || rule == grammarAccess.getRecordTermRule()) {
                    sequence_RecordTerm(context, (RecordValue) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.REFERENCE_TYPE:
                if (rule == grammarAccess.getPropertyTypeRule() || rule == grammarAccess.getReferenceTypeRule()) {
                    sequence_ReferenceType(context, (ReferenceType) semanticObject);
                    return;
                } else if (rule == grammarAccess.getUnnamedPropertyTypeRule() || rule == grammarAccess.getUnnamedReferenceTypeRule()) {
                    sequence_UnnamedReferenceType(context, (ReferenceType) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.REFERENCE_VALUE:
                sequence_ReferenceTerm(context, (ReferenceValue) semanticObject);
                return;
            case Aadl2Package.STRING_LITERAL:
                sequence_StringTerm(context, (StringLiteral) semanticObject);
                return;
            case Aadl2Package.SUBPROGRAM_ACCESS:
                sequence_SubprogramAccess(context, (SubprogramAccess) semanticObject);
                return;
            case Aadl2Package.SUBPROGRAM_CALL:
                sequence_SubprogramCall(context, (SubprogramCall) semanticObject);
                return;
            case Aadl2Package.SUBPROGRAM_CALL_SEQUENCE:
                sequence_SubprogramCallSequence(context, (SubprogramCallSequence) semanticObject);
                return;
            case Aadl2Package.SUBPROGRAM_GROUP_ACCESS:
                sequence_SubprogramGroupAccess(context, (SubprogramGroupAccess) semanticObject);
                return;
            case Aadl2Package.SUBPROGRAM_GROUP_IMPLEMENTATION:
                sequence_SubprogramGroupImplementation(context, (SubprogramGroupImplementation) semanticObject);
                return;
            case Aadl2Package.SUBPROGRAM_GROUP_PROTOTYPE:
                sequence_SubprogramGroupPrototype(context, (SubprogramGroupPrototype) semanticObject);
                return;
            case Aadl2Package.SUBPROGRAM_GROUP_SUBCOMPONENT:
                sequence_SubprogramGroupSubcomponent(context, (SubprogramGroupSubcomponent) semanticObject);
                return;
            case Aadl2Package.SUBPROGRAM_GROUP_TYPE:
                sequence_SubprogramGroupType(context, (SubprogramGroupType) semanticObject);
                return;
            case Aadl2Package.SUBPROGRAM_IMPLEMENTATION:
                sequence_SubprogramImplementation(context, (SubprogramImplementation) semanticObject);
                return;
            case Aadl2Package.SUBPROGRAM_PROTOTYPE:
                sequence_SubprogramPrototype(context, (SubprogramPrototype) semanticObject);
                return;
            case Aadl2Package.SUBPROGRAM_PROXY:
                sequence_SubprogramProxy(context, (SubprogramProxy) semanticObject);
                return;
            case Aadl2Package.SUBPROGRAM_SUBCOMPONENT:
                sequence_SubprogramSubcomponent(context, (SubprogramSubcomponent) semanticObject);
                return;
            case Aadl2Package.SUBPROGRAM_TYPE:
                sequence_SubprogramType(context, (SubprogramType) semanticObject);
                return;
            case Aadl2Package.SYSTEM_IMPLEMENTATION:
                sequence_SystemImplementation(context, (SystemImplementation) semanticObject);
                return;
            case Aadl2Package.SYSTEM_PROTOTYPE:
                sequence_SystemPrototype(context, (SystemPrototype) semanticObject);
                return;
            case Aadl2Package.SYSTEM_SUBCOMPONENT:
                sequence_SystemSubcomponent(context, (SystemSubcomponent) semanticObject);
                return;
            case Aadl2Package.SYSTEM_TYPE:
                sequence_SystemType(context, (SystemType) semanticObject);
                return;
            case Aadl2Package.THREAD_GROUP_IMPLEMENTATION:
                sequence_ThreadGroupImplementation(context, (ThreadGroupImplementation) semanticObject);
                return;
            case Aadl2Package.THREAD_GROUP_PROTOTYPE:
                sequence_ThreadGroupPrototype(context, (ThreadGroupPrototype) semanticObject);
                return;
            case Aadl2Package.THREAD_GROUP_SUBCOMPONENT:
                sequence_ThreadGroupSubcomponent(context, (ThreadGroupSubcomponent) semanticObject);
                return;
            case Aadl2Package.THREAD_GROUP_TYPE:
                sequence_ThreadGroupType(context, (ThreadGroupType) semanticObject);
                return;
            case Aadl2Package.THREAD_IMPLEMENTATION:
                sequence_ThreadImplementation(context, (ThreadImplementation) semanticObject);
                return;
            case Aadl2Package.THREAD_PROTOTYPE:
                sequence_ThreadPrototype(context, (ThreadPrototype) semanticObject);
                return;
            case Aadl2Package.THREAD_SUBCOMPONENT:
                sequence_ThreadSubcomponent(context, (ThreadSubcomponent) semanticObject);
                return;
            case Aadl2Package.THREAD_TYPE:
                sequence_ThreadType(context, (ThreadType) semanticObject);
                return;
            case Aadl2Package.TYPE_EXTENSION:
                sequence_TypeExtension(context, (TypeExtension) semanticObject);
                return;
            case Aadl2Package.UNIT_LITERAL:
                if (rule == grammarAccess.getUnitLiteralConversionRule()) {
                    sequence_UnitLiteralConversion(context, (UnitLiteral) semanticObject);
                    return;
                } else if (rule == grammarAccess.getUnitLiteralRule()) {
                    sequence_UnitLiteral(context, (UnitLiteral) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.UNITS_TYPE:
                if (rule == grammarAccess.getPropertyTypeRule() || rule == grammarAccess.getUnitsTypeRule()) {
                    sequence_UnitsType(context, (UnitsType) semanticObject);
                    return;
                } else if (rule == grammarAccess.getUnnamedPropertyTypeRule() || rule == grammarAccess.getUnnamedUnitsTypeRule()) {
                    sequence_UnnamedUnitsType(context, (UnitsType) semanticObject);
                    return;
                } else
                    break;
            case Aadl2Package.VIRTUAL_BUS_IMPLEMENTATION:
                sequence_VirtualBusImplementation(context, (VirtualBusImplementation) semanticObject);
                return;
            case Aadl2Package.VIRTUAL_BUS_PROTOTYPE:
                sequence_VirtualBusPrototype(context, (VirtualBusPrototype) semanticObject);
                return;
            case Aadl2Package.VIRTUAL_BUS_SUBCOMPONENT:
                sequence_VirtualBusSubcomponent(context, (VirtualBusSubcomponent) semanticObject);
                return;
            case Aadl2Package.VIRTUAL_BUS_TYPE:
                sequence_VirtualBusType(context, (VirtualBusType) semanticObject);
                return;
            case Aadl2Package.VIRTUAL_PROCESSOR_IMPLEMENTATION:
                sequence_VirtualProcessorImplementation(context, (VirtualProcessorImplementation) semanticObject);
                return;
            case Aadl2Package.VIRTUAL_PROCESSOR_PROTOTYPE:
                sequence_VirtualProcessorPrototype(context, (VirtualProcessorPrototype) semanticObject);
                return;
            case Aadl2Package.VIRTUAL_PROCESSOR_SUBCOMPONENT:
                sequence_VirtualProcessorSubcomponent(context, (VirtualProcessorSubcomponent) semanticObject);
                return;
            case Aadl2Package.VIRTUAL_PROCESSOR_TYPE:
                sequence_VirtualProcessorType(context, (VirtualProcessorType) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ProcessImplementation(org.osate.aadl2.ProcessImplementation) SystemPrototype(org.osate.aadl2.SystemPrototype) SubprogramGroupSubcomponent(org.osate.aadl2.SubprogramGroupSubcomponent) SystemType(org.osate.aadl2.SystemType) VirtualProcessorImplementation(org.osate.aadl2.VirtualProcessorImplementation) ReferenceType(org.osate.aadl2.ReferenceType) DataPort(org.osate.aadl2.DataPort) EventDataPort(org.osate.aadl2.EventDataPort) FeatureGroupPrototype(org.osate.aadl2.FeatureGroupPrototype) NumericRange(org.osate.aadl2.NumericRange) BasicProperty(org.osate.aadl2.BasicProperty) DeviceSubcomponent(org.osate.aadl2.DeviceSubcomponent) PublicPackageSection(org.osate.aadl2.PublicPackageSection) SubprogramAccess(org.osate.aadl2.SubprogramAccess) ListType(org.osate.aadl2.ListType) ThreadGroupSubcomponent(org.osate.aadl2.ThreadGroupSubcomponent) ConnectedElement(org.osate.aadl2.ConnectedElement) PrivatePackageSection(org.osate.aadl2.PrivatePackageSection) AadlString(org.osate.aadl2.AadlString) DefaultAnnexSubclause(org.osate.aadl2.DefaultAnnexSubclause) SubprogramCall(org.osate.aadl2.SubprogramCall) DefaultAnnexLibrary(org.osate.aadl2.DefaultAnnexLibrary) ProcessPrototype(org.osate.aadl2.ProcessPrototype) SubprogramSubcomponent(org.osate.aadl2.SubprogramSubcomponent) ThreadGroupImplementation(org.osate.aadl2.ThreadGroupImplementation) FeatureConnection(org.osate.aadl2.FeatureConnection) SubprogramCallSequence(org.osate.aadl2.SubprogramCallSequence) AbstractPrototype(org.osate.aadl2.AbstractPrototype) ImplementationExtension(org.osate.aadl2.ImplementationExtension) DataPrototype(org.osate.aadl2.DataPrototype) PortConnection(org.osate.aadl2.PortConnection) SystemSubcomponent(org.osate.aadl2.SystemSubcomponent) SubprogramGroupImplementation(org.osate.aadl2.SubprogramGroupImplementation) FeatureGroupTypeRename(org.osate.aadl2.FeatureGroupTypeRename) StringLiteral(org.osate.aadl2.StringLiteral) AbstractType(org.osate.aadl2.AbstractType) SubprogramGroupType(org.osate.aadl2.SubprogramGroupType) SubprogramPrototype(org.osate.aadl2.SubprogramPrototype) VirtualProcessorPrototype(org.osate.aadl2.VirtualProcessorPrototype) FlowEnd(org.osate.aadl2.FlowEnd) ClassifierType(org.osate.aadl2.ClassifierType) ArrayRange(org.osate.aadl2.ArrayRange) ModeTransition(org.osate.aadl2.ModeTransition) NamedValue(org.osate.aadl2.NamedValue) RangeValue(org.osate.aadl2.RangeValue) RealLiteral(org.osate.aadl2.RealLiteral) ProcessType(org.osate.aadl2.ProcessType) ProcessorImplementation(org.osate.aadl2.ProcessorImplementation) VirtualProcessorImplementation(org.osate.aadl2.VirtualProcessorImplementation) RangeType(org.osate.aadl2.RangeType) EventPort(org.osate.aadl2.EventPort) PortProxy(org.osate.aadl2.PortProxy) ArraySize(org.osate.aadl2.ArraySize) DataType(org.osate.aadl2.DataType) VirtualProcessorType(org.osate.aadl2.VirtualProcessorType) ComponentTypeRename(org.osate.aadl2.ComponentTypeRename) BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation) EnumerationLiteral(org.osate.aadl2.EnumerationLiteral) BasicProperty(org.osate.aadl2.BasicProperty) Property(org.osate.aadl2.Property) EndToEndFlow(org.osate.aadl2.EndToEndFlow) BusAccess(org.osate.aadl2.BusAccess) FeatureGroupPrototypeBinding(org.osate.aadl2.FeatureGroupPrototypeBinding) SubprogramGroupPrototype(org.osate.aadl2.SubprogramGroupPrototype) ComponentPrototypeBinding(org.osate.aadl2.ComponentPrototypeBinding) SubprogramGroupAccess(org.osate.aadl2.SubprogramGroupAccess) ThreadSubcomponent(org.osate.aadl2.ThreadSubcomponent) FeaturePrototype(org.osate.aadl2.FeaturePrototype) VirtualBusPrototype(org.osate.aadl2.VirtualBusPrototype) PackageRename(org.osate.aadl2.PackageRename) DataSubcomponent(org.osate.aadl2.DataSubcomponent) ParameterConnection(org.osate.aadl2.ParameterConnection) Parameter(org.eclipse.xtext.Parameter) AccessSpecification(org.osate.aadl2.AccessSpecification) PropertySet(org.osate.aadl2.PropertySet) DevicePrototype(org.osate.aadl2.DevicePrototype) ArrayDimension(org.osate.aadl2.ArrayDimension) DeviceImplementation(org.osate.aadl2.DeviceImplementation) ModeTransitionTrigger(org.osate.aadl2.ModeTransitionTrigger) UnitsType(org.osate.aadl2.UnitsType) ParserRule(org.eclipse.xtext.ParserRule) ClassifierValue(org.osate.aadl2.ClassifierValue) ModalPropertyValue(org.osate.aadl2.ModalPropertyValue) ReferenceValue(org.osate.aadl2.ReferenceValue) FeatureGroupPrototypeActual(org.osate.aadl2.FeatureGroupPrototypeActual) EPackage(org.eclipse.emf.ecore.EPackage) DataAccess(org.osate.aadl2.DataAccess) VirtualBusImplementation(org.osate.aadl2.VirtualBusImplementation) BusImplementation(org.osate.aadl2.BusImplementation) FlowSpecification(org.osate.aadl2.FlowSpecification) ComponentPrototypeActual(org.osate.aadl2.ComponentPrototypeActual) FeatureGroupConnection(org.osate.aadl2.FeatureGroupConnection) VirtualBusType(org.osate.aadl2.VirtualBusType) ThreadImplementation(org.osate.aadl2.ThreadImplementation) FeaturePrototypeReference(org.osate.aadl2.FeaturePrototypeReference) EventDataPort(org.osate.aadl2.EventDataPort) MetaclassReference(org.osate.aadl2.MetaclassReference) IntegerLiteral(org.osate.aadl2.IntegerLiteral) MemoryPrototype(org.osate.aadl2.MemoryPrototype) AadlReal(org.osate.aadl2.AadlReal) ThreadGroupType(org.osate.aadl2.ThreadGroupType) ComponentImplementationReference(org.osate.aadl2.ComponentImplementationReference) ListValue(org.osate.aadl2.ListValue) BusSubcomponent(org.osate.aadl2.BusSubcomponent) VirtualBusSubcomponent(org.osate.aadl2.VirtualBusSubcomponent) EndToEndFlowSegment(org.osate.aadl2.EndToEndFlowSegment) AbstractFeature(org.osate.aadl2.AbstractFeature) DeviceType(org.osate.aadl2.DeviceType) EventSource(org.osate.aadl2.EventSource) ProcessSubcomponent(org.osate.aadl2.ProcessSubcomponent) BusPrototype(org.osate.aadl2.BusPrototype) VirtualBusPrototype(org.osate.aadl2.VirtualBusPrototype) Realization(org.osate.aadl2.Realization) ThreadType(org.osate.aadl2.ThreadType) SubprogramType(org.osate.aadl2.SubprogramType) ThreadPrototype(org.osate.aadl2.ThreadPrototype) AbstractImplementation(org.osate.aadl2.AbstractImplementation) ModeBinding(org.osate.aadl2.ModeBinding) ContainedNamedElement(org.osate.aadl2.ContainedNamedElement) EndToEndFlowSegment(org.osate.aadl2.EndToEndFlowSegment) FlowSegment(org.osate.aadl2.FlowSegment) ThreadGroupPrototype(org.osate.aadl2.ThreadGroupPrototype) ComputedValue(org.osate.aadl2.ComputedValue) Action(org.eclipse.xtext.Action) FeatureGroup(org.osate.aadl2.FeatureGroup) MemoryImplementation(org.osate.aadl2.MemoryImplementation) BusType(org.osate.aadl2.BusType) VirtualBusType(org.osate.aadl2.VirtualBusType) VirtualProcessorType(org.osate.aadl2.VirtualProcessorType) ProcessorType(org.osate.aadl2.ProcessorType) BooleanLiteral(org.osate.aadl2.BooleanLiteral) PropertyAssociation(org.osate.aadl2.PropertyAssociation) BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation) AbstractSubcomponent(org.osate.aadl2.AbstractSubcomponent) FlowImplementation(org.osate.aadl2.FlowImplementation) FeatureGroupType(org.osate.aadl2.FeatureGroupType) VirtualBusImplementation(org.osate.aadl2.VirtualBusImplementation) Operation(org.osate.aadl2.Operation) FeaturePrototypeBinding(org.osate.aadl2.FeaturePrototypeBinding) ProcessorPrototype(org.osate.aadl2.ProcessorPrototype) VirtualProcessorPrototype(org.osate.aadl2.VirtualProcessorPrototype) EventDataSource(org.osate.aadl2.EventDataSource) SubprogramProxy(org.osate.aadl2.SubprogramProxy) RecordType(org.osate.aadl2.RecordType) GroupExtension(org.osate.aadl2.GroupExtension) AadlInteger(org.osate.aadl2.AadlInteger) UnitLiteral(org.osate.aadl2.UnitLiteral) ProcessorSubcomponent(org.osate.aadl2.ProcessorSubcomponent) VirtualProcessorSubcomponent(org.osate.aadl2.VirtualProcessorSubcomponent) MemorySubcomponent(org.osate.aadl2.MemorySubcomponent) MemoryType(org.osate.aadl2.MemoryType) AadlPackage(org.osate.aadl2.AadlPackage) VirtualBusSubcomponent(org.osate.aadl2.VirtualBusSubcomponent) VirtualProcessorSubcomponent(org.osate.aadl2.VirtualProcessorSubcomponent) Mode(org.osate.aadl2.Mode) ContainmentPathElement(org.osate.aadl2.ContainmentPathElement) EnumerationType(org.osate.aadl2.EnumerationType) RecordValue(org.osate.aadl2.RecordValue) DataImplementation(org.osate.aadl2.DataImplementation) SubprogramImplementation(org.osate.aadl2.SubprogramImplementation) TypeExtension(org.osate.aadl2.TypeExtension) PropertyConstant(org.osate.aadl2.PropertyConstant) PortSpecification(org.osate.aadl2.PortSpecification) AadlBoolean(org.osate.aadl2.AadlBoolean) SystemImplementation(org.osate.aadl2.SystemImplementation) AccessConnection(org.osate.aadl2.AccessConnection)

Example 4 with DefaultAnnexLibrary

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

the class AnnexParserAgent method processAnnexSection.

/**
 * Common functionality for processing either a {@link DefaultAnnexLibrary} or a {@link DefaultAnnexSubclause}.
 * Processing involves parsing the text, attaching the resulting {@link AnnexLibrary} or {@link AnnexSubclause} to
 * the {@link DefaultAnnexLibrary} or {@link DefaultAnnexSubclause}, setting the modes for the resulting
 * {@link AnnexSubclause}, and either running the resolver or the linking service, depending upon which one if
 * available. If the resolver produces errors, then the {@link AnnexLibrary} or {@link AnnexSubclause} will be
 * detached from the {@link DefaultAnnexLibrary} or {@link DefaultAnnexSubclause}. All error, warning, and info
 * messages that are produced from the parser, resolver, or linker will be passed along to
 * {@code diagnosticsConsumer}.
 *
 * @param <A> Type of the resulting annex section. Expected to be {@link AnnexLibrary} or {@link AnnexSubclause}.
 * @param <D> Type of the default annex section. Expected to be {@link DefaultAnnexLibrary} or
 *            {@link DefaultAnnexSubclause}.
 * @param defaultAnnexSection Either the {@link DefaultAnnexLibrary} or {@link DefaultAnnexSubclause}.
 * @param annexText Either the value of {@link DefaultAnnexLibrary#getSourceText()} or
 *                  {@link DefaultAnnexSubclause#getSourceText()}.
 * @param filename Name of the AADL file containing the annex section.
 * @param diagnosticsConsumer Used for handling error, warning, and info messages.
 * @param parserFunction Either
 *                       {@link AnnexParser#parseAnnexLibrary(String, String, String, int, int, ParseErrorReporter)}
 *                       or
 *                       {@link AnnexParser#parseAnnexSubclause(String, String, String, int, int, ParseErrorReporter)}.
 * @param setParsedAnnexSection Either {@link DefaultAnnexLibrary#setSourceText(String)} or
 *                              {@link DefaultAnnexSubclause#setSourceText(String)}.
 * @param copyModes Function for copying modes from the {@link DefaultAnnexSubclause} into the newly created
 *                  {@link AnnexSubclause}. When processing an annex library, {@code copyModes} is expected to be a
 *                  no-op {@link Consumer}.
 */
private <A extends NamedElement, D extends A> void processAnnexSection(D defaultAnnexSection, String annexText, String filename, IDiagnosticConsumer diagnosticsConsumer, ParserFunction<A> parserFunction, Consumer<A> setParsedAnnexSection, Consumer<A> copyModes) {
    INode node = NodeModelUtils.findActualNodeFor(defaultAnnexSection);
    int line = node.getStartLine() + computeLineOffset(node);
    int offset = AnnexUtil.getAnnexOffset(defaultAnnexSection);
    // look for plug-in parser
    String annexName = defaultAnnexSection.getName();
    if (annexText != null && annexText.length() > 6 && annexName != null) {
        // strip {** **} from annex text
        if (annexText.startsWith("{**")) {
            annexText = annexText.substring(3, annexText.length() - 3);
        }
        annexName = AnnexModel.filterDisabledAnnexes(defaultAnnexSection, annexName);
        AnnexParser ap = PARSER_REGISTRY.getAnnexParser(annexName);
        try {
            QueuingParseErrorReporter parseErrReporter = new QueuingParseErrorReporter();
            parseErrReporter.setContextResource(defaultAnnexSection.eResource());
            if (defaultAnnexSection instanceof AnnexSubclause) {
                AnnexUtil.setCurrentAnnexSubclause((AnnexSubclause) defaultAnnexSection);
            }
            A annexSection = parserFunction.parse(ap, annexName, annexText, filename, line, offset, parseErrReporter);
            if (defaultAnnexSection instanceof AnnexSubclause) {
                AnnexUtil.setCurrentAnnexSubclause(null);
            }
            if (ParseResultHolder.Factory.INSTANCE.adapt(defaultAnnexSection).getParseResult() == null) {
                // Only consume messages for non-Xtext annexes
                consumeMessages(parseErrReporter, diagnosticsConsumer, annexText, line, offset);
            }
            if (annexSection != null) {
                annexSection.setName(annexName);
                setParsedAnnexSection.accept(annexSection);
                // copy in modes list
                copyModes.accept(annexSection);
                // now resolve reference so we get messages if we have references to undefined items
                AnnexResolver resolver = RESOLVER_REGISTRY.getAnnexResolver(annexName);
                AnnexLinkingService linkingService = LINKING_SERVICE_REGISTRY.getAnnexLinkingService(annexName);
                if (resolver != null && parseErrReporter.getNumErrors() == 0) {
                    // Don't resolve any annex with parsing errors.
                    QueuingParseErrorReporter resolveErrReporter = new QueuingParseErrorReporter();
                    AnalysisErrorReporterManager resolveErrManager = new AnalysisErrorReporterManager(new AnalysisToParseErrorReporterAdapter.Factory(aadlRsrc -> resolveErrReporter));
                    resolver.resolveAnnex(annexName, Collections.singletonList(annexSection), resolveErrManager);
                    consumeMessages(resolveErrReporter, diagnosticsConsumer, annexText, line, offset);
                    if (resolveErrReporter.getNumErrors() != 0) {
                        AnnexValidator.setNoValidation(defaultAnnexSection, annexName);
                    }
                } else if (linkingService != null) {
                    try {
                        XtextResource res = (XtextResource) defaultAnnexSection.eResource();
                        ILinker linker = res.getLinker();
                        linker.linkModel(annexSection, diagnosticsConsumer);
                    } catch (Exception e) {
                        String message = "Linking Service error in " + filename + " at line " + line;
                        IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message, e);
                        Activator.getDefault().getLog().log(status);
                    }
                }
            }
            if (parseErrReporter.getNumErrors() > 0) {
                AnnexValidator.setNoValidation(defaultAnnexSection, annexName);
            }
        } catch (RecognitionException e) {
            String message = "Major parsing error in " + filename + " at line " + line;
            IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message, e);
            Activator.getDefault().getLog().log(status);
        }
    }
}
Also used : AnnexParserRegistry(org.osate.annexsupport.AnnexParserRegistry) AnnexUtil(org.osate.annexsupport.AnnexUtil) StringUtils(org.apache.commons.lang.StringUtils) DefaultAnnexLibrary(org.osate.aadl2.DefaultAnnexLibrary) ParseErrorReporter(org.osate.aadl2.modelsupport.errorreporting.ParseErrorReporter) AnnexLinkingServiceRegistry(org.osate.annexsupport.AnnexLinkingServiceRegistry) AnalysisErrorReporterManager(org.osate.aadl2.modelsupport.errorreporting.AnalysisErrorReporterManager) Diagnostic(org.eclipse.xtext.diagnostics.Diagnostic) NodeModelUtils(org.eclipse.xtext.nodemodel.util.NodeModelUtils) DefaultAnnexSubclause(org.osate.aadl2.DefaultAnnexSubclause) IStatus(org.eclipse.core.runtime.IStatus) RecognitionException(antlr.RecognitionException) AnnexLinkingService(org.osate.annexsupport.AnnexLinkingService) INode(org.eclipse.xtext.nodemodel.INode) AnnexRegistry(org.osate.annexsupport.AnnexRegistry) Message(org.osate.aadl2.modelsupport.errorreporting.QueuingParseErrorReporter.Message) XtextResource(org.eclipse.xtext.resource.XtextResource) AnnexParser(org.osate.annexsupport.AnnexParser) AnnexResolverRegistry(org.osate.annexsupport.AnnexResolverRegistry) Severity(org.eclipse.xtext.diagnostics.Severity) AnnexValidator(org.osate.annexsupport.AnnexValidator) Status(org.eclipse.core.runtime.Status) EObject(org.eclipse.emf.ecore.EObject) AadlPackage(org.osate.aadl2.AadlPackage) AnalysisToParseErrorReporterAdapter(org.osate.aadl2.modelsupport.errorreporting.AnalysisToParseErrorReporterAdapter) IDiagnosticConsumer(org.eclipse.xtext.diagnostics.IDiagnosticConsumer) ParseResultHolder(org.osate.annexsupport.ParseResultHolder) Consumer(java.util.function.Consumer) List(java.util.List) AnnexResolver(org.osate.annexsupport.AnnexResolver) AnnexModel(org.osate.annexsupport.AnnexModel) AnnexSubclause(org.osate.aadl2.AnnexSubclause) ILinker(org.eclipse.xtext.linking.ILinker) NamedElement(org.osate.aadl2.NamedElement) Activator(org.osate.xtext.aadl2.Activator) Collections(java.util.Collections) LazyLinker(org.eclipse.xtext.linking.lazy.LazyLinker) AnnexLibrary(org.osate.aadl2.AnnexLibrary) QueuingParseErrorReporter(org.osate.aadl2.modelsupport.errorreporting.QueuingParseErrorReporter) IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) INode(org.eclipse.xtext.nodemodel.INode) ILinker(org.eclipse.xtext.linking.ILinker) IStatus(org.eclipse.core.runtime.IStatus) AnnexParser(org.osate.annexsupport.AnnexParser) XtextResource(org.eclipse.xtext.resource.XtextResource) AnalysisErrorReporterManager(org.osate.aadl2.modelsupport.errorreporting.AnalysisErrorReporterManager) RecognitionException(antlr.RecognitionException) AnalysisToParseErrorReporterAdapter(org.osate.aadl2.modelsupport.errorreporting.AnalysisToParseErrorReporterAdapter) AnnexLinkingService(org.osate.annexsupport.AnnexLinkingService) AnnexResolver(org.osate.annexsupport.AnnexResolver) QueuingParseErrorReporter(org.osate.aadl2.modelsupport.errorreporting.QueuingParseErrorReporter) DefaultAnnexSubclause(org.osate.aadl2.DefaultAnnexSubclause) AnnexSubclause(org.osate.aadl2.AnnexSubclause) RecognitionException(antlr.RecognitionException)

Example 5 with DefaultAnnexLibrary

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

the class AnnexHandler method getAnnexLibraryIndex.

/**
 * Returns a 0 based index for referencing an annex library in a list that contains only annex libraries with the same type and owner
 * @param annexLibrary
 * @return
 */
private static int getAnnexLibraryIndex(AnnexLibrary annexLibrary) {
    // Get the default annex library if a parsed annex library was specified. This is needed for the comparison later in the function.
    if (!(annexLibrary instanceof DefaultAnnexLibrary)) {
        if (annexLibrary.eContainer() instanceof DefaultAnnexLibrary) {
            annexLibrary = (AnnexLibrary) annexLibrary.eContainer();
        } else {
            return -1;
        }
    }
    final String annexName = annexLibrary.getName();
    if (annexName == null) {
        return -1;
    }
    // Get the Aadl Package
    Element tmp = annexLibrary.getOwner();
    while (tmp != null && !(tmp instanceof AadlPackage)) {
        tmp = tmp.getOwner();
    }
    int index = 0;
    if (tmp instanceof AadlPackage) {
        for (final AnnexLibrary tmpLibrary : AnnexUtil.getAllDefaultAnnexLibraries((AadlPackage) tmp)) {
            if (tmpLibrary == annexLibrary) {
                return index;
            } else if (annexName.equalsIgnoreCase(tmpLibrary.getName())) {
                index++;
            }
        }
    }
    return -1;
}
Also used : AadlPackage(org.osate.aadl2.AadlPackage) Element(org.osate.aadl2.Element) NamedElement(org.osate.aadl2.NamedElement) DefaultAnnexLibrary(org.osate.aadl2.DefaultAnnexLibrary) AnnexLibrary(org.osate.aadl2.AnnexLibrary) DefaultAnnexLibrary(org.osate.aadl2.DefaultAnnexLibrary)

Aggregations

DefaultAnnexLibrary (org.osate.aadl2.DefaultAnnexLibrary)13 EObject (org.eclipse.emf.ecore.EObject)9 DefaultAnnexSubclause (org.osate.aadl2.DefaultAnnexSubclause)9 AnnexLibrary (org.osate.aadl2.AnnexLibrary)8 XtextResource (org.eclipse.xtext.resource.XtextResource)6 AadlPackage (org.osate.aadl2.AadlPackage)6 AnnexSubclause (org.osate.aadl2.AnnexSubclause)6 NamedElement (org.osate.aadl2.NamedElement)4 IResource (org.eclipse.core.resources.IResource)3 IStatus (org.eclipse.core.runtime.IStatus)3 INode (org.eclipse.xtext.nodemodel.INode)3 RecognitionException (antlr.RecognitionException)2 SelectionExpr (com.rockwellcollins.atc.agree.agree.SelectionExpr)2 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 List (java.util.List)2 Consumer (java.util.function.Consumer)2 StringUtils (org.apache.commons.lang.StringUtils)2 IFile (org.eclipse.core.resources.IFile)2 Status (org.eclipse.core.runtime.Status)2