use of org.osate.aadl2.PropertyExpression in project AGREE by loonwerks.
the class AgreeTypeSystem method getArraySize.
private static long getArraySize(ArrayDimension arrayDimension) {
ArraySize arraySize = arrayDimension.getSize();
long size = arraySize.getSize();
if (size == 0) {
ArraySizeProperty arraySizeProperty = arraySize.getSizeProperty();
if (arraySizeProperty instanceof PropertyConstant) {
PropertyExpression pe = ((PropertyConstant) arraySizeProperty).getConstantValue();
size = intFromPropExp(pe).orElse((long) -1);
}
}
assert size > 0;
return size;
}
use of org.osate.aadl2.PropertyExpression in project AGREE by loonwerks.
the class AgreeAADLPropertyUtils method getPropertyList.
public static List<PropertyExpression> getPropertyList(NamedElement namedEl, String property) {
List<PropertyExpression> els = new ArrayList<>();
Property prop = Aadl2GlobalScopeUtil.get(namedEl, Aadl2Package.eINSTANCE.getProperty(), property);
ListValue listExpr = (ListValue) PropertyUtils.getSimplePropertyListValue(namedEl, prop);
for (PropertyExpression propExpr : listExpr.getOwnedListElements()) {
els.add(propExpr);
}
return els;
}
use of org.osate.aadl2.PropertyExpression in project AGREE by loonwerks.
the class AgreeTypeSystem method hasBooleanDataRepresentation.
public static boolean hasBooleanDataRepresentation(Classifier classifier) {
boolean result = false;
EList<PropertyAssociation> propertyAssociations = classifier.getAllPropertyAssociations();
for (PropertyAssociation propertyAssociation : propertyAssociations) {
Property property = propertyAssociation.getProperty();
try {
PropertyExpression propertyExpr = classifier.getSimplePropertyValue(property);
if ("Data_Model::Data_Representation".equals(property.getQualifiedName()) && propertyExpr instanceof NamedValue) {
AbstractNamedValue abstractNamedValue = ((NamedValue) propertyExpr).getNamedValue();
if (abstractNamedValue instanceof EnumerationLiteral && "Boolean".equals(((EnumerationLiteral) abstractNamedValue).getName())) {
result = true;
}
}
} catch (Exception e) {
continue;
}
}
return result;
}
use of org.osate.aadl2.PropertyExpression in project osate2 by osate.
the class Arinc653 method getDal.
public static Optional<SupportedDalType> getDal(NamedElement lookupContext, Optional<Mode> mode) {
Property property = getDal_Property(lookupContext);
try {
PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
return Optional.of(SupportedDalType.valueOf(resolved));
} catch (PropertyNotPresentException e) {
return Optional.empty();
}
}
use of org.osate.aadl2.PropertyExpression in project osate2 by osate.
the class CodeGenerationProperties method getParameterUsage.
public static Optional<ParameterUsage> getParameterUsage(NamedElement lookupContext, Optional<Mode> mode) {
Property property = getParameterUsage_Property(lookupContext);
try {
PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
return Optional.of(ParameterUsage.valueOf(resolved));
} catch (PropertyNotPresentException e) {
return Optional.empty();
}
}
Aggregations