Search in sources :

Example 41 with InstanceObject

use of org.osate.aadl2.instance.InstanceObject in project osate2 by osate.

the class DeploymentProperties method getActualMemoryBinding.

public static Optional<List<InstanceObject>> getActualMemoryBinding(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getActualMemoryBinding_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 ((InstanceReferenceValue) resolved1).getReferencedInstanceObject();
        }).collect(Collectors.toList()));
    } catch (PropertyNotPresentException e) {
        return Optional.empty();
    }
}
Also used : PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) ListValue(org.osate.aadl2.ListValue) PropertyExpression(org.osate.aadl2.PropertyExpression) InstanceReferenceValue(org.osate.aadl2.instance.InstanceReferenceValue) Property(org.osate.aadl2.Property)

Example 42 with InstanceObject

use of org.osate.aadl2.instance.InstanceObject in project osate2 by osate.

the class DeploymentProperties method getActualSubprogramCall.

public static Optional<InstanceObject> getActualSubprogramCall(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getActualSubprogramCall_Property(lookupContext);
    try {
        PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
        PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
        return Optional.of(((InstanceReferenceValue) resolved).getReferencedInstanceObject());
    } 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 43 with InstanceObject

use of org.osate.aadl2.instance.InstanceObject in project osate2 by osate.

the class DeploymentProperties method getActualProcessorBinding.

public static Optional<List<InstanceObject>> getActualProcessorBinding(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getActualProcessorBinding_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 ((InstanceReferenceValue) resolved1).getReferencedInstanceObject();
        }).collect(Collectors.toList()));
    } catch (PropertyNotPresentException e) {
        return Optional.empty();
    }
}
Also used : PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) ListValue(org.osate.aadl2.ListValue) PropertyExpression(org.osate.aadl2.PropertyExpression) InstanceReferenceValue(org.osate.aadl2.instance.InstanceReferenceValue) Property(org.osate.aadl2.Property)

Example 44 with InstanceObject

use of org.osate.aadl2.instance.InstanceObject in project osate2 by osate.

the class DeploymentProperties method getAllowedSubprogramCall.

public static Optional<List<InstanceObject>> getAllowedSubprogramCall(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getAllowedSubprogramCall_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 ((InstanceReferenceValue) resolved1).getReferencedInstanceObject();
        }).collect(Collectors.toList()));
    } catch (PropertyNotPresentException e) {
        return Optional.empty();
    }
}
Also used : PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) ListValue(org.osate.aadl2.ListValue) PropertyExpression(org.osate.aadl2.PropertyExpression) InstanceReferenceValue(org.osate.aadl2.instance.InstanceReferenceValue) Property(org.osate.aadl2.Property)

Example 45 with InstanceObject

use of org.osate.aadl2.instance.InstanceObject in project osate2 by osate.

the class ThreadProperties method getDispatchTrigger.

public static Optional<List<InstanceObject>> getDispatchTrigger(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getDispatchTrigger_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 ((InstanceReferenceValue) resolved1).getReferencedInstanceObject();
        }).collect(Collectors.toList()));
    } catch (PropertyNotPresentException e) {
        return Optional.empty();
    }
}
Also used : PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) ListValue(org.osate.aadl2.ListValue) PropertyExpression(org.osate.aadl2.PropertyExpression) InstanceReferenceValue(org.osate.aadl2.instance.InstanceReferenceValue) Property(org.osate.aadl2.Property)

Aggregations

InstanceObject (org.osate.aadl2.instance.InstanceObject)77 PropertyExpression (org.osate.aadl2.PropertyExpression)38 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)36 Property (org.osate.aadl2.Property)35 PropertyNotPresentException (org.osate.aadl2.properties.PropertyNotPresentException)31 SystemInstance (org.osate.aadl2.instance.SystemInstance)27 InstanceReferenceValue (org.osate.aadl2.instance.InstanceReferenceValue)24 ArrayList (java.util.ArrayList)19 ListValue (org.osate.aadl2.ListValue)17 NamedElement (org.osate.aadl2.NamedElement)17 ConnectionInstance (org.osate.aadl2.instance.ConnectionInstance)15 Element (org.osate.aadl2.Element)14 Classifier (org.osate.aadl2.Classifier)13 FeatureInstance (org.osate.aadl2.instance.FeatureInstance)12 List (java.util.List)11 EObject (org.eclipse.emf.ecore.EObject)11 Resource (org.eclipse.emf.ecore.resource.Resource)10 ComponentClassifier (org.osate.aadl2.ComponentClassifier)10 SystemOperationMode (org.osate.aadl2.instance.SystemOperationMode)10 URI (org.eclipse.emf.common.util.URI)9