use of org.osate.aadl2.NamedValue in project osate2 by osate.
the class GetProperties method getSourceLanguage.
public static List<String> getSourceLanguage(final NamedElement ne) {
try {
List<String> res = new ArrayList<String>();
Property sourceLanguage = lookupPropertyDefinition(ne, ProgrammingProperties._NAME, ProgrammingProperties.SOURCE_LANGUAGE);
List<? extends PropertyExpression> propertyValues = ne.getPropertyValueList(sourceLanguage);
for (PropertyExpression propertyExpression : propertyValues) {
String v = ((EnumerationLiteral) ((NamedValue) propertyExpression).getNamedValue()).getName();
res.add(v);
}
return res;
} catch (PropertyLookupException e) {
return null;
}
}
use of org.osate.aadl2.NamedValue in project osate2 by osate.
the class GetProperties method getProvidedConnectionQualityOfService.
public static List<EnumerationLiteral> getProvidedConnectionQualityOfService(NamedElement ne) {
try {
List<EnumerationLiteral> res = new ArrayList<>();
Property providedConnQos = lookupPropertyDefinition(ne, DeploymentProperties._NAME, DeploymentProperties.PROVIDED_CONNECTION_QUALITY_OF_SERVICE);
List<? extends PropertyExpression> propertyValues = ne.getPropertyValueList(providedConnQos);
for (PropertyExpression propertyExpression : propertyValues) {
res.add((EnumerationLiteral) ((NamedValue) propertyExpression).getNamedValue());
}
return res;
} catch (PropertyLookupException e) {
return Collections.emptyList();
}
}
use of org.osate.aadl2.NamedValue in project osate2 by osate.
the class GetProperties method getRateUnit.
public static EnumerationLiteral getRateUnit(final RecordValue ne) {
EList<BasicPropertyAssociation> fields = ne.getOwnedFieldValues();
BasicPropertyAssociation rateUnit = getRecordField(fields, "Rate_Unit");
PropertyExpression res = rateUnit.getValue();
if (res instanceof NamedValue) {
return (EnumerationLiteral) ((NamedValue) res).getNamedValue();
}
return null;
}
use of org.osate.aadl2.NamedValue in project osate2 by osate.
the class GetProperties method getConcurrencyControlProtocol.
public static String getConcurrencyControlProtocol(final NamedElement ne) {
try {
Property concurrencyControlProtocol = lookupPropertyDefinition(ne, ThreadProperties._NAME, DeploymentProperties.CONCURRENCY_CONTROL_PROTOCOL);
List<? extends PropertyExpression> propertyValues = ne.getPropertyValueList(concurrencyControlProtocol);
if (!propertyValues.isEmpty()) {
return ((EnumerationLiteral) ((NamedValue) propertyValues.iterator().next()).getNamedValue()).getName();
} else {
return null;
}
} catch (PropertyLookupException e) {
return null;
}
}
use of org.osate.aadl2.NamedValue in project osate2 by osate.
the class PropertyUtils method getSimplePropertyListValue.
/**
* get non-model proeprty list value
*/
public static PropertyExpression getSimplePropertyListValue(final NamedElement ph, final Property pd) throws InvalidModelException, PropertyNotPresentException, PropertyIsModalException, IllegalStateException, IllegalArgumentException, PropertyDoesNotApplyToHolderException, PropertyIsListException {
PropertyExpression res;
if (ph == null) {
throw new IllegalArgumentException("NamedElement ph cannot be null.");
}
res = ph.getSimplePropertyValue(pd);
if (res instanceof NamedValue) {
AbstractNamedValue nv = ((NamedValue) res).getNamedValue();
if (nv instanceof Property) {
res = ph.getSimplePropertyValue((Property) nv);
} else if (nv instanceof PropertyConstant) {
res = ((PropertyConstant) nv).getConstantValue();
}
}
return res;
}
Aggregations