Search in sources :

Example 11 with PropertyExpression

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

the class DataModel method getNumberRepresentation.

public static Optional<NumberRepresentation> getNumberRepresentation(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getNumberRepresentation_Property(lookupContext);
    try {
        PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
        PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
        return Optional.of(NumberRepresentation.valueOf(resolved));
    } catch (PropertyNotPresentException e) {
        return Optional.empty();
    }
}
Also used : PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) PropertyExpression(org.osate.aadl2.PropertyExpression) Property(org.osate.aadl2.Property)

Example 12 with PropertyExpression

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

the class DataModel method getBaseType.

public static Optional<List<Classifier>> getBaseType(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getBaseType_Property(lookupContext);
    try {
        PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
        PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
        return Optional.of(((ListValue) resolved).getOwnedListElements().stream().map(element1 -> {
            PropertyExpression resolved1 = CodeGenUtil.resolveNamedValue(element1, lookupContext, mode);
            return ((ClassifierValue) resolved1).getClassifier();
        }).collect(Collectors.toList()));
    } catch (PropertyNotPresentException e) {
        return Optional.empty();
    }
}
Also used : ClassifierValue(org.osate.aadl2.ClassifierValue) PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) ListValue(org.osate.aadl2.ListValue) PropertyExpression(org.osate.aadl2.PropertyExpression) Property(org.osate.aadl2.Property)

Example 13 with PropertyExpression

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

the class DataModel method getMydimension.

public static OptionalLong getMydimension(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getMydimension_Property(lookupContext);
    try {
        PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
        PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
        return OptionalLong.of(((IntegerLiteral) resolved).getValue());
    } catch (PropertyNotPresentException e) {
        return OptionalLong.empty();
    }
}
Also used : PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) PropertyExpression(org.osate.aadl2.PropertyExpression) Property(org.osate.aadl2.Property)

Example 14 with PropertyExpression

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

the class DataModel method getIntegerRange.

public static Optional<IntegerRange> getIntegerRange(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getIntegerRange_Property(lookupContext);
    try {
        PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
        PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
        return Optional.of(new IntegerRange(resolved, lookupContext, mode));
    } catch (PropertyNotPresentException e) {
        return Optional.empty();
    }
}
Also used : IntegerRange(org.osate.pluginsupport.properties.IntegerRange) PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) PropertyExpression(org.osate.aadl2.PropertyExpression) Property(org.osate.aadl2.Property)

Example 15 with PropertyExpression

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

the class DataModel method getElementNames.

public static Optional<List<String>> getElementNames(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getElementNames_Property(lookupContext);
    try {
        PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
        PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
        return Optional.of(((ListValue) resolved).getOwnedListElements().stream().map(element1 -> {
            PropertyExpression resolved1 = CodeGenUtil.resolveNamedValue(element1, lookupContext, mode);
            return ((StringLiteral) resolved1).getValue();
        }).collect(Collectors.toList()));
    } catch (PropertyNotPresentException e) {
        return Optional.empty();
    }
}
Also used : StringLiteral(org.osate.aadl2.StringLiteral) PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) ListValue(org.osate.aadl2.ListValue) PropertyExpression(org.osate.aadl2.PropertyExpression) Property(org.osate.aadl2.Property)

Aggregations

PropertyExpression (org.osate.aadl2.PropertyExpression)405 Property (org.osate.aadl2.Property)300 PropertyNotPresentException (org.osate.aadl2.properties.PropertyNotPresentException)246 ListValue (org.osate.aadl2.ListValue)89 BasicProperty (org.osate.aadl2.BasicProperty)51 PropertyAssociation (org.osate.aadl2.PropertyAssociation)41 TimeUnits (org.osate.aadl2.contrib.aadlproject.TimeUnits)40 PropertyLookupException (org.osate.aadl2.properties.PropertyLookupException)36 BasicPropertyAssociation (org.osate.aadl2.BasicPropertyAssociation)34 IntegerLiteral (org.osate.aadl2.IntegerLiteral)33 InstanceReferenceValue (org.osate.aadl2.instance.InstanceReferenceValue)32 ModalPropertyValue (org.osate.aadl2.ModalPropertyValue)31 ArrayList (java.util.ArrayList)29 EnumerationLiteral (org.osate.aadl2.EnumerationLiteral)28 NamedElement (org.osate.aadl2.NamedElement)27 NamedValue (org.osate.aadl2.NamedValue)27 PropertyConstant (org.osate.aadl2.PropertyConstant)27 ClassifierValue (org.osate.aadl2.ClassifierValue)26 StringLiteral (org.osate.aadl2.StringLiteral)26 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)23