use of org.osate.aadl2.properties.PropertyLookupException in project osate-plugin by sireum.
the class HAMRPropertyProvider method getPlatformsFromElement.
public static List<Platform> getPlatformsFromElement(NamedElement ne) {
List<Platform> r = new ArrayList<>();
try {
Property p = GetProperties.lookupPropertyDefinition(ne, PROP_HAMR__PLATFORM);
List<? extends PropertyExpression> propertyValues = ne.getPropertyValueList(p);
for (PropertyExpression pe : propertyValues) {
String v = ((EnumerationLiteral) ((NamedValue) pe).getNamedValue()).getName();
r.add(Platform.valueOf(v));
}
} catch (PropertyLookupException e) {
}
return r;
}
use of org.osate.aadl2.properties.PropertyLookupException in project osate2 by osate.
the class FlowLatencyUtil method getContributorType.
public static String getContributorType(EObject relatedElement) {
if (relatedElement instanceof ComponentInstance) {
ComponentInstance relatedComponentInstance = (ComponentInstance) relatedElement;
if (relatedComponentInstance.getCategory() == ComponentCategory.VIRTUAL_BUS) {
return "protocol";
}
if (relatedComponentInstance.getCategory() == ComponentCategory.VIRTUAL_PROCESSOR) {
return "partition";
}
return relatedComponentInstance.getCategory().getName();
}
if (relatedElement instanceof VirtualBus) {
return "protocol";
}
if (relatedElement instanceof ComponentClassifier) {
ComponentType relatedComponentType = (ComponentType) relatedElement;
return relatedComponentType.getCategory().getName();
}
if (relatedElement instanceof ConnectionInstance) {
final ConnectionKind connectionKind = ((ConnectionInstance) relatedElement).getKind();
Timing connectionType;
try {
connectionType = connectionKind == ConnectionKind.PORT_CONNECTION ? CommunicationProperties.getTiming((ConnectionInstance) relatedElement).orElse(Timing.SAMPLED) : Timing.SAMPLED;
} catch (final PropertyLookupException e) {
// Property association semantics for FEATURE connections are missing
connectionType = Timing.SAMPLED;
}
if (connectionType == Timing.DELAYED) {
return "delayed connection";
}
if (connectionType == Timing.IMMEDIATE) {
return "immediate connection";
}
if (connectionType == Timing.SAMPLED) {
return "connection";
}
return "connection";
}
return "component";
}
use of org.osate.aadl2.properties.PropertyLookupException in project osate2 by osate.
the class PokProperties method getSlotsAllocation.
public static List<ComponentInstance> getSlotsAllocation(final NamedElement ne) {
List<ComponentInstance> res;
res = new ArrayList<ComponentInstance>();
try {
Property slotsAllocation = GetProperties.lookupPropertyDefinition(ne, PokProperties._NAME, PokProperties._SLOTS_ALLOCATION);
List<? extends PropertyExpression> propertyValues = ne.getPropertyValueList(slotsAllocation);
for (PropertyExpression propertyExpression : propertyValues) {
InstanceReferenceValue ref = (InstanceReferenceValue) propertyExpression;
res.add(ref.getReferencedInstanceObject().getComponentInstance());
}
return res;
} catch (PropertyLookupException e) {
return null;
}
}
use of org.osate.aadl2.properties.PropertyLookupException in project osate2 by osate.
the class GetProperties method getSchedulingProtocol.
public static String getSchedulingProtocol(final NamedElement ne) {
try {
Property schedulingprotocol = lookupPropertyDefinition(ne, DeploymentProperties._NAME, DeploymentProperties.SCHEDULING_PROTOCOL);
List<? extends PropertyExpression> propertyValues = ne.getPropertyValueList(schedulingprotocol);
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 GetProperties method getDataEnumerators.
public static List<String> getDataEnumerators(final NamedElement ne) {
List<String> res;
res = new ArrayList<String>();
try {
Property st = lookupPropertyDefinition(ne, DataModel._NAME, DataModel.Enumerators);
List<? extends PropertyExpression> propertyValues = ne.getPropertyValueList(st);
for (PropertyExpression propertyExpression : propertyValues) {
// System.out.println("pe=" + propertyExpression);
StringLiteral sl = (StringLiteral) propertyExpression;
res.add(sl.getValue());
}
return res;
} catch (PropertyLookupException e) {
return null;
}
}
Aggregations