Search in sources :

Example 36 with NamedElement

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

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

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

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

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

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