Search in sources :

Example 1 with ComponentClassifier

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

the class AgreePatternTranslator method translatePattern.

private Expr translatePattern(AgreeCauseEffectPattern pattern, AgreeNodeBuilder builder, boolean isProperty) {
    if (pattern instanceof AgreeTimesPattern) {
        return translatePattern((AgreeTimesPattern) pattern, builder);
    }
    EObject varReference = pattern.reference;
    while (!(varReference instanceof ComponentClassifier)) {
        varReference = varReference.eContainer();
    }
    IdExpr causeId = pattern.cause;
    IdExpr effectId = pattern.effect;
    if (pattern.causeType == TriggerType.CONDITION) {
        causeId = translateCauseCondtionPattern(pattern, causeId, builder);
    }
    if (isProperty) {
        return translatePatternProperty(pattern, builder, causeId, effectId);
    } else {
        return translatePatternConstraint(pattern, builder, causeId, effectId);
    }
}
Also used : ComponentClassifier(org.osate.aadl2.ComponentClassifier) IdExpr(jkind.lustre.IdExpr) EObject(org.eclipse.emf.ecore.EObject)

Example 2 with ComponentClassifier

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

the class AgreeValidator method getEnumValueDefLocation.

private String getEnumValueDefLocation(NamedID id) {
    EObject container = id.eContainer();
    EnumStatement enumStatement = (EnumStatement) container;
    String enumName = enumStatement.getName();
    while (!(container instanceof AadlPackage) && !(container instanceof ComponentClassifier)) {
        container = container.eContainer();
    }
    return ((NamedElement) container).getQualifiedName() + "::" + enumName;
}
Also used : ComponentClassifier(org.osate.aadl2.ComponentClassifier) AadlPackage(org.osate.aadl2.AadlPackage) EObject(org.eclipse.emf.ecore.EObject) EnumStatement(com.rockwellcollins.atc.agree.agree.EnumStatement) NamedElement(org.osate.aadl2.NamedElement)

Example 3 with ComponentClassifier

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

the class AgreeValidator method checkLatchedExpr.

@Check(CheckType.FAST)
public void checkLatchedExpr(LatchedExpr latched) {
    // get container
    EObject container = latched.eContainer();
    AgreeContract contract = null;
    while (!(container instanceof ComponentClassifier)) {
        if (container instanceof AgreeContract) {
            contract = (AgreeContract) container;
        }
        container = container.eContainer();
    }
    if (container instanceof ComponentImplementation) {
        boolean foundLatchedStatement = false;
        for (SpecStatement spec : contract.getSpecs()) {
            if (spec instanceof LatchedStatement) {
                foundLatchedStatement = true;
                break;
            }
        }
        if (!foundLatchedStatement) {
            error(latched, "Latched expressions can appear only in component implementations " + "that contain a latched synchrony statement");
        }
    } else {
        error(latched, "Latched expressions can appear only in component implementations");
    }
    Expr expr = latched.getExpr();
    Expr nestId = null;
    if (expr instanceof NamedElmExpr) {
        nestId = expr;
    } else if (expr instanceof EventExpr) {
        EventExpr eventExpr = (EventExpr) expr;
        nestId = eventExpr.getPort();
    }
    if (nestId != null) {
        NamedElement namedEl = null;
        if (nestId instanceof NamedElmExpr) {
            namedEl = ((NamedElmExpr) nestId).getElm();
        } else if (nestId instanceof SelectionExpr) {
            namedEl = ((SelectionExpr) nestId).getField();
        }
        if ((namedEl instanceof DataPort) && ((DataPort) namedEl).isIn()) {
            return;
        } else if ((namedEl instanceof EventDataPort) && ((EventDataPort) namedEl).isIn()) {
            return;
        } else {
            // check to see if it is an "agree_input"
            EObject namedElContainer = namedEl.eContainer();
            if (namedElContainer instanceof InputStatement) {
                return;
            }
        }
    }
    error(latched, "Latched expressions are valid only for input data ports or event expressions over input event data ports");
}
Also used : AgreeContract(com.rockwellcollins.atc.agree.agree.AgreeContract) ComponentImplementation(org.osate.aadl2.ComponentImplementation) ComponentClassifier(org.osate.aadl2.ComponentClassifier) EventExpr(com.rockwellcollins.atc.agree.agree.EventExpr) SpecStatement(com.rockwellcollins.atc.agree.agree.SpecStatement) NamedSpecStatement(com.rockwellcollins.atc.agree.agree.NamedSpecStatement) SelectionExpr(com.rockwellcollins.atc.agree.agree.SelectionExpr) DataPort(org.osate.aadl2.DataPort) EventDataPort(org.osate.aadl2.EventDataPort) EnumLitExpr(com.rockwellcollins.atc.agree.agree.EnumLitExpr) IndicesExpr(com.rockwellcollins.atc.agree.agree.IndicesExpr) TimeRiseExpr(com.rockwellcollins.atc.agree.agree.TimeRiseExpr) FlatmapExpr(com.rockwellcollins.atc.agree.agree.FlatmapExpr) TimeFallExpr(com.rockwellcollins.atc.agree.agree.TimeFallExpr) RealLitExpr(com.rockwellcollins.atc.agree.agree.RealLitExpr) GetPropertyExpr(com.rockwellcollins.atc.agree.agree.GetPropertyExpr) TimeOfExpr(com.rockwellcollins.atc.agree.agree.TimeOfExpr) PrevExpr(com.rockwellcollins.atc.agree.agree.PrevExpr) FoldRightExpr(com.rockwellcollins.atc.agree.agree.FoldRightExpr) TagExpr(com.rockwellcollins.atc.agree.agree.TagExpr) EventExpr(com.rockwellcollins.atc.agree.agree.EventExpr) LatchedExpr(com.rockwellcollins.atc.agree.agree.LatchedExpr) NamedElmExpr(com.rockwellcollins.atc.agree.agree.NamedElmExpr) SelectionExpr(com.rockwellcollins.atc.agree.agree.SelectionExpr) IfThenElseExpr(com.rockwellcollins.atc.agree.agree.IfThenElseExpr) ArraySubExpr(com.rockwellcollins.atc.agree.agree.ArraySubExpr) PreExpr(com.rockwellcollins.atc.agree.agree.PreExpr) RecordLitExpr(com.rockwellcollins.atc.agree.agree.RecordLitExpr) BinaryExpr(com.rockwellcollins.atc.agree.agree.BinaryExpr) UnaryExpr(com.rockwellcollins.atc.agree.agree.UnaryExpr) ExistsExpr(com.rockwellcollins.atc.agree.agree.ExistsExpr) FoldLeftExpr(com.rockwellcollins.atc.agree.agree.FoldLeftExpr) RecordUpdateExpr(com.rockwellcollins.atc.agree.agree.RecordUpdateExpr) ForallExpr(com.rockwellcollins.atc.agree.agree.ForallExpr) Expr(com.rockwellcollins.atc.agree.agree.Expr) ArrayUpdateExpr(com.rockwellcollins.atc.agree.agree.ArrayUpdateExpr) BoolLitExpr(com.rockwellcollins.atc.agree.agree.BoolLitExpr) NodeBodyExpr(com.rockwellcollins.atc.agree.agree.NodeBodyExpr) IntLitExpr(com.rockwellcollins.atc.agree.agree.IntLitExpr) CallExpr(com.rockwellcollins.atc.agree.agree.CallExpr) ArrayLiteralExpr(com.rockwellcollins.atc.agree.agree.ArrayLiteralExpr) EObject(org.eclipse.emf.ecore.EObject) LatchedStatement(com.rockwellcollins.atc.agree.agree.LatchedStatement) EventDataPort(org.osate.aadl2.EventDataPort) InputStatement(com.rockwellcollins.atc.agree.agree.InputStatement) NamedElement(org.osate.aadl2.NamedElement) NamedElmExpr(com.rockwellcollins.atc.agree.agree.NamedElmExpr) Check(org.eclipse.xtext.validation.Check)

Example 4 with ComponentClassifier

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

the class StakeholderGoalsImpl method setTarget.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setTarget(ComponentClassifier newTarget) {
    ComponentClassifier oldTarget = target;
    target = newTarget;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ReqSpecPackage.STAKEHOLDER_GOALS__TARGET, oldTarget, target));
}
Also used : ComponentClassifier(org.osate.aadl2.ComponentClassifier) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 5 with ComponentClassifier

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

the class SystemRequirementSetImpl method setTarget.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setTarget(ComponentClassifier newTarget) {
    ComponentClassifier oldTarget = target;
    target = newTarget;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ReqSpecPackage.SYSTEM_REQUIREMENT_SET__TARGET, oldTarget, target));
}
Also used : ComponentClassifier(org.osate.aadl2.ComponentClassifier) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Aggregations

ComponentClassifier (org.osate.aadl2.ComponentClassifier)76 Subcomponent (org.osate.aadl2.Subcomponent)26 Classifier (org.osate.aadl2.Classifier)22 EObject (org.eclipse.emf.ecore.EObject)19 NamedElement (org.osate.aadl2.NamedElement)19 ComponentImplementation (org.osate.aadl2.ComponentImplementation)16 ArrayList (java.util.ArrayList)15 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)14 AadlPackage (org.osate.aadl2.AadlPackage)13 FeatureGroupType (org.osate.aadl2.FeatureGroupType)12 List (java.util.List)11 ComponentPrototype (org.osate.aadl2.ComponentPrototype)11 Element (org.osate.aadl2.Element)11 ComponentType (org.osate.aadl2.ComponentType)10 Feature (org.osate.aadl2.Feature)9 Mode (org.osate.aadl2.Mode)8 BusinessObjectContext (org.osate.ge.BusinessObjectContext)8 Collectors (java.util.stream.Collectors)7 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)7 ComponentCategory (org.osate.aadl2.ComponentCategory)7