use of org.osate.aadl2.NamedElement in project osate2 by osate.
the class DataModel method getNumberRepresentation.
public static Optional<NumberRepresentation> getNumberRepresentation(NamedElement lookupContext, Optional<Mode> mode) {
Property property = getNumberRepresentation_Property(lookupContext);
try {
PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
return Optional.of(NumberRepresentation.valueOf(resolved));
} catch (PropertyNotPresentException e) {
return Optional.empty();
}
}
use of org.osate.aadl2.NamedElement in project osate2 by osate.
the class DataModel method getBaseType.
public static Optional<List<Classifier>> getBaseType(NamedElement lookupContext, Optional<Mode> mode) {
Property property = getBaseType_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 ((ClassifierValue) resolved1).getClassifier();
}).collect(Collectors.toList()));
} catch (PropertyNotPresentException e) {
return Optional.empty();
}
}
use of org.osate.aadl2.NamedElement in project osate2 by osate.
the class DataModel method getMydimension.
public static OptionalLong getMydimension(NamedElement lookupContext, Optional<Mode> mode) {
Property property = getMydimension_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.NamedElement in project osate2 by osate.
the class DataModel method getIntegerRange.
public static Optional<IntegerRange> getIntegerRange(NamedElement lookupContext, Optional<Mode> mode) {
Property property = getIntegerRange_Property(lookupContext);
try {
PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
return Optional.of(new IntegerRange(resolved, lookupContext, mode));
} catch (PropertyNotPresentException e) {
return Optional.empty();
}
}
use of org.osate.aadl2.NamedElement in project osate2 by osate.
the class DataModel method getElementNames.
public static Optional<List<String>> getElementNames(NamedElement lookupContext, Optional<Mode> mode) {
Property property = getElementNames_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 ((StringLiteral) resolved1).getValue();
}).collect(Collectors.toList()));
} catch (PropertyNotPresentException e) {
return Optional.empty();
}
}
Aggregations