use of org.osate.aadl2.properties.PropertyLookupException 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.properties.PropertyLookupException in project osate2 by osate.
the class GetProperties method getSourceName.
public static String getSourceName(final NamedElement ne) {
try {
Property sn = lookupPropertyDefinition(ne, ProgrammingProperties._NAME, ProgrammingProperties.SOURCE_NAME);
PropertyAcc pacc = ne.getPropertyValue(sn);
if (pacc.getAssociations().size() > 0) {
ModalPropertyValue mdv = pacc.getAssociations().get(0).getOwnedValues().get(0);
PropertyExpression pe = mdv.getOwnedValue();
// System.out.println("pe=" + pe);
StringLiteral sl = (StringLiteral) pe;
return sl.getValue();
}
// System.out.println("pacc" + pacc.getAssociations().get(0).getOwnedValues().get(0));
return null;
} catch (PropertyLookupException e) {
return null;
}
}
use of org.osate.aadl2.properties.PropertyLookupException 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.properties.PropertyLookupException in project osate2 by osate.
the class PokProperties method getTimeSlotInMs.
public static List<Double> getTimeSlotInMs(final NamedElement ne) {
List<Double> res;
UnitLiteral milliseconds;
res = new ArrayList<Double>();
try {
Property slots = GetProperties.lookupPropertyDefinition(ne, PokProperties._NAME, PokProperties._SLOTS);
milliseconds = GetProperties.getMSUnitLiteral(slots);
List<? extends PropertyExpression> propertyValues = ne.getPropertyValueList(slots);
for (PropertyExpression propertyExpression : propertyValues) {
double time = ((IntegerLiteral) propertyExpression).getScaledValue(milliseconds);
res.add(time);
}
return res;
} catch (PropertyLookupException e) {
return null;
}
}
use of org.osate.aadl2.properties.PropertyLookupException in project osate-plugin by sireum.
the class HAMRPropertyProvider method getHWsFromElement.
public static List<HW> getHWsFromElement(NamedElement ne) {
List<HW> r = new ArrayList<>();
try {
Property p = GetProperties.lookupPropertyDefinition(ne, PROP_HAMR__HW);
List<? extends PropertyExpression> propertyValues = ne.getPropertyValueList(p);
for (PropertyExpression pe : propertyValues) {
String v = ((EnumerationLiteral) ((NamedValue) pe).getNamedValue()).getName();
r.add(HW.valueOf(v));
}
} catch (PropertyLookupException e) {
}
return r;
}
Aggregations