Search in sources :

Example 6 with PropertyType

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

the class PropertiesValidator method checkPropertyAssociation.

protected void checkPropertyAssociation(PropertyAssociation pa) {
    // type check value against type
    Property pdef = pa.getProperty();
    checkPropertySetElementReferenceForPackageProperties(pdef, pa);
    checkPropertySetElementReference(pdef, pa);
    if (Aadl2Util.isNull(pdef)) {
        return;
    }
    PropertyType pt = pdef.getPropertyType();
    if (Aadl2Util.isNull(pt)) {
        return;
    }
    EList<ModalPropertyValue> pvl = pa.getOwnedValues();
    for (ModalPropertyValue modalPropertyValue : pvl) {
        typeCheckPropertyValues(pt, modalPropertyValue.getOwnedValue(), modalPropertyValue.getOwnedValue(), pdef.getQualifiedName(), 0);
    }
    checkAssociationAppliesTo(pa);
    checkInBinding(pa);
    if (pa.getProperty() != null) {
        if ("Byte_Count".equalsIgnoreCase(pa.getProperty().getName())) {
            boolean offerQuickFix = true;
            for (ModalPropertyValue modalPropertyValue : pvl) {
                PropertyExpression pe = modalPropertyValue.getOwnedValue();
                if (!(pe instanceof NumberValue)) {
                    offerQuickFix = false;
                    break;
                }
            }
            if (offerQuickFix) {
                warning("Byte_Count is deprecated. Please use Memory_Size.", pa, null, BYTE_COUNT_DEPRECATED);
            } else {
                warning(pa, "Byte_Count is deprecated. Please use Memory_Size.");
            }
        } else // } else
        if ("Source_Code_Size".equalsIgnoreCase(pa.getProperty().getName())) {
            warning("Source_Code_Size is deprecated. Please use Code_Size.", pa, null, SOURCE_CODE_SIZE_DEPRECATED);
        } else if ("Source_Data_Size".equalsIgnoreCase(pa.getProperty().getName())) {
            warning("Source_Data_Size is deprecated. Please use Data_Size.", pa, null, SOURCE_DATA_SIZE_DEPRECATED);
        } else if ("Source_Heap_Size".equalsIgnoreCase(pa.getProperty().getName())) {
            warning("Source_Heap_Size is deprecated. Please use Heap_Size.", pa, null, SOURCE_HEAP_SIZE_DEPRECATED);
        } else if ("Source_Stack_Size".equalsIgnoreCase(pa.getProperty().getName())) {
            warning("Source_Stack_Size is deprecated. Please use Stack_Size.", pa, null, SOURCE_STACK_SIZE_DEPRECATED);
        } else if ("Data_Volume".equalsIgnoreCase(pa.getProperty().getName())) {
            warning("Data_Volume is deprecated. Please use Data_Rate.", pa, null, DATA_VOLUME_DEPRECATED);
        }
    }
    checkConstantProperty(pa);
}
Also used : ModalPropertyValue(org.osate.aadl2.ModalPropertyValue) NumberValue(org.osate.aadl2.NumberValue) PropertyExpression(org.osate.aadl2.PropertyExpression) PropertyType(org.osate.aadl2.PropertyType) ArraySizeProperty(org.osate.aadl2.ArraySizeProperty) Property(org.osate.aadl2.Property)

Example 7 with PropertyType

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

the class AadlStructureBridge method canBeLandmark.

@Override
public boolean canBeLandmark(final String handle) {
    // Must be a component classifier, feature, subcomponent, etc, or a property declaration in a property set.
    final Element aadlElement = (Element) getObjectForHandle(handle);
    final boolean isLandmark = aadlElement instanceof PropertySet || aadlElement instanceof AadlPackage || aadlElement instanceof PackageSection || aadlElement instanceof Classifier || aadlElement instanceof ClassifierFeature || aadlElement instanceof PropertyConstant || aadlElement instanceof PropertyType || aadlElement instanceof Property;
    return isLandmark;
}
Also used : AadlPackage(org.osate.aadl2.AadlPackage) PackageSection(org.osate.aadl2.PackageSection) Element(org.osate.aadl2.Element) PropertySet(org.osate.aadl2.PropertySet) Classifier(org.osate.aadl2.Classifier) PropertyType(org.osate.aadl2.PropertyType) Property(org.osate.aadl2.Property) ClassifierFeature(org.osate.aadl2.ClassifierFeature) PropertyConstant(org.osate.aadl2.PropertyConstant)

Example 8 with PropertyType

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

the class PropertiesLinkingService method findUnitLiteral.

public static UnitLiteral findUnitLiteral(Property property, String name) {
    PropertyType propertyType = property.getPropertyType();
    UnitsType unitsType = null;
    if (propertyType instanceof NumberType) {
        unitsType = ((NumberType) propertyType).getUnitsType();
    } else if (propertyType instanceof RangeType) {
        unitsType = ((RangeType) propertyType).getNumberType().getUnitsType();
    }
    if (unitsType != null) {
        return unitsType.findLiteral(name);
    }
    return null;
}
Also used : NumberType(org.osate.aadl2.NumberType) RangeType(org.osate.aadl2.RangeType) PropertyType(org.osate.aadl2.PropertyType) UnitsType(org.osate.aadl2.UnitsType)

Example 9 with PropertyType

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

the class PropertiesLinkingService method findPropertyType.

/**
 * find property type based on property name.
 * The name is qualified with the property set name, or if unqualified is assumed to be a predeclared property type
 * The context object can be any model object, typically the object that is the context of the reference such as a property definition
 * @param context Element an AADL model element
 * @param name property type name possibly qualified with the property set name
 * @return PropertyType the property type or null
 */
public PropertyType findPropertyType(EObject context, String name) {
    // look for property type in property set
    EReference reference = Aadl2Package.eINSTANCE.getBasicProperty_PropertyType();
    EObject e = findPropertySetElement(context, reference, name);
    if (e != null && e instanceof PropertyType) {
        return (PropertyType) e;
    }
    return null;
}
Also used : EObject(org.eclipse.emf.ecore.EObject) PropertyType(org.osate.aadl2.PropertyType) EReference(org.eclipse.emf.ecore.EReference)

Example 10 with PropertyType

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

the class PropertyConstantImpl method setReferencedPropertyType.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setReferencedPropertyType(PropertyType newReferencedPropertyType) {
    PropertyType oldReferencedPropertyType = referencedPropertyType;
    referencedPropertyType = newReferencedPropertyType;
    if (eNotificationRequired()) {
        eNotify(new ENotificationImpl(this, Notification.SET, Aadl2Package.PROPERTY_CONSTANT__REFERENCED_PROPERTY_TYPE, oldReferencedPropertyType, referencedPropertyType));
    }
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) PropertyType(org.osate.aadl2.PropertyType)

Aggregations

PropertyType (org.osate.aadl2.PropertyType)35 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)12 Property (org.osate.aadl2.Property)12 BasicProperty (org.osate.aadl2.BasicProperty)7 PropertyExpression (org.osate.aadl2.PropertyExpression)7 NamedElement (org.osate.aadl2.NamedElement)6 PropertyAssociation (org.osate.aadl2.PropertyAssociation)5 PropertyConstant (org.osate.aadl2.PropertyConstant)5 EObject (org.eclipse.emf.ecore.EObject)4 ArraySizeProperty (org.osate.aadl2.ArraySizeProperty)4 EnumerationLiteral (org.osate.aadl2.EnumerationLiteral)4 PropertySet (org.osate.aadl2.PropertySet)4 AadlPackage (org.osate.aadl2.AadlPackage)3 Element (org.osate.aadl2.Element)3 PackageSection (org.osate.aadl2.PackageSection)3 List (java.util.List)2 JAXBElement (javax.xml.bind.JAXBElement)2 QName (javax.xml.namespace.QName)2 EOperation (org.eclipse.emf.ecore.EOperation)2 EReference (org.eclipse.emf.ecore.EReference)2