Search in sources :

Example 1 with NamedValue

use of org.osate.aadl2.NamedValue in project VERDICT by ge-high-assurance.

the class Agree2Vdm method updateVDMDatatypeUsingProperties.

/**
 *  @param vdm dataType,
 * 	@param list of property associations
 *  this method checks if the property indicates if it is an enum definition
 *  and gets information from the properties to define the enum in the VDM
 *  *
 */
public boolean updateVDMDatatypeUsingProperties(verdict.vdm.vdm_data.DataType dtype, EList<PropertyAssociation> properties) {
    if (properties.size() == 2) {
        // check if the property specifies it is enum type
        PropertyAssociation firstProperty = properties.get(0);
        EList<ModalPropertyValue> firstPropertyValues = firstProperty.getOwnedValues();
        if (firstPropertyValues.size() == 1) {
            PropertyExpression ownedval = firstPropertyValues.get(0).getOwnedValue();
            if (ownedval instanceof NamedValueImpl) {
                NamedValue namedVal = (NamedValue) ownedval;
                if (namedVal.getNamedValue() instanceof EnumerationLiteralImpl) {
                    EnumerationLiteral namedValEnumLit = (EnumerationLiteral) namedVal.getNamedValue();
                    if (namedValEnumLit.getName().equalsIgnoreCase("Enum")) {
                        EnumType vdmEnumType = new EnumType();
                        // Fetch the enum values which are defined as the next property
                        PropertyAssociation secondProperty = properties.get(1);
                        EList<ModalPropertyValue> secondPropertyValues = secondProperty.getOwnedValues();
                        if (firstPropertyValues.size() == 1) {
                            PropertyExpression secPropValue = secondPropertyValues.get(0).getOwnedValue();
                            // enum should have multiple values so check if a list of values are defined
                            if (secPropValue instanceof ListValueImpl) {
                                ListValueImpl listValueImpl = (ListValueImpl) secPropValue;
                                EList<PropertyExpression> listOfValues = listValueImpl.getOwnedListElements();
                                for (PropertyExpression enumvalue : listOfValues) {
                                    if (enumvalue instanceof StringLiteralImpl) {
                                        StringLiteralImpl stringEnumVal = (StringLiteralImpl) enumvalue;
                                        vdmEnumType.getEnumValue().add(stringEnumVal.getValue());
                                    } else {
                                        System.out.println("Unexpected non-string value for data type of type enum.");
                                    }
                                }
                                dtype.setEnumType(vdmEnumType);
                                return true;
                            } else {
                                System.out.println("The second property of the data definition is not of ListValueImp type");
                            }
                        } else {
                            System.out.println("Unresolved data property. The first property of the data definition has no values or multiple values.");
                        }
                    } else {
                        System.out.println("Unresolved data property value. Property's owned value's named value does not contain Enum");
                    }
                } else {
                    System.out.println("Unresolved data property value. Property's owned value's named value is not EnumerationLiteralImpl type.");
                }
            } else {
                System.out.println("Unresolved data property value. Property's owned value is not NamedValueImpl type.");
            }
        } else {
            System.out.println("Unresolved data property with no values or multiple values.");
        }
    } else {
        System.out.println("Unresolved data property. Data definition has 0 or more than 2 properties associated with it");
    }
    return false;
}
Also used : ModalPropertyValue(org.osate.aadl2.ModalPropertyValue) StringLiteralImpl(org.osate.aadl2.impl.StringLiteralImpl) PropertyAssociation(org.osate.aadl2.PropertyAssociation) EnumType(verdict.vdm.vdm_data.EnumType) NamedValueImpl(org.osate.aadl2.impl.NamedValueImpl) PropertyExpression(org.osate.aadl2.PropertyExpression) NamedValue(org.osate.aadl2.NamedValue) ListValueImpl(org.osate.aadl2.impl.ListValueImpl) EnumerationLiteral(org.osate.aadl2.EnumerationLiteral) EnumerationLiteralImpl(org.osate.aadl2.impl.EnumerationLiteralImpl)

Example 2 with NamedValue

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

the class AgreeASTBuilder method caseGetPropertyExpr.

@Override
public Expr caseGetPropertyExpr(GetPropertyExpr expr) {
    NamedElement propName = expr.getProp();
    PropertyExpression propVal;
    if (propName instanceof Property) {
        ComponentRef cr = expr.getComponentRef();
        NamedElement compName = null;
        if (cr instanceof DoubleDotRef) {
            compName = ((DoubleDotRef) cr).getElm();
        } else if (cr instanceof ThisRef) {
            compName = curInst;
        }
        Property prop = (Property) propName;
        propVal = AgreeUtils.getPropExpression(compName, prop);
        if (propVal == null) {
            if (Activator.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.PREF_UNSPECIFIED_AADL_PROPERTIES)) {
                String propInputName = unspecifiedAadlPropertyPrefix + compName.getName() + dotChar + prop.getName();
                unspecifiedAadlProperties.put(propInputName, expr);
                return new IdExpr(propInputName);
            } else {
                throw new AgreeException("Could not locate property value '" + prop.getQualifiedName() + "' in component '" + compName.getName() + "'.  Is it possible " + "that a 'this' statement is used in a context in which it wasn't supposed to?" + "  Analysis of unspecified AADL properties as inputs may be enabled in the AGREE preferences.");
            }
        }
    } else {
        propVal = AgreeUtils.getPropExpression((PropertyConstant) propName);
        if (propVal == null) {
            throw new AgreeException("Could not locate property value '" + propName.getQualifiedName());
        }
    }
    Expr res = null;
    if (propVal != null) {
        if (propVal instanceof StringLiteral) {
            // nodeStr += value.getValue() + ")";
            throw new AgreeException("Property value for '" + propName.getQualifiedName() + "' cannot be of string type");
        } else if (propVal instanceof NamedValue) {
            // EnumerationLiteral enVal = (EnumerationLiteral) absVal;
            throw new AgreeException("Property value for '" + propName.getQualifiedName() + "' cannot be of enumeration type");
        } else if (propVal instanceof BooleanLiteral) {
            BooleanLiteral value = (BooleanLiteral) propVal;
            res = new BoolExpr(value.getValue());
        } else if (propVal instanceof IntegerLiteral) {
            IntegerLiteral value = (IntegerLiteral) propVal;
            res = new IntExpr(BigInteger.valueOf((long) value.getScaledValue()));
        } else {
            assert (propVal instanceof RealLiteral);
            RealLiteral value = (RealLiteral) propVal;
            res = new RealExpr(BigDecimal.valueOf(value.getValue()));
        }
    }
    assert (res != null);
    return res;
}
Also used : BoolExpr(jkind.lustre.BoolExpr) IdExpr(jkind.lustre.IdExpr) BooleanLiteral(org.osate.aadl2.BooleanLiteral) NamedValue(org.osate.aadl2.NamedValue) PropertyConstant(org.osate.aadl2.PropertyConstant) RealLiteral(org.osate.aadl2.RealLiteral) EnumLitExpr(com.rockwellcollins.atc.agree.agree.EnumLitExpr) IndicesExpr(com.rockwellcollins.atc.agree.agree.IndicesExpr) TimeRiseExpr(com.rockwellcollins.atc.agree.agree.TimeRiseExpr) RecordAccessExpr(jkind.lustre.RecordAccessExpr) 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) Expr(jkind.lustre.Expr) CastExpr(jkind.lustre.CastExpr) NodeCallExpr(jkind.lustre.NodeCallExpr) TimeOfExpr(com.rockwellcollins.atc.agree.agree.TimeOfExpr) BoolExpr(jkind.lustre.BoolExpr) BinaryExpr(jkind.lustre.BinaryExpr) RealExpr(jkind.lustre.RealExpr) ArrayExpr(jkind.lustre.ArrayExpr) PrevExpr(com.rockwellcollins.atc.agree.agree.PrevExpr) IdExpr(jkind.lustre.IdExpr) TimeExpr(com.rockwellcollins.atc.agree.agree.TimeExpr) 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) FunctionCallExpr(jkind.lustre.FunctionCallExpr) SelectionExpr(com.rockwellcollins.atc.agree.agree.SelectionExpr) IfThenElseExpr(jkind.lustre.IfThenElseExpr) TupleExpr(jkind.lustre.TupleExpr) UnaryExpr(jkind.lustre.UnaryExpr) ArraySubExpr(com.rockwellcollins.atc.agree.agree.ArraySubExpr) IntExpr(jkind.lustre.IntExpr) PreExpr(com.rockwellcollins.atc.agree.agree.PreExpr) RecordLitExpr(com.rockwellcollins.atc.agree.agree.RecordLitExpr) 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) ArrayAccessExpr(jkind.lustre.ArrayAccessExpr) 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) StringLiteral(org.osate.aadl2.StringLiteral) ThisRef(com.rockwellcollins.atc.agree.agree.ThisRef) DoubleDotRef(com.rockwellcollins.atc.agree.agree.DoubleDotRef) PropertyExpression(org.osate.aadl2.PropertyExpression) AgreeException(com.rockwellcollins.atc.agree.analysis.AgreeException) IntExpr(jkind.lustre.IntExpr) ComponentRef(com.rockwellcollins.atc.agree.agree.ComponentRef) NamedElement(org.osate.aadl2.NamedElement) Property(org.osate.aadl2.Property) RealExpr(jkind.lustre.RealExpr) IntegerLiteral(org.osate.aadl2.IntegerLiteral)

Example 3 with NamedValue

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

the class AgreeTypeSystem method hasBooleanDataRepresentation.

public static boolean hasBooleanDataRepresentation(Classifier classifier) {
    boolean result = false;
    EList<PropertyAssociation> propertyAssociations = classifier.getAllPropertyAssociations();
    for (PropertyAssociation propertyAssociation : propertyAssociations) {
        Property property = propertyAssociation.getProperty();
        try {
            PropertyExpression propertyExpr = classifier.getSimplePropertyValue(property);
            if ("Data_Model::Data_Representation".equals(property.getQualifiedName()) && propertyExpr instanceof NamedValue) {
                AbstractNamedValue abstractNamedValue = ((NamedValue) propertyExpr).getNamedValue();
                if (abstractNamedValue instanceof EnumerationLiteral && "Boolean".equals(((EnumerationLiteral) abstractNamedValue).getName())) {
                    result = true;
                }
            }
        } catch (Exception e) {
            continue;
        }
    }
    return result;
}
Also used : PropertyAssociation(org.osate.aadl2.PropertyAssociation) AbstractNamedValue(org.osate.aadl2.AbstractNamedValue) PropertyExpression(org.osate.aadl2.PropertyExpression) AbstractNamedValue(org.osate.aadl2.AbstractNamedValue) NamedValue(org.osate.aadl2.NamedValue) ArraySizeProperty(org.osate.aadl2.ArraySizeProperty) Property(org.osate.aadl2.Property) EnumerationLiteral(org.osate.aadl2.EnumerationLiteral)

Example 4 with NamedValue

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

the class DeclarativePackageImpl 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
    AadlBaPackage theAadlBaPackage = (AadlBaPackage) EPackage.Registry.INSTANCE.getEPackage(AadlBaPackage.eNS_URI);
    Aadl2Package theAadl2Package = (Aadl2Package) EPackage.Registry.INSTANCE.getEPackage(Aadl2Package.eNS_URI);
    // Create type parameters
    // Set bounds for type parameters
    // Add supertypes to classes
    arrayableIdentifierEClass.getESuperTypes().add(this.getIdentifier());
    commActionEClass.getESuperTypes().add(theAadlBaPackage.getCommunicationAction());
    commActionEClass.getESuperTypes().add(this.getDeclarativeBehaviorElement());
    declarativeArrayDimensionEClass.getESuperTypes().add(theAadl2Package.getArrayDimension());
    declarativeArrayDimensionEClass.getESuperTypes().add(this.getDeclarativeBehaviorElement());
    declarativeBehaviorElementEClass.getESuperTypes().add(theAadlBaPackage.getBehaviorElement());
    declarativeBehaviorTransitionEClass.getESuperTypes().add(theAadlBaPackage.getBehaviorTransition());
    declarativeBehaviorTransitionEClass.getESuperTypes().add(this.getDeclarativeBehaviorElement());
    declarativePropertyNameEClass.getESuperTypes().add(this.getDeclarativeBehaviorElement());
    declarativePropertyReferenceEClass.getESuperTypes().add(this.getDeclarativeBehaviorElement());
    declarativePropertyReferenceEClass.getESuperTypes().add(theAadlBaPackage.getIntegerValueConstant());
    declarativePropertyReferenceEClass.getESuperTypes().add(theAadlBaPackage.getValueConstant());
    declarativeTimeEClass.getESuperTypes().add(theAadlBaPackage.getBehaviorTime());
    declarativeTimeEClass.getESuperTypes().add(theAadlBaPackage.getCompletionRelativeTimeout());
    declarativeTimeEClass.getESuperTypes().add(this.getDeclarativeBehaviorElement());
    identifierEClass.getESuperTypes().add(theAadlBaPackage.getBehaviorState());
    identifierEClass.getESuperTypes().add(this.getDeclarativeBehaviorElement());
    namedValueEClass.getESuperTypes().add(theAadlBaPackage.getIntegerValueVariable());
    namedValueEClass.getESuperTypes().add(theAadlBaPackage.getValueVariable());
    namedValueEClass.getESuperTypes().add(this.getDeclarativeBehaviorElement());
    qualifiedNamedElementEClass.getESuperTypes().add(theAadl2Package.getDataClassifier());
    qualifiedNamedElementEClass.getESuperTypes().add(theAadl2Package.getClassifier());
    qualifiedNamedElementEClass.getESuperTypes().add(this.getDeclarativeBehaviorElement());
    qualifiedNamedElementEClass.getESuperTypes().add(theAadlBaPackage.getValueConstant());
    qualifiedNamedElementEClass.getESuperTypes().add(theAadlBaPackage.getIntegerValueConstant());
    qualifiedNamedElementEClass.getESuperTypes().add(theAadl2Package.getProcessorClassifier());
    qualifiedNamedElementEClass.getESuperTypes().add(theAadl2Package.getProperty());
    qualifiedNamedElementEClass.getESuperTypes().add(theAadl2Package.getUnitLiteral());
    referenceEClass.getESuperTypes().add(theAadlBaPackage.getActualPortHolder());
    referenceEClass.getESuperTypes().add(this.getDeclarativeBehaviorElement());
    referenceEClass.getESuperTypes().add(theAadlBaPackage.getIntegerValueVariable());
    referenceEClass.getESuperTypes().add(theAadlBaPackage.getValueVariable());
    referenceEClass.getESuperTypes().add(theAadlBaPackage.getElementValues());
    referenceEClass.getESuperTypes().add(theAadlBaPackage.getTarget());
    referenceEClass.getESuperTypes().add(theAadlBaPackage.getDispatchTriggerCondition());
    referenceEClass.getESuperTypes().add(theAadlBaPackage.getDispatchTrigger());
    referenceEClass.getESuperTypes().add(theAadlBaPackage.getModeSwitchTrigger());
    referenceEClass.getESuperTypes().add(theAadl2Package.getContainmentPathElement());
    declarativePropertyAssociationEClass.getESuperTypes().add(this.getDeclarativeBehaviorElement());
    declarativeListValueEClass.getESuperTypes().add(theAadl2Package.getListValue());
    declarativeListValueEClass.getESuperTypes().add(this.getDeclarativePropertyExpression());
    declarativePropertyExpressionEClass.getESuperTypes().add(theAadl2Package.getPropertyExpression());
    declarativeStringLiteralEClass.getESuperTypes().add(theAadlBaPackage.getBehaviorStringLiteral());
    declarativeStringLiteralEClass.getESuperTypes().add(this.getDeclarativePropertyExpression());
    declarativeIntegerLiteralEClass.getESuperTypes().add(theAadlBaPackage.getBehaviorIntegerLiteral());
    declarativeIntegerLiteralEClass.getESuperTypes().add(this.getDeclarativePropertyExpression());
    declarativeRealLiteralEClass.getESuperTypes().add(theAadlBaPackage.getBehaviorRealLiteral());
    declarativeRealLiteralEClass.getESuperTypes().add(this.getDeclarativePropertyExpression());
    declarativeRecordValueEClass.getESuperTypes().add(theAadl2Package.getRecordValue());
    declarativeRecordValueEClass.getESuperTypes().add(this.getDeclarativePropertyExpression());
    declarativeBasicPropertyAssociationEClass.getESuperTypes().add(theAadl2Package.getBasicPropertyAssociation());
    declarativeBooleanLiteralEClass.getESuperTypes().add(theAadlBaPackage.getBehaviorBooleanLiteral());
    declarativeBooleanLiteralEClass.getESuperTypes().add(this.getDeclarativePropertyExpression());
    declarativeRangeValueEClass.getESuperTypes().add(theAadl2Package.getRangeValue());
    declarativeRangeValueEClass.getESuperTypes().add(this.getDeclarativePropertyExpression());
    declarativeReferenceValueEClass.getESuperTypes().add(this.getDeclarativePropertyExpression());
    declarativeClassifierValueEClass.getESuperTypes().add(this.getDeclarativePropertyExpression());
    // Initialize classes and features; add operations and parameters
    initEClass(arrayableIdentifierEClass, ArrayableIdentifier.class, "ArrayableIdentifier", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getArrayableIdentifier_ArrayIndexes(), theAadlBaPackage.getIntegerValue(), null, "arrayIndexes", null, 0, -1, ArrayableIdentifier.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(commActionEClass, CommAction.class, "CommAction", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getCommAction_Parameters(), theAadlBaPackage.getParameterLabel(), null, "parameters", null, 0, -1, CommAction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getCommAction_PortFreeze(), theAadlBaPackage.getBoolean(), "portFreeze", "false", 0, 1, CommAction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getCommAction_PortDequeue(), theAadlBaPackage.getBoolean(), "portDequeue", "false", 0, 1, CommAction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getCommAction_Lock(), theAadlBaPackage.getBoolean(), "lock", "false", 0, 1, CommAction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getCommAction_Unlock(), theAadlBaPackage.getBoolean(), "unlock", "false", 0, 1, CommAction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getCommAction_Target(), theAadlBaPackage.getTarget(), null, "target", null, 0, 1, CommAction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getCommAction_QualifiedName(), this.getQualifiedNamedElement(), null, "qualifiedName", null, 0, 1, CommAction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getCommAction_Reference(), this.getReference(), null, "reference", null, 0, 1, CommAction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(declarativeArrayDimensionEClass, DeclarativeArrayDimension.class, "DeclarativeArrayDimension", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getDeclarativeArrayDimension_Dimension(), theAadlBaPackage.getIntegerValueConstant(), null, "dimension", null, 1, 1, DeclarativeArrayDimension.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(declarativeBehaviorElementEClass, DeclarativeBehaviorElement.class, "DeclarativeBehaviorElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getDeclarativeBehaviorElement_OsateRef(), theAadl2Package.getElement(), null, "osateRef", null, 0, 1, DeclarativeBehaviorElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getDeclarativeBehaviorElement_BaRef(), theAadlBaPackage.getBehaviorElement(), null, "baRef", null, 0, 1, DeclarativeBehaviorElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(declarativeBehaviorTransitionEClass, DeclarativeBehaviorTransition.class, "DeclarativeBehaviorTransition", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getDeclarativeBehaviorTransition_SrcStates(), this.getIdentifier(), null, "srcStates", null, 1, -1, DeclarativeBehaviorTransition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getDeclarativeBehaviorTransition_DestState(), this.getIdentifier(), null, "destState", null, 1, 1, DeclarativeBehaviorTransition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(declarativePropertyNameEClass, DeclarativePropertyName.class, "DeclarativePropertyName", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getDeclarativePropertyName_PropertyName(), this.getIdentifier(), null, "propertyName", null, 1, 1, DeclarativePropertyName.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getDeclarativePropertyName_Field(), theAadlBaPackage.getPropertyNameField(), null, "field", null, 0, 1, DeclarativePropertyName.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getDeclarativePropertyName_Indexes(), theAadlBaPackage.getIntegerValue(), null, "indexes", null, 0, -1, DeclarativePropertyName.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(declarativePropertyReferenceEClass, DeclarativePropertyReference.class, "DeclarativePropertyReference", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getDeclarativePropertyReference_QualifiedName(), this.getQualifiedNamedElement(), null, "qualifiedName", null, 0, 1, DeclarativePropertyReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getDeclarativePropertyReference_Reference(), this.getReference(), null, "reference", null, 0, 1, DeclarativePropertyReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getDeclarativePropertyReference_PropertyNames(), this.getDeclarativePropertyName(), null, "propertyNames", null, 1, -1, DeclarativePropertyReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getDeclarativePropertyReference_PropertySet(), theAadlBaPackage.getBoolean(), "propertySet", "false", 0, 1, DeclarativePropertyReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(declarativeTimeEClass, DeclarativeTime.class, "DeclarativeTime", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getDeclarativeTime_UnitId(), this.getIdentifier(), null, "unitId", null, 1, 1, DeclarativeTime.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(identifierEClass, Identifier.class, "Identifier", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getIdentifier_Id(), theAadlBaPackage.getString(), "id", null, 1, 1, Identifier.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(namedValueEClass, NamedValue.class, "NamedValue", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getNamedValue_Reference(), this.getReference(), null, "reference", null, 1, 1, NamedValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getNamedValue_Dequeue(), theAadlBaPackage.getBoolean(), "dequeue", "false", 0, 1, NamedValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getNamedValue_Fresh(), theAadlBaPackage.getBoolean(), "fresh", "false", 0, 1, NamedValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getNamedValue_Count(), theAadlBaPackage.getBoolean(), "count", "false", 0, 1, NamedValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(qualifiedNamedElementEClass, QualifiedNamedElement.class, "QualifiedNamedElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getQualifiedNamedElement_BaNamespace(), this.getIdentifier(), null, "baNamespace", null, 0, 1, QualifiedNamedElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getQualifiedNamedElement_BaName(), this.getIdentifier(), null, "baName", null, 1, 1, QualifiedNamedElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(referenceEClass, Reference.class, "Reference", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getReference_Ids(), this.getArrayableIdentifier(), null, "ids", null, 1, -1, Reference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(declarativePropertyAssociationEClass, DeclarativePropertyAssociation.class, "DeclarativePropertyAssociation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getDeclarativePropertyAssociation_Property(), this.getQualifiedNamedElement(), null, "property", null, 1, 1, DeclarativePropertyAssociation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getDeclarativePropertyAssociation_OwnedValue(), this.getDeclarativePropertyExpression(), null, "ownedValue", null, 1, 1, DeclarativePropertyAssociation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(declarativeListValueEClass, DeclarativeListValue.class, "DeclarativeListValue", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(declarativePropertyExpressionEClass, DeclarativePropertyExpression.class, "DeclarativePropertyExpression", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(declarativeStringLiteralEClass, DeclarativeStringLiteral.class, "DeclarativeStringLiteral", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(declarativeIntegerLiteralEClass, DeclarativeIntegerLiteral.class, "DeclarativeIntegerLiteral", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(declarativeRealLiteralEClass, DeclarativeRealLiteral.class, "DeclarativeRealLiteral", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(declarativeRecordValueEClass, DeclarativeRecordValue.class, "DeclarativeRecordValue", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(declarativeBasicPropertyAssociationEClass, DeclarativeBasicPropertyAssociation.class, "DeclarativeBasicPropertyAssociation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getDeclarativeBasicPropertyAssociation_BasicPropertyName(), theAadl2Package.getString(), "basicPropertyName", null, 1, 1, DeclarativeBasicPropertyAssociation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(declarativeBooleanLiteralEClass, DeclarativeBooleanLiteral.class, "DeclarativeBooleanLiteral", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(declarativeRangeValueEClass, DeclarativeRangeValue.class, "DeclarativeRangeValue", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEClass(declarativeReferenceValueEClass, DeclarativeReferenceValue.class, "DeclarativeReferenceValue", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getDeclarativeReferenceValue_Ref(), this.getReference(), null, "ref", null, 1, 1, DeclarativeReferenceValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(declarativeClassifierValueEClass, DeclarativeClassifierValue.class, "DeclarativeClassifierValue", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getDeclarativeClassifierValue_Classifier(), this.getQualifiedNamedElement(), null, "classifier", null, 1, 1, DeclarativeClassifierValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEClass(declarativeBehaviorAnnexEClass, DeclarativeBehaviorAnnex.class, "DeclarativeBehaviorAnnex", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getDeclarativeBehaviorAnnex_DeclarativeBehaviorElements(), this.getDeclarativeBehaviorElement(), null, "declarativeBehaviorElements", null, 0, -1, DeclarativeBehaviorAnnex.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    // Create resource
    createResource(eNS_URI);
}
Also used : AadlBaPackage(org.osate.ba.aadlba.AadlBaPackage) Aadl2Package(org.osate.aadl2.Aadl2Package)

Example 5 with NamedValue

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

the class AadlBaUtils method getDataRepresentation.

/**
 * Returns the last data representation from the property stack of the given data
 * classifier or DataRepresentation.UNKNOWN if Data_Model::Data_Representation
 * property is not set or if the data classifier represents a data structure.
 *
 * @param c the given data classifier
 * @return the data representation or DataRepresentation.UNKNOWN
 */
public static DataRepresentation getDataRepresentation(DataClassifier c) {
    DataRepresentation result = null;
    if (c == null) {
        result = DataRepresentation.UNKNOWN;
    } else {
        EList<PropertyExpression> l = PropertyUtils.findPropertyExpression(c, DataModelProperties.DATA_REPRESENTATION);
        if (l.size() > 0) {
            // Fetches the last enumeration value from the inheritance stack of
            // properties.
            NamedValue nv = (NamedValue) l.get(l.size() - 1);
            String tmp = ((EnumerationLiteral) nv.getNamedValue()).getName();
            result = DataRepresentation.getByName(tmp);
            if (result == null) {
                result = DataRepresentation.UNKNOWN;
            }
        } else {
            result = DataRepresentation.UNKNOWN;
        }
    }
    return result;
}
Also used : DataRepresentation(org.osate.ba.aadlba.DataRepresentation) PropertyExpression(org.osate.aadl2.PropertyExpression) NamedValue(org.osate.aadl2.NamedValue) AadlString(org.osate.aadl2.AadlString) EnumerationLiteral(org.osate.aadl2.EnumerationLiteral)

Aggregations

NamedValue (org.osate.aadl2.NamedValue)40 EnumerationLiteral (org.osate.aadl2.EnumerationLiteral)26 Property (org.osate.aadl2.Property)24 PropertyExpression (org.osate.aadl2.PropertyExpression)21 AbstractNamedValue (org.osate.aadl2.AbstractNamedValue)19 PropertyAssociation (org.osate.aadl2.PropertyAssociation)18 BasicPropertyAssociation (org.osate.aadl2.BasicPropertyAssociation)15 ContainmentPathElement (org.osate.aadl2.ContainmentPathElement)15 ListValue (org.osate.aadl2.ListValue)14 StringLiteral (org.osate.aadl2.StringLiteral)14 BasicProperty (org.osate.aadl2.BasicProperty)13 ContainedNamedElement (org.osate.aadl2.ContainedNamedElement)13 IntegerLiteral (org.osate.aadl2.IntegerLiteral)12 ModalPropertyValue (org.osate.aadl2.ModalPropertyValue)11 NamedElement (org.osate.aadl2.NamedElement)11 RealLiteral (org.osate.aadl2.RealLiteral)11 BooleanLiteral (org.osate.aadl2.BooleanLiteral)10 ClassifierValue (org.osate.aadl2.ClassifierValue)10 RangeValue (org.osate.aadl2.RangeValue)10 RecordValue (org.osate.aadl2.RecordValue)10