use of org.osate.aadl2.properties.PropertyNotPresentException 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.properties.PropertyNotPresentException 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.properties.PropertyNotPresentException 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();
}
}
use of org.osate.aadl2.properties.PropertyNotPresentException in project osate2 by osate.
the class Sei method getNsloc.
public static OptionalLong getNsloc(NamedElement lookupContext, Optional<Mode> mode) {
Property property = getNsloc_Property(lookupContext);
try {
PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
return OptionalLong.of(((IntegerLiteral) resolved).getValue());
} catch (PropertyNotPresentException e) {
return OptionalLong.empty();
}
}
use of org.osate.aadl2.properties.PropertyNotPresentException in project osate2 by osate.
the class Sei method getNetweight.
public static Optional<RealWithUnits<Weightunits>> getNetweight(NamedElement lookupContext, Optional<Mode> mode) {
Property property = getNetweight_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();
}
}
Aggregations