Search in sources :

Example 21 with DirectionType

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

the class ErrorModelValidator method checkFlowDirection.

private void checkFlowDirection(ErrorSource errorSource) {
    NamedElement ne = errorSource.getSourceModelElement();
    if (ne instanceof ErrorPropagation) {
        if (!Aadl2Util.isNull(ne) && ne instanceof ErrorPropagation) {
            ErrorPropagation ep = (ErrorPropagation) ne;
            DirectionType epd = ep.getDirection();
            if (!(epd.equals(DirectionType.OUT))) {
                error(errorSource, EMV2Util.getPrintName(ep) + " of error source is not an outgoing propagation point.");
            }
        }
    }
}
Also used : DirectionType(org.osate.aadl2.DirectionType) ErrorPropagation(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation) ContainedNamedElement(org.osate.aadl2.ContainedNamedElement) NamedElement(org.osate.aadl2.NamedElement)

Example 22 with DirectionType

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

the class ErrorModelValidator method checkFlowDirection.

private void checkFlowDirection(ErrorPath errorPath) {
    ErrorPropagation ep = errorPath.getIncoming();
    if (!Aadl2Util.isNull(ep)) {
        DirectionType epd = ep.getDirection();
        if (!(epd.equals(DirectionType.IN))) {
            error(errorPath, "Source " + EMV2Util.getPrintName(ep) + " of error path is not an incoming propagation point.");
        }
    }
    ep = errorPath.getOutgoing();
    if (!Aadl2Util.isNull(ep)) {
        DirectionType epd = ep.getDirection();
        if (!(epd.equals(DirectionType.OUT))) {
            error(errorPath, "Target " + EMV2Util.getPrintName(ep) + " of error path is not an outgoing propagation point.");
        }
    }
}
Also used : DirectionType(org.osate.aadl2.DirectionType) ErrorPropagation(org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation)

Example 23 with DirectionType

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

the class ErrorModelValidator method checkDirectionType.

private void checkDirectionType(ErrorPropagation errorPropagation) {
    DirectionType pd = errorPropagation.getDirection();
    DirectionType portd = EMV2Util.getErrorPropagationFeatureDirection(errorPropagation);
    if (!(pd.getName().equalsIgnoreCase(portd.getName()) || portd == DirectionType.IN_OUT)) {
        error(errorPropagation, "Propagation '" + EMV2Util.getPropagationName(errorPropagation) + "' direction does not match feature direction.");
    }
}
Also used : DirectionType(org.osate.aadl2.DirectionType)

Example 24 with DirectionType

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

the class FlowSpecificationCreationUtil method isValidFlowEnd.

/**
 * Returns whether a specified feature diagram element may be used as a flow end for a flow specification.
 * feature, its direction must be IN OUT or match the specified direction
 */
public static boolean isValidFlowEnd(final Feature feature, final BusinessObjectContext featureBoc, final DirectionType requiredDirection, final QueryService queryService) {
    // Ensure that the feature is contained in a component type
    if (getPotentialOwnersByFeature(featureBoc, queryService).size() == 0) {
        return false;
    }
    // Check that the feature is of the appropriate type
    if (!(feature instanceof Port || feature instanceof Parameter || feature instanceof DataAccess || feature instanceof FeatureGroup || feature instanceof AbstractFeature)) {
        return false;
    }
    // If it is a direct feature, it must have the specified direction or be an in out feature. Take into account feature group, inverse, etc..
    if (feature instanceof DirectedFeature) {
        // Determine the actual direction of the feature. Since it could effected by things like inverse feature groups, etc
        final DirectedFeature df = (DirectedFeature) feature;
        DirectionType direction = df.getDirection();
        if (direction == DirectionType.IN || direction == DirectionType.OUT) {
            if (AadlFeatureUtil.isFeatureInverted(featureBoc)) {
                direction = (direction == DirectionType.IN) ? DirectionType.OUT : DirectionType.IN;
            }
        }
        if (direction != requiredDirection && direction != DirectionType.IN_OUT) {
            return false;
        }
    }
    return true;
}
Also used : DirectionType(org.osate.aadl2.DirectionType) FeatureGroup(org.osate.aadl2.FeatureGroup) Port(org.osate.aadl2.Port) Parameter(org.osate.aadl2.Parameter) AbstractFeature(org.osate.aadl2.AbstractFeature) DirectedFeature(org.osate.aadl2.DirectedFeature) DataAccess(org.osate.aadl2.DataAccess)

Aggregations

DirectionType (org.osate.aadl2.DirectionType)16 EStructuralFeature (org.eclipse.emf.ecore.EStructuralFeature)5 DirectedFeature (org.osate.aadl2.DirectedFeature)4 AccessRights (org.osate.aadl2.contrib.memory.AccessRights)4 ArrayList (java.util.ArrayList)2 EObject (org.eclipse.emf.ecore.EObject)2 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)2 ContainedNamedElement (org.osate.aadl2.ContainedNamedElement)2 FeatureGroup (org.osate.aadl2.FeatureGroup)2 FeaturePrototypeBinding (org.osate.aadl2.FeaturePrototypeBinding)2 FeaturePrototypeReference (org.osate.aadl2.FeaturePrototypeReference)2 NamedElement (org.osate.aadl2.NamedElement)2 PortSpecification (org.osate.aadl2.PortSpecification)2 ErrorPropagation (org.osate.xtext.aadl2.errormodel.errorModel.ErrorPropagation)2 CyberRel (com.ge.research.osate.verdict.dsl.verdict.CyberRel)1 CyberRelInputLogic (com.ge.research.osate.verdict.dsl.verdict.CyberRelInputLogic)1 CyberRelOutputLogic (com.ge.research.osate.verdict.dsl.verdict.CyberRelOutputLogic)1 CyberReq (com.ge.research.osate.verdict.dsl.verdict.CyberReq)1 CyberReqConditionLogic (com.ge.research.osate.verdict.dsl.verdict.CyberReqConditionLogic)1 Event (com.ge.research.osate.verdict.dsl.verdict.Event)1