Search in sources :

Example 1 with SupportedConnectionPatterns

use of org.osate.aadl2.contrib.aadlproject.SupportedConnectionPatterns in project osate2 by osate.

the class CommunicationProperties method getConnectionPattern.

public static Optional<List<List<SupportedConnectionPatterns>>> getConnectionPattern(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getConnectionPattern_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 ((ListValue) resolved1).getOwnedListElements().stream().map(element2 -> {
                PropertyExpression resolved2 = CodeGenUtil.resolveNamedValue(element2, lookupContext, mode);
                return SupportedConnectionPatterns.valueOf(resolved2);
            }).collect(Collectors.toList());
        }).collect(Collectors.toList()));
    } catch (PropertyNotPresentException e) {
        return Optional.empty();
    }
}
Also used : ListValue(org.osate.aadl2.ListValue) IntegerWithUnits(org.osate.pluginsupport.properties.IntegerWithUnits) IntegerLiteral(org.osate.aadl2.IntegerLiteral) EObject(org.eclipse.emf.ecore.EObject) Collectors(java.util.stream.Collectors) SupportedConnectionPatterns(org.osate.aadl2.contrib.aadlproject.SupportedConnectionPatterns) Aadl2GlobalScopeUtil(org.osate.aadl2.modelsupport.scoping.Aadl2GlobalScopeUtil) Mode(org.osate.aadl2.Mode) OptionalLong(java.util.OptionalLong) PropertyExpression(org.osate.aadl2.PropertyExpression) SupportedQueueProcessingProtocols(org.osate.aadl2.contrib.aadlproject.SupportedQueueProcessingProtocols) CodeGenUtil(org.osate.pluginsupport.properties.CodeGenUtil) List(java.util.List) IntegerRangeWithUnits(org.osate.pluginsupport.properties.IntegerRangeWithUnits) Property(org.osate.aadl2.Property) TimeUnits(org.osate.aadl2.contrib.aadlproject.TimeUnits) BooleanLiteral(org.osate.aadl2.BooleanLiteral) Optional(java.util.Optional) DataRateUnits(org.osate.aadl2.contrib.aadlproject.DataRateUnits) NamedElement(org.osate.aadl2.NamedElement) Aadl2Package(org.osate.aadl2.Aadl2Package) PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) ListValue(org.osate.aadl2.ListValue) PropertyExpression(org.osate.aadl2.PropertyExpression) Property(org.osate.aadl2.Property)

Aggregations

List (java.util.List)1 Optional (java.util.Optional)1 OptionalLong (java.util.OptionalLong)1 Collectors (java.util.stream.Collectors)1 EObject (org.eclipse.emf.ecore.EObject)1 Aadl2Package (org.osate.aadl2.Aadl2Package)1 BooleanLiteral (org.osate.aadl2.BooleanLiteral)1 IntegerLiteral (org.osate.aadl2.IntegerLiteral)1 ListValue (org.osate.aadl2.ListValue)1 Mode (org.osate.aadl2.Mode)1 NamedElement (org.osate.aadl2.NamedElement)1 Property (org.osate.aadl2.Property)1 PropertyExpression (org.osate.aadl2.PropertyExpression)1 DataRateUnits (org.osate.aadl2.contrib.aadlproject.DataRateUnits)1 SupportedConnectionPatterns (org.osate.aadl2.contrib.aadlproject.SupportedConnectionPatterns)1 SupportedQueueProcessingProtocols (org.osate.aadl2.contrib.aadlproject.SupportedQueueProcessingProtocols)1 TimeUnits (org.osate.aadl2.contrib.aadlproject.TimeUnits)1 Aadl2GlobalScopeUtil (org.osate.aadl2.modelsupport.scoping.Aadl2GlobalScopeUtil)1 PropertyNotPresentException (org.osate.aadl2.properties.PropertyNotPresentException)1 CodeGenUtil (org.osate.pluginsupport.properties.CodeGenUtil)1