use of org.osate.ba.aadlba.IntegerValueConstant in project osate2 by osate.
the class AadlBaNameResolver method behaviorVariableResolver.
/**
* Resolves the behavior annex's variables.
*
* @return {@code true} if all names are resolved. {@code false} otherwise.
*/
private boolean behaviorVariableResolver() {
boolean result = true;
QualifiedNamedElement uccr;
// classifier reference exists.
for (BehaviorVariable v : _ba.getVariables()) {
uccr = (QualifiedNamedElement) v.getDataClassifier();
result &= qualifiedNamedElementResolver(uccr, true);
for (ArrayDimension tmp : v.getArrayDimensions()) {
IntegerValueConstant ivc = ((DeclarativeArrayDimension) tmp).getDimension();
result &= integerValueConstantResolver(ivc);
}
List<PropertyAssociation> paList = v.getOwnedPropertyAssociations();
List<PropertyAssociation> paPropertyNotFound = new ArrayList<PropertyAssociation>();
Set<PropertyAssociation> paPropertyValueError = new HashSet<PropertyAssociation>();
for (PropertyAssociation pa : paList) {
QualifiedNamedElement p = (QualifiedNamedElement) pa.getProperty();
boolean valid = qualifiedNamedElementResolver(p, false);
if (valid) {
for (ModalPropertyValue mpv : pa.getOwnedValues()) {
result &= propertyExpressionResolver(v, p, mpv.getOwnedValue());
paPropertyValueError.add(pa);
}
}
if (!valid) {
paPropertyNotFound.add(pa);
}
result &= valid;
}
StringBuilder msg = new StringBuilder();
if (paPropertyNotFound.size() > 1) {
msg.append("Properties ");
} else {
msg.append("Property ");
}
boolean first = true;
for (PropertyAssociation paToRemove : paPropertyNotFound) {
QualifiedNamedElement p = (QualifiedNamedElement) paToRemove.getProperty();
StringBuilder qualifiedName = new StringBuilder();
if (p.getBaNamespace() != null) {
qualifiedName.append(p.getBaNamespace().getId());
qualifiedName.append("::");
}
qualifiedName.append(p.getBaName().getId());
if (first) {
msg.append("\'" + qualifiedName + "\' ");
} else {
msg.append(" and \'" + qualifiedName + "\' ");
}
first = false;
}
paList.removeAll(paPropertyNotFound);
paList.removeAll(paPropertyValueError);
if (paPropertyNotFound.size() > 0) {
msg.append("not found");
_errManager.error(v, msg.toString());
}
}
return result;
}
use of org.osate.ba.aadlba.IntegerValueConstant in project osate2 by osate.
the class DeclarativeArrayDimensionImpl method basicSetDimension.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetDimension(IntegerValueConstant newDimension, NotificationChain msgs) {
IntegerValueConstant oldDimension = dimension;
dimension = newDimension;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DeclarativePackage.DECLARATIVE_ARRAY_DIMENSION__DIMENSION, oldDimension, newDimension);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
Aggregations