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();
}
}
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();
}
}
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();
}
}
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();
}
}
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();
}
}
Aggregations