Search in sources :

Example 16 with InstanceReferenceValue

use of org.osate.aadl2.instance.InstanceReferenceValue 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 17 with InstanceReferenceValue

use of org.osate.aadl2.instance.InstanceReferenceValue 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 18 with InstanceReferenceValue

use of org.osate.aadl2.instance.InstanceReferenceValue 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 19 with InstanceReferenceValue

use of org.osate.aadl2.instance.InstanceReferenceValue 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 20 with InstanceReferenceValue

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

PropertyExpression (org.osate.aadl2.PropertyExpression)39 InstanceReferenceValue (org.osate.aadl2.instance.InstanceReferenceValue)37 Property (org.osate.aadl2.Property)34 PropertyNotPresentException (org.osate.aadl2.properties.PropertyNotPresentException)31 ListValue (org.osate.aadl2.ListValue)19 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)15 BasicProperty (org.osate.aadl2.BasicProperty)11 PropertyLookupException (org.osate.aadl2.properties.PropertyLookupException)11 ArrayList (java.util.ArrayList)8 RecordValue (org.osate.aadl2.RecordValue)6 InstanceObject (org.osate.aadl2.instance.InstanceObject)6 Classifier (org.osate.aadl2.Classifier)5 ClassifierValue (org.osate.aadl2.ClassifierValue)5 AbstractNamedValue (org.osate.aadl2.AbstractNamedValue)4 BasicPropertyAssociation (org.osate.aadl2.BasicPropertyAssociation)4 BooleanLiteral (org.osate.aadl2.BooleanLiteral)4 IntegerLiteral (org.osate.aadl2.IntegerLiteral)4 NamedValue (org.osate.aadl2.NamedValue)4 StringLiteral (org.osate.aadl2.StringLiteral)4 Iterator (java.util.Iterator)3