Search in sources :

Example 26 with AnnexSubclause

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

the class GenMCSHandler method runJob.

@Override
protected IStatus runJob(Element root, IProgressMonitor monitor) {
    EphemeralImplementationUtil implUtil = new EphemeralImplementationUtil(monitor);
    // this flag is set by the rerun handler to prevent clearing the advice map
    if (!calledFromRerun) {
        rerunAdviceMap.clear();
    }
    calledFromRerun = false;
    disableRerunHandler();
    handlerService = getWindow().getService(IHandlerService.class);
    try {
        // Make sure the user selected a component implementation
        ComponentImplementation ci = getComponentImplementation(root, implUtil);
        SystemInstance si = getSysInstance(ci, implUtil);
        AnalysisResult result;
        CompositeAnalysisResult wrapper = new CompositeAnalysisResult("");
        // SystemType sysType = si.getSystemImplementation().getType();
        ComponentType sysType = AgreeUtils.getInstanceType(si);
        EList<AnnexSubclause> annexSubClauses = AnnexUtil.getAllAnnexSubclauses(sysType, AgreePackage.eINSTANCE.getAgreeContractSubclause());
        if (annexSubClauses.size() == 0) {
            throw new AgreeException("There is not an AGREE annex in the '" + sysType.getName() + "' system type.");
        }
        if (isRecursive()) {
            if (AgreeUtils.usingKind2()) {
                throw new AgreeException("Kind2 only supports monolithic verification");
            }
            result = buildAnalysisResult(((NamedElement) root).getName(), si);
            wrapper.addChild(result);
            result = wrapper;
        } else if (isRealizability()) {
            AgreeProgram agreeProgram = new AgreeASTBuilder().getAgreeProgram(si, false);
            Program program = LustreAstBuilder.getRealizabilityLustreProgram(agreeProgram);
            wrapper.addChild(createVerification("Realizability Check", si, program, agreeProgram, AnalysisType.Realizability));
            result = wrapper;
        } else {
            wrapVerificationResult(si, wrapper);
            result = wrapper;
        }
        showView(result, linker);
        return doAnalysis(root, monitor, result, linker);
    } catch (Throwable e) {
        String messages = getNestedMessages(e);
        return new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, messages, e);
    } finally {
        implUtil.cleanup();
    }
}
Also used : ComponentImplementation(org.osate.aadl2.ComponentImplementation) IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) ComponentType(org.osate.aadl2.ComponentType) Program(jkind.lustre.Program) AgreeProgram(com.rockwellcollins.atc.agree.analysis.ast.AgreeProgram) AgreeProgram(com.rockwellcollins.atc.agree.analysis.ast.AgreeProgram) EphemeralImplementationUtil(com.rockwellcollins.atc.agree.analysis.EphemeralImplementationUtil) AnalysisResult(jkind.api.results.AnalysisResult) CompositeAnalysisResult(jkind.api.results.CompositeAnalysisResult) IHandlerService(org.eclipse.ui.handlers.IHandlerService) AgreeASTBuilder(com.rockwellcollins.atc.agree.analysis.ast.AgreeASTBuilder) SystemInstance(org.osate.aadl2.instance.SystemInstance) CompositeAnalysisResult(jkind.api.results.CompositeAnalysisResult) AgreeException(com.rockwellcollins.atc.agree.analysis.AgreeException) NamedElement(org.osate.aadl2.NamedElement) AnnexSubclause(org.osate.aadl2.AnnexSubclause)

Example 27 with AnnexSubclause

use of org.osate.aadl2.AnnexSubclause 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 28 with AnnexSubclause

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

the class SafetyPackageImpl 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);
    AgreePackage theAgreePackage = (AgreePackage) EPackage.Registry.INSTANCE.getEPackage(AgreePackage.eNS_URI);
    EcorePackage theEcorePackage = (EcorePackage) EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
    // Create type parameters
    // Set bounds for type parameters
    // Add supertypes to classes
    annexLibraryEClass.getESuperTypes().add(theAadl2Package.getAnnexLibrary());
    annexSubclauseEClass.getESuperTypes().add(theAadl2Package.getAnnexSubclause());
    safetyLibraryEClass.getESuperTypes().add(this.getAnnexLibrary());
    safetySubclauseEClass.getESuperTypes().add(this.getAnnexSubclause());
    specStatementEClass.getESuperTypes().add(theAgreePackage.getSpecStatement());
    faultSubcomponentEClass.getESuperTypes().add(theAadl2Package.getElement());
    safetyEqStatementEClass.getESuperTypes().add(theAadl2Package.getElement());
    safetyEqStatementEClass.getESuperTypes().add(this.getFaultSubcomponent());
    safetyContractLibraryEClass.getESuperTypes().add(this.getSafetyLibrary());
    safetyContractSubclauseEClass.getESuperTypes().add(this.getSafetySubclause());
    safetyContractEClass.getESuperTypes().add(this.getContract());
    faultStatementEClass.getESuperTypes().add(this.getSpecStatement());
    analysisStatementEClass.getESuperTypes().add(this.getSpecStatement());
    hwFaultStatementEClass.getESuperTypes().add(this.getSpecStatement());
    propagateStatementEClass.getESuperTypes().add(this.getSpecStatement());
    activationStatementEClass.getESuperTypes().add(this.getSpecStatement());
    faultCountBehaviorEClass.getESuperTypes().add(this.getAnalysisBehavior());
    probabilityBehaviorEClass.getESuperTypes().add(this.getAnalysisBehavior());
    inputStatementEClass.getESuperTypes().add(this.getFaultSubcomponent());
    outputStatementEClass.getESuperTypes().add(this.getFaultSubcomponent());
    durationStatementEClass.getESuperTypes().add(this.getFaultSubcomponent());
    durationStatementEClass.getESuperTypes().add(this.getHWFaultSubcomponent());
    probabilityStatementEClass.getESuperTypes().add(this.getFaultSubcomponent());
    probabilityStatementEClass.getESuperTypes().add(this.getHWFaultSubcomponent());
    disableStatementEClass.getESuperTypes().add(this.getFaultSubcomponent());
    triggerStatementEClass.getESuperTypes().add(this.getFaultSubcomponent());
    propagationTypeStatementEClass.getESuperTypes().add(this.getFaultSubcomponent());
    propagationTypeStatementEClass.getESuperTypes().add(this.getHWFaultSubcomponent());
    asymmetricEClass.getESuperTypes().add(this.getPropagationTypeConstraint());
    symmetricEClass.getESuperTypes().add(this.getPropagationTypeConstraint());
    permanentConstraintEClass.getESuperTypes().add(this.getTemporalConstraint());
    transientConstraintEClass.getESuperTypes().add(this.getTemporalConstraint());
    enablerConditionEClass.getESuperTypes().add(this.getTriggerCondition());
    eqValueEClass.getESuperTypes().add(this.getSafetyEqStatement());
    intervalEqEClass.getESuperTypes().add(this.getSafetyEqStatement());
    setEqEClass.getESuperTypes().add(this.getSafetyEqStatement());
    rangeEqEClass.getESuperTypes().add(this.getSafetyEqStatement());
    closedSafetyIntervalEClass.getESuperTypes().add(this.getSafetyInterval());
    openLeftSafetyIntervalEClass.getESuperTypes().add(this.getSafetyInterval());
    openRightSafetyIntervalEClass.getESuperTypes().add(this.getSafetyInterval());
    openSafetyIntervalEClass.getESuperTypes().add(this.getSafetyInterval());
    // Initialize classes and features; add operations and parameters
    initEClass(annexLibraryEClass, AnnexLibrary.class, "AnnexLibrary", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(annexSubclauseEClass, AnnexSubclause.class, "AnnexSubclause", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(safetyLibraryEClass, SafetyLibrary.class, "SafetyLibrary", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(safetySubclauseEClass, SafetySubclause.class, "SafetySubclause", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(contractEClass, Contract.class, "Contract", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(specStatementEClass, SpecStatement.class, "SpecStatement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(analysisBehaviorEClass, AnalysisBehavior.class, "AnalysisBehavior", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(faultSubcomponentEClass, FaultSubcomponent.class, "FaultSubcomponent", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(hwFaultSubcomponentEClass, HWFaultSubcomponent.class, "HWFaultSubcomponent", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(propagationTypeConstraintEClass, PropagationTypeConstraint.class, "PropagationTypeConstraint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(temporalConstraintEClass, TemporalConstraint.class, "TemporalConstraint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(triggerConditionEClass, TriggerCondition.class, "TriggerCondition", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(safetyEqStatementEClass, SafetyEqStatement.class, "SafetyEqStatement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(safetyIntervalEClass, SafetyInterval.class, "SafetyInterval", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getSafetyInterval_Low(), theAgreePackage.getExpr(), null, "low", null, 0, 1, SafetyInterval.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getSafetyInterval_High(), theAgreePackage.getExpr(), null, "high", null, 0, 1, SafetyInterval.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(safetyContractLibraryEClass, SafetyContractLibrary.class, "SafetyContractLibrary", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getSafetyContractLibrary_Contract(), this.getContract(), null, "contract", null, 0, 1, SafetyContractLibrary.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(safetyContractSubclauseEClass, SafetyContractSubclause.class, "SafetyContractSubclause", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getSafetyContractSubclause_Contract(), this.getContract(), null, "contract", null, 0, 1, SafetyContractSubclause.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(safetyContractEClass, SafetyContract.class, "SafetyContract", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getSafetyContract_Specs(), this.getSpecStatement(), null, "specs", null, 0, -1, SafetyContract.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(faultStatementEClass, FaultStatement.class, "FaultStatement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getFaultStatement_Name(), theEcorePackage.getEString(), "name", null, 0, 1, FaultStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getFaultStatement_Str(), theEcorePackage.getEString(), "str", null, 0, 1, FaultStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getFaultStatement_FaultDefName(), theAgreePackage.getDoubleDotRef(), null, "faultDefName", null, 0, 1, FaultStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getFaultStatement_FaultDefinitions(), this.getFaultSubcomponent(), null, "faultDefinitions", null, 0, -1, FaultStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(analysisStatementEClass, AnalysisStatement.class, "AnalysisStatement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getAnalysisStatement_Behavior(), this.getAnalysisBehavior(), null, "behavior", null, 0, 1, AnalysisStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(hwFaultStatementEClass, HWFaultStatement.class, "HWFaultStatement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getHWFaultStatement_Name(), theEcorePackage.getEString(), "name", null, 0, 1, HWFaultStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getHWFaultStatement_Str(), theEcorePackage.getEString(), "str", null, 0, 1, HWFaultStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getHWFaultStatement_FaultDefinitions(), this.getHWFaultSubcomponent(), null, "faultDefinitions", null, 0, -1, HWFaultStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(propagateStatementEClass, PropagateStatement.class, "PropagateStatement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getPropagateStatement_SrcFaultList(), theEcorePackage.getEString(), "srcFaultList", null, 0, -1, PropagateStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getPropagateStatement_SrcComp_path(), theAadl2Package.getNamedElement(), null, "srcComp_path", null, 0, -1, PropagateStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getPropagateStatement_DestFaultList(), theEcorePackage.getEString(), "destFaultList", null, 0, -1, PropagateStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getPropagateStatement_DestComp_path(), theAadl2Package.getNamedElement(), null, "destComp_path", null, 0, -1, PropagateStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(activationStatementEClass, ActivationStatement.class, "ActivationStatement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getActivationStatement_AgreeBoolVarName(), theEcorePackage.getEString(), "agreeBoolVarName", null, 0, 1, ActivationStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getActivationStatement_AgreeComp_Path(), theAadl2Package.getNamedElement(), null, "agreeComp_Path", null, 0, 1, ActivationStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getActivationStatement_FaultName(), theEcorePackage.getEString(), "faultName", null, 0, 1, ActivationStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getActivationStatement_FaultComp_Path(), theAadl2Package.getNamedElement(), null, "faultComp_Path", null, 0, 1, ActivationStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(faultCountBehaviorEClass, FaultCountBehavior.class, "FaultCountBehavior", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getFaultCountBehavior_MaxFaults(), theEcorePackage.getEString(), "maxFaults", null, 0, 1, FaultCountBehavior.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(probabilityBehaviorEClass, ProbabilityBehavior.class, "ProbabilityBehavior", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getProbabilityBehavior_Probabilty(), theEcorePackage.getEString(), "probabilty", null, 0, 1, ProbabilityBehavior.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(inputStatementEClass, InputStatement.class, "InputStatement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getInputStatement_Fault_in(), theEcorePackage.getEString(), "fault_in", null, 0, -1, InputStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getInputStatement_Nom_conn(), theAgreePackage.getExpr(), null, "nom_conn", null, 0, -1, InputStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(outputStatementEClass, OutputStatement.class, "OutputStatement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getOutputStatement_Nom_conn(), theAadl2Package.getNamedElement(), null, "nom_conn", null, 0, -1, OutputStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getOutputStatement_Fault_out(), theEcorePackage.getEString(), "fault_out", null, 0, -1, OutputStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(durationStatementEClass, DurationStatement.class, "DurationStatement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getDurationStatement_Tc(), this.getTemporalConstraint(), null, "tc", null, 0, 1, DurationStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getDurationStatement_Interv(), this.getSafetyInterval(), null, "interv", null, 0, 1, DurationStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(probabilityStatementEClass, ProbabilityStatement.class, "ProbabilityStatement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getProbabilityStatement_Probability(), theEcorePackage.getEString(), "probability", null, 0, 1, ProbabilityStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(disableStatementEClass, DisableStatement.class, "DisableStatement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getDisableStatement_Cond(), theAadl2Package.getBooleanLiteral(), null, "cond", null, 0, 1, DisableStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(triggerStatementEClass, TriggerStatement.class, "TriggerStatement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getTriggerStatement_Cond(), this.getTriggerCondition(), null, "cond", null, 0, 1, TriggerStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(propagationTypeStatementEClass, PropagationTypeStatement.class, "PropagationTypeStatement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getPropagationTypeStatement_Pty(), this.getPropagationTypeConstraint(), null, "pty", null, 0, 1, PropagationTypeStatement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(asymmetricEClass, asymmetric.class, "asymmetric", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(symmetricEClass, symmetric.class, "symmetric", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(permanentConstraintEClass, PermanentConstraint.class, "PermanentConstraint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(transientConstraintEClass, TransientConstraint.class, "TransientConstraint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(enablerConditionEClass, EnablerCondition.class, "EnablerCondition", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getEnablerCondition_ExprList(), theAgreePackage.getExpr(), null, "exprList", null, 0, -1, EnablerCondition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(eqValueEClass, EqValue.class, "EqValue", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getEqValue_Lhs(), theAgreePackage.getArg(), null, "lhs", null, 0, -1, EqValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getEqValue_Expr(), theAgreePackage.getExpr(), null, "expr", null, 0, 1, EqValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(intervalEqEClass, IntervalEq.class, "IntervalEq", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getIntervalEq_Lhs_int(), theAgreePackage.getArg(), null, "lhs_int", null, 0, 1, IntervalEq.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getIntervalEq_Interv(), this.getSafetyInterval(), null, "interv", null, 0, 1, IntervalEq.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(setEqEClass, SetEq.class, "SetEq", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getSetEq_Lhs_set(), theAgreePackage.getArg(), null, "lhs_set", null, 0, 1, SetEq.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getSetEq_L1(), theAgreePackage.getExpr(), null, "l1", null, 0, 1, SetEq.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getSetEq_List(), theAgreePackage.getExpr(), null, "list", null, 0, -1, SetEq.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(rangeEqEClass, RangeEq.class, "RangeEq", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getRangeEq_Lhs_range(), theAgreePackage.getArg(), null, "lhs_range", null, 0, 1, RangeEq.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getRangeEq_L1(), theAgreePackage.getExpr(), null, "l1", null, 0, 1, RangeEq.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getRangeEq_L2(), theAgreePackage.getExpr(), null, "l2", null, 0, 1, RangeEq.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(closedSafetyIntervalEClass, ClosedSafetyInterval.class, "ClosedSafetyInterval", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(openLeftSafetyIntervalEClass, OpenLeftSafetyInterval.class, "OpenLeftSafetyInterval", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(openRightSafetyIntervalEClass, OpenRightSafetyInterval.class, "OpenRightSafetyInterval", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(openSafetyIntervalEClass, OpenSafetyInterval.class, "OpenSafetyInterval", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    // Create resource
    createResource(eNS_URI);
}
Also used : Aadl2Package(org.osate.aadl2.Aadl2Package) EcorePackage(org.eclipse.emf.ecore.EcorePackage) AgreePackage(com.rockwellcollins.atc.agree.agree.AgreePackage)

Example 29 with AnnexSubclause

use of org.osate.aadl2.AnnexSubclause in project osate-plugin by sireum.

the class VisitorUtil method buildPosInfo.

public static Position buildPosInfo(EObject elem) {
    final org.sireum.hamr.ir.AadlASTFactory factory = new org.sireum.hamr.ir.AadlASTFactory();
    EObject obj = elem;
    if (obj == null) {
        return null;
    }
    INode node = NodeModelUtils.findActualNodeFor(obj);
    if (node != null) {
        int startOffset = node.getOffset();
        int endOffset = node.getEndOffset();
        INode rnode = node.getRootNode();
        if (// 
        rnode.getSemanticElement() != null && (rnode.getSemanticElement() instanceof AnnexLibrary || rnode.getSemanticElement() instanceof AnnexSubclause)) {
            AadlPackage pack = AadlUtil.getContainingPackage(node.getRootNode().getSemanticElement());
            INode ccNode = NodeModelUtils.findActualNodeFor(pack);
            rnode = ccNode.getRootNode();
        }
        LineAndColumn startLC = NodeModelUtils.getLineAndColumn(rnode, startOffset);
        LineAndColumn endLC = NodeModelUtils.getLineAndColumn(rnode, endOffset);
        return factory.flatPos(getResourcePath(elem), startLC.getLine(), startLC.getColumn(), endLC.getLine(), endLC.getColumn(), node.getOffset(), node.getLength());
    } else {
        EObject defaultannex = AadlUtil.getContainingDefaultAnnex(obj);
        if (defaultannex != null) {
            node = NodeModelUtils.findActualNodeFor(obj);
            if (node != null) {
                return factory.flatPos(getResourcePath(elem), node.getTotalStartLine(), node.getOffset(), node.getTotalEndLine(), node.getEndOffset(), node.getOffset(), node.getLength());
            }
        }
    }
    return null;
}
Also used : INode(org.eclipse.xtext.nodemodel.INode) AadlPackage(org.osate.aadl2.AadlPackage) LineAndColumn(org.eclipse.xtext.util.LineAndColumn) EObject(org.eclipse.emf.ecore.EObject) AnnexLibrary(org.osate.aadl2.AnnexLibrary) AnnexSubclause(org.osate.aadl2.AnnexSubclause)

Example 30 with AnnexSubclause

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

the class SafetyUtil method getSafetyAnnexes.

/**
 * getSafetyAnnexes from an AgreeNode
 *
 * @param EObject comp : The component classifier in question will contain
 * the safety annex.
 * @return SafetyContractSubclause : This is the safety annex.
 *
 * MWW: generalized to return a list in case of multiple annex instances.
 * Also generalized the lookup type to support the different kinds of
 * EObjects used by AGREE to represent references.
 */
public static List<SafetyContractSubclause> getSafetyAnnexes(AgreeNode node, boolean isTop) {
    List<SafetyContractSubclause> subclauses = new ArrayList<>();
    // get the component instance from the AGREE program: less brittle than storing a global ref
    // in verify handler - esp. if the user selects a different impl.
    ComponentClassifier comp;
    comp = node.compInst.getClassifier();
    if (!isTop && comp instanceof ComponentImplementation) {
        comp = ((ComponentImplementation) comp).getType();
    } else if (isTop && node.compInst instanceof SystemInstanceImpl) {
        comp = ((SystemInstanceImpl) node.compInst).getComponentImplementation();
    }
    // Grab the annex subclause using the safety package instance
    for (AnnexSubclause annex : AnnexUtil.getAllAnnexSubclauses(comp, SafetyPackage.eINSTANCE.getSafetyContractSubclause())) {
        // Then get the component classifier from that and return the annex
        if (annex instanceof SafetyContractSubclause) {
            // In newer versions of osate the annex this returns annexes in
            // the type as well as the implementation. We want the annex in the
            // specific component.
            EObject container = annex.eContainer();
            while (!(container instanceof ComponentClassifier)) {
                container = container.eContainer();
            }
            if (container == comp) {
                subclauses.add((SafetyContractSubclause) annex);
            }
        }
    }
    return subclauses;
}
Also used : SafetyContractSubclause(edu.umn.cs.crisys.safety.safety.SafetyContractSubclause) ComponentImplementation(org.osate.aadl2.ComponentImplementation) ComponentClassifier(org.osate.aadl2.ComponentClassifier) SystemInstanceImpl(org.osate.aadl2.instance.impl.SystemInstanceImpl) EObject(org.eclipse.emf.ecore.EObject) ArrayList(java.util.ArrayList) AnnexSubclause(org.osate.aadl2.AnnexSubclause)

Aggregations

AnnexSubclause (org.osate.aadl2.AnnexSubclause)54 ArrayList (java.util.ArrayList)23 DefaultAnnexSubclause (org.osate.aadl2.DefaultAnnexSubclause)21 EObject (org.eclipse.emf.ecore.EObject)19 Classifier (org.osate.aadl2.Classifier)17 CyberReq (com.ge.research.osate.verdict.dsl.verdict.CyberReq)15 Statement (com.ge.research.osate.verdict.dsl.verdict.Statement)15 Verdict (com.ge.research.osate.verdict.dsl.verdict.Verdict)15 AnnexLibrary (org.osate.aadl2.AnnexLibrary)15 SafetyReq (com.ge.research.osate.verdict.dsl.verdict.SafetyReq)14 NamedElement (org.osate.aadl2.NamedElement)14 CyberMission (com.ge.research.osate.verdict.dsl.verdict.CyberMission)13 CyberRel (com.ge.research.osate.verdict.dsl.verdict.CyberRel)13 Event (com.ge.research.osate.verdict.dsl.verdict.Event)13 SafetyRel (com.ge.research.osate.verdict.dsl.verdict.SafetyRel)13 ComponentImplementation (org.osate.aadl2.ComponentImplementation)13 EventDataPort (org.osate.aadl2.EventDataPort)13 EventPort (org.osate.aadl2.EventPort)13 ComponentType (org.osate.aadl2.ComponentType)12 DataPort (org.osate.aadl2.DataPort)12