use of org.osate.aadl2.ComponentClassifier in project AGREE by loonwerks.
the class AgreeValidator method checkAADLEnumerator.
@Check(CheckType.FAST)
public void checkAADLEnumerator(EnumLitExpr aadlEnum) {
DoubleDotRef enumType = aadlEnum.getEnumType();
NamedElement enumTypeNamedElement = enumType.getElm();
// >>>>>>> origin/develop
if (!AgreeAADLEnumerationUtils.isAADLEnumeration(enumTypeNamedElement)) {
error(enumType, "AADL Enumerations must refer to a Data Type with \"Enum\" data representation " + "property and have an \"Enumerators\' property value list.");
} else {
String enumVal = aadlEnum.getValue();
List<String> enumerators = AgreeAADLEnumerationUtils.getEnumerators((ComponentClassifier) enumTypeNamedElement).stream().map(pe -> ((org.osate.aadl2.StringLiteral) pe).getValue()).collect(Collectors.toList());
if (!enumerators.stream().anyMatch(ev -> ev.equalsIgnoreCase(enumVal))) {
error(aadlEnum, "AADL Enumeration " + enumTypeNamedElement.getQualifiedName() + " does not have an enumeration value " + enumVal);
}
}
}
Aggregations