use of org.osate.aadl2.NamedElement in project AGREE by loonwerks.
the class AgreeScopeProvider method getNamedElementsFromClassifier.
private Map<String, NamedElement> getNamedElementsFromClassifier(Classifier ctx, boolean fromCompImpl) {
Map<String, NamedElement> components = new HashMap<>();
components.putAll(getNamedElements(getAadlContainer(ctx)));
for (AnnexSubclause annex : AnnexUtil.getAllAnnexSubclauses(ctx, AgreePackage.eINSTANCE.getAgreeContractSubclause())) {
AgreeContract contract = (AgreeContract) ((AgreeContractSubclause) annex).getContract();
components.putAll(getNamedElementsFromSpecs(contract.getSpecs()));
}
Classifier extended = ctx.getExtended();
if (extended != null) {
components.putAll(getNamedElementsFromClassifier(extended, false));
}
if (ctx instanceof ComponentImplementation) {
components.putAll(getNamedElementsFromClassifier(((ComponentImplementation) ctx).getType(), true));
ArrayList<NamedElement> nes = new ArrayList<>();
nes.addAll(((ComponentImplementation) ctx).getAllSubcomponents());
nes.addAll(((ComponentImplementation) ctx).getAllConnections());
components.putAll(toNamedElementMap(nes));
} else if (ctx instanceof ComponentType) {
if (fromCompImpl) {
ArrayList<NamedElement> nes = new ArrayList<>();
nes.addAll(((ComponentType) ctx).getAllFeatures());
components.putAll(toNamedElementMap(nes));
} else {
ArrayList<NamedElement> nes = new ArrayList<>();
nes.addAll(((ComponentType) ctx).getOwnedFeatures());
components.putAll(toNamedElementMap(nes));
}
}
return components;
}
use of org.osate.aadl2.NamedElement in project AGREE by loonwerks.
the class AgreeAADLPropertyUtils method getPropertyEnumString.
public static String getPropertyEnumString(NamedElement namedEl, String property) {
Property prop = Aadl2GlobalScopeUtil.get(namedEl, Aadl2Package.eINSTANCE.getProperty(), property);
EnumerationLiteral lit = PropertyUtils.getEnumLiteral(namedEl, prop);
return lit.getName();
}
use of org.osate.aadl2.NamedElement 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.NamedElement 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.NamedElement 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