Search in sources :

Example 21 with TimeUnits

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

the class DeploymentProperties method getAllowedPeriod.

public static Optional<List<IntegerRangeWithUnits<TimeUnits>>> getAllowedPeriod(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getAllowedPeriod_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 new IntegerRangeWithUnits<>(resolved1, TimeUnits.class, lookupContext, mode);
        }).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) IntegerRangeWithUnits(org.osate.pluginsupport.properties.IntegerRangeWithUnits) Property(org.osate.aadl2.Property)

Example 22 with TimeUnits

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

the class CommunicationProperties method getActualLatency.

public static Optional<IntegerRangeWithUnits<TimeUnits>> getActualLatency(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getActualLatency_Property(lookupContext);
    try {
        PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
        PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
        return Optional.of(new IntegerRangeWithUnits<>(resolved, TimeUnits.class, lookupContext, mode));
    } catch (PropertyNotPresentException e) {
        return Optional.empty();
    }
}
Also used : TimeUnits(org.osate.aadl2.contrib.aadlproject.TimeUnits) PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) PropertyExpression(org.osate.aadl2.PropertyExpression) Property(org.osate.aadl2.Property)

Example 23 with TimeUnits

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

the class CommunicationProperties method getLatency.

public static Optional<IntegerRangeWithUnits<TimeUnits>> getLatency(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getLatency_Property(lookupContext);
    try {
        PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
        PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
        return Optional.of(new IntegerRangeWithUnits<>(resolved, TimeUnits.class, lookupContext, mode));
    } catch (PropertyNotPresentException e) {
        return Optional.empty();
    }
}
Also used : TimeUnits(org.osate.aadl2.contrib.aadlproject.TimeUnits) PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) PropertyExpression(org.osate.aadl2.PropertyExpression) Property(org.osate.aadl2.Property)

Example 24 with TimeUnits

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

the class AadlProject method getMaxTime.

public static IntegerWithUnits<TimeUnits> getMaxTime(EObject lookupContext) {
    PropertyConstant constant = getMaxTime_PropertyConstant(lookupContext);
    PropertyExpression resolved = CodeGenUtil.resolveNamedValue(constant.getConstantValue());
    return new IntegerWithUnits<>(resolved, TimeUnits.class);
}
Also used : IntegerWithUnits(org.osate.pluginsupport.properties.IntegerWithUnits) PropertyExpression(org.osate.aadl2.PropertyExpression) PropertyConstant(org.osate.aadl2.PropertyConstant)

Example 25 with TimeUnits

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

the class TimingProperties method getDispatchJitter.

public static Optional<IntegerWithUnits<TimeUnits>> getDispatchJitter(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getDispatchJitter_Property(lookupContext);
    try {
        PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
        PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
        return Optional.of(new IntegerWithUnits<>(resolved, TimeUnits.class));
    } catch (PropertyNotPresentException e) {
        return Optional.empty();
    }
}
Also used : TimeUnits(org.osate.aadl2.contrib.aadlproject.TimeUnits) PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) PropertyExpression(org.osate.aadl2.PropertyExpression) Property(org.osate.aadl2.Property)

Aggregations

PropertyExpression (org.osate.aadl2.PropertyExpression)41 Property (org.osate.aadl2.Property)40 PropertyNotPresentException (org.osate.aadl2.properties.PropertyNotPresentException)40 TimeUnits (org.osate.aadl2.contrib.aadlproject.TimeUnits)39 IntegerRangeWithUnits (org.osate.pluginsupport.properties.IntegerRangeWithUnits)2 ComponentCategory (org.osate.aadl2.ComponentCategory)1 FeatureGroup (org.osate.aadl2.FeatureGroup)1 FlowEnd (org.osate.aadl2.FlowEnd)1 ListValue (org.osate.aadl2.ListValue)1 PropertyConstant (org.osate.aadl2.PropertyConstant)1 FeatureCategory (org.osate.aadl2.instance.FeatureCategory)1 FeatureInstance (org.osate.aadl2.instance.FeatureInstance)1 FlowSpecificationInstance (org.osate.aadl2.instance.FlowSpecificationInstance)1 IntegerWithUnits (org.osate.pluginsupport.properties.IntegerWithUnits)1