Search in sources :

Example 86 with NamedElement

use of org.osate.aadl2.NamedElement in project osate2 by osate.

the class Sei method getPrice.

public static OptionalDouble getPrice(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getPrice_Property(lookupContext);
    try {
        PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
        PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
        return OptionalDouble.of(((RealLiteral) resolved).getValue());
    } catch (PropertyNotPresentException e) {
        return OptionalDouble.empty();
    }
}
Also used : PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) PropertyExpression(org.osate.aadl2.PropertyExpression) Property(org.osate.aadl2.Property)

Example 87 with NamedElement

use of org.osate.aadl2.NamedElement in project osate2 by osate.

the class Sei method getVdidInspect.

public static Optional<Boolean> getVdidInspect(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getVdidInspect_Property(lookupContext);
    try {
        PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
        PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
        return Optional.of(((BooleanLiteral) resolved).getValue());
    } 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 88 with NamedElement

use of org.osate.aadl2.NamedElement in project osate2 by osate.

the class Sei method getGrossweight.

public static Optional<RealWithUnits<Weightunits>> getGrossweight(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getGrossweight_Property(lookupContext);
    try {
        PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
        PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
        return Optional.of(new RealWithUnits<>(resolved, Weightunits.class));
    } 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 89 with NamedElement

use of org.osate.aadl2.NamedElement in project osate2 by osate.

the class Sei method getMessageRate.

public static Optional<RealWithUnits<MessageRate>> getMessageRate(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getMessageRate_Property(lookupContext);
    try {
        PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
        PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
        return Optional.of(new RealWithUnits<>(resolved, MessageRate.class));
    } 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 90 with NamedElement

use of org.osate.aadl2.NamedElement in project osate2 by osate.

the class Sei method getModelReferences.

public static Optional<List<ModelReference>> getModelReferences(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getModelReferences_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 ModelReference(resolved1, 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) 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