use of org.osate.aadl2.instance.InstanceReferenceValue in project osate2 by osate.
the class SetInstanceModelBindings method execute.
public void execute() {
for (Iterator iter = threadsToProc.keySet().iterator(); iter.hasNext(); ) {
final ComponentInstance thread = (ComponentInstance) iter.next();
final InstanceReferenceValue val = (InstanceReferenceValue) threadsToProc.get(thread);
thread.setPropertyValue(GetProperties.getActualProcessorBindingProperty(thread), val);
}
}
use of org.osate.aadl2.instance.InstanceReferenceValue in project osate2 by osate.
the class SetInstanceModelBindings method redo.
public void redo() {
// same as execute
for (Iterator iter = threadsToProc.keySet().iterator(); iter.hasNext(); ) {
final ComponentInstance thread = (ComponentInstance) iter.next();
final InstanceReferenceValue val = (InstanceReferenceValue) threadsToProc.get(thread);
thread.setPropertyValue(GetProperties.getActualProcessorBindingProperty(thread), val);
}
}
use of org.osate.aadl2.instance.InstanceReferenceValue in project osate2 by osate.
the class PropertyUtils method getComponentInstanceList.
/**
* TODO: DOC ME !
*
* May return null.
*
* @param object
* @param propertyName
* @return
*/
public static List<ComponentInstance> getComponentInstanceList(NamedElement object, String propertyName) {
List<ComponentInstance> res = null;
PropertyAssociation pa = findPropertyAssociation(propertyName, object);
if (pa != null) {
res = new ArrayList<ComponentInstance>();
Property p = pa.getProperty();
if (p.getName().equals(propertyName)) {
List<ModalPropertyValue> values = pa.getOwnedValues();
if (values.size() == 1) {
ModalPropertyValue v = values.get(0);
PropertyExpression expr = v.getOwnedValue();
if (expr instanceof ListValue) {
ListValue lv = (ListValue) expr;
for (PropertyExpression pe : lv.getOwnedListElements()) {
if (pe instanceof InstanceReferenceValue) {
InstanceReferenceValue c = ((InstanceReferenceValue) pe);
res.add((ComponentInstance) c.getReferencedInstanceObject());
}
}
}
}
}
}
return res;
}
use of org.osate.aadl2.instance.InstanceReferenceValue in project osate2 by osate.
the class DeploymentProperties method getAllowedMemoryBinding.
public static Optional<List<InstanceObject>> getAllowedMemoryBinding(NamedElement lookupContext, Optional<Mode> mode) {
Property property = getAllowedMemoryBinding_Property(lookupContext);
try {
PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
return Optional.of(((ListValue) resolved).getOwnedListElements().stream().map(element1 -> {
PropertyExpression resolved1 = CodeGenUtil.resolveNamedValue(element1, lookupContext, mode);
return ((InstanceReferenceValue) resolved1).getReferencedInstanceObject();
}).collect(Collectors.toList()));
} catch (PropertyNotPresentException e) {
return Optional.empty();
}
}
use of org.osate.aadl2.instance.InstanceReferenceValue in project osate2 by osate.
the class DeploymentProperties method getAllowedProcessorBinding.
public static Optional<List<InstanceObject>> getAllowedProcessorBinding(NamedElement lookupContext, Optional<Mode> mode) {
Property property = getAllowedProcessorBinding_Property(lookupContext);
try {
PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
return Optional.of(((ListValue) resolved).getOwnedListElements().stream().map(element1 -> {
PropertyExpression resolved1 = CodeGenUtil.resolveNamedValue(element1, lookupContext, mode);
return ((InstanceReferenceValue) resolved1).getReferencedInstanceObject();
}).collect(Collectors.toList()));
} catch (PropertyNotPresentException e) {
return Optional.empty();
}
}
Aggregations