Search in sources :

Example 11 with NamedElement

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

the class AssignStatementImpl method setId.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setId(NamedElement newId) {
    NamedElement oldId = id;
    id = newId;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, AgreePackage.ASSIGN_STATEMENT__ID, oldId, id));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) NamedElement(org.osate.aadl2.NamedElement)

Example 12 with NamedElement

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

the class AgreeAnnexContentAssist method getNestedDotIDCandidates.

private List<String> getNestedDotIDCandidates(SelectionExpr id) {
    NamedElement base = ((NamedElmExpr) id).getElm();
    NamedElement namedEl = null;
    if (base instanceof Arg) {
        Type type = ((Arg) base).getType();
        DoubleDotRef elID = ((DoubleDotRef) type);
        namedEl = elID.getElm();
    // =======
    // DoubleDotRef elID = ((RecordType) type).getRecord();
    // namedEl = elID.getElm();
    // >>>>>>> origin/develop
    } else if (base instanceof DataPort) {
        namedEl = ((DataPort) base).getDataFeatureClassifier();
    } else if (base instanceof EventDataPort) {
        namedEl = ((EventDataPort) base).getDataFeatureClassifier();
    } else if (base instanceof AadlPackage) {
        return getNestedDotIDCandidates((AadlPackage) base);
    } else {
        return new ArrayList<>();
    }
    return getNestedDotIDCandidates(namedEl);
}
Also used : DataPort(org.osate.aadl2.DataPort) EventDataPort(org.osate.aadl2.EventDataPort) Type(com.rockwellcollins.atc.agree.agree.Type) AadlPackage(org.osate.aadl2.AadlPackage) Arg(com.rockwellcollins.atc.agree.agree.Arg) DoubleDotRef(com.rockwellcollins.atc.agree.agree.DoubleDotRef) EventDataPort(org.osate.aadl2.EventDataPort) NamedElement(org.osate.aadl2.NamedElement) NamedElmExpr(com.rockwellcollins.atc.agree.agree.NamedElmExpr)

Example 13 with NamedElement

use of org.osate.aadl2.NamedElement 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 14 with NamedElement

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

the class AgreeValidator method getArgNames.

private List<NamedElement> getArgNames(DoubleDotRef recType) {
    NamedElement rec = recType.getElm();
    // =======
    // private List<NamedElement> getArgNames(DoubleDotRef recId) {
    // 
    // NamedElement rec = recId.getElm();
    // >>>>>>> origin/develop
    List<NamedElement> names = new ArrayList<>();
    if (rec instanceof RecordDef) {
        RecordDef recDef = (RecordDef) rec;
        for (Arg arg : recDef.getArgs()) {
            names.add(arg);
        }
    } else if (rec instanceof DataImplementation) {
        DataImplementation dataImpl = (DataImplementation) rec;
        for (Subcomponent sub : dataImpl.getAllSubcomponents()) {
            names.add(sub);
        }
    } else {
        error(recType, "Record type '" + rec.getName() + "' must be a feature group or a record type definition");
    }
    return names;
}
Also used : Arg(com.rockwellcollins.atc.agree.agree.Arg) Subcomponent(org.osate.aadl2.Subcomponent) DataSubcomponent(org.osate.aadl2.DataSubcomponent) ArrayList(java.util.ArrayList) DataImplementation(org.osate.aadl2.DataImplementation) NamedElement(org.osate.aadl2.NamedElement) RecordDef(com.rockwellcollins.atc.agree.agree.RecordDef)

Example 15 with NamedElement

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

the class AgreeValidator method checkConstStatement.

@Check(CheckType.FAST)
public void checkConstStatement(ConstStatement constStat) {
    TypeDef expected = AgreeTypeSystem.typeDefFromType(constStat.getType());
    TypeDef actual = AgreeTypeSystem.infer(constStat.getExpr());
    if (!AgreeTypeSystem.typesEqual(expected, actual)) {
        error(constStat, "The assumed type of constant statement '" + constStat.getName() + "' is '" + expected + "' but the actual type is '" + actual + "'");
    }
    // check for constant cycles
    Set<ConstStatement> constClosure = new HashSet<>();
    Set<ConstStatement> prevClosure;
    constClosure.add(constStat);
    // quick and dirty cycle check
    do {
        prevClosure = new HashSet<>(constClosure);
        for (ConstStatement constFrontElem : prevClosure) {
            List<SelectionExpr> nestIds = EcoreUtil2.getAllContentsOfType(constFrontElem, SelectionExpr.class);
            for (Expr nestId : nestIds) {
                while (nestId instanceof SelectionExpr) {
                    NamedElement base = ((SelectionExpr) nestId).getField();
                    if (base instanceof ConstStatement) {
                        ConstStatement closConst = (ConstStatement) base;
                        if (closConst.equals(constStat)) {
                            error(constStat, "The expression for constant statment '" + constStat.getName() + "' is part of a cyclic definition");
                            break;
                        }
                        constClosure.add(closConst);
                    }
                    nestId = ((SelectionExpr) nestId).getTarget();
                }
                NamedElement base = ((NamedElmExpr) nestId).getElm();
                if (base instanceof ConstStatement) {
                    ConstStatement closConst = (ConstStatement) base;
                    if (closConst.equals(constStat)) {
                        error(constStat, "The expression for constant statment '" + constStat.getName() + "' is part of a cyclic definition");
                        break;
                    }
                    constClosure.add(closConst);
                }
            }
        }
    } while (!prevClosure.equals(constClosure));
    for (Expr e : EcoreUtil2.getAllContentsOfType(constStat.getExpr(), Expr.class)) {
        if (!exprIsConstant(e)) {
            error(e, "Non-constant expression in constant declaration");
            return;
        }
    }
}
Also used : ConstStatement(com.rockwellcollins.atc.agree.agree.ConstStatement) AgreeTypeSystem.nameOfTypeDef(com.rockwellcollins.atc.agree.AgreeTypeSystem.nameOfTypeDef) ArrayTypeDef(com.rockwellcollins.atc.agree.AgreeTypeSystem.ArrayTypeDef) RecordTypeDef(com.rockwellcollins.atc.agree.AgreeTypeSystem.RecordTypeDef) TypeDef(com.rockwellcollins.atc.agree.AgreeTypeSystem.TypeDef) 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) SelectionExpr(com.rockwellcollins.atc.agree.agree.SelectionExpr) NamedElement(org.osate.aadl2.NamedElement) HashSet(java.util.HashSet) NamedElmExpr(com.rockwellcollins.atc.agree.agree.NamedElmExpr) Check(org.eclipse.xtext.validation.Check)

Aggregations

Property (org.osate.aadl2.Property)351 PropertyExpression (org.osate.aadl2.PropertyExpression)291 PropertyNotPresentException (org.osate.aadl2.properties.PropertyNotPresentException)236 NamedElement (org.osate.aadl2.NamedElement)229 BasicProperty (org.osate.aadl2.BasicProperty)90 ListValue (org.osate.aadl2.ListValue)63 EObject (org.eclipse.emf.ecore.EObject)50 UnitLiteral (org.osate.aadl2.UnitLiteral)48 Classifier (org.osate.aadl2.Classifier)46 ArrayList (java.util.ArrayList)45 TimeUnits (org.osate.aadl2.contrib.aadlproject.TimeUnits)41 PropertyAssociation (org.osate.aadl2.PropertyAssociation)38 ComponentClassifier (org.osate.aadl2.ComponentClassifier)37 Subcomponent (org.osate.aadl2.Subcomponent)35 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)32 BasicPropertyAssociation (org.osate.aadl2.BasicPropertyAssociation)32 ContainedNamedElement (org.osate.aadl2.ContainedNamedElement)31 ComponentImplementation (org.osate.aadl2.ComponentImplementation)30 ContainmentPathElement (org.osate.aadl2.ContainmentPathElement)28 Element (org.osate.aadl2.Element)28