use of org.osate.ba.aadlba.CalledSubprogramHolder in project osate2 by osate.
the class SubprogramCallActionImpl method basicSetSubprogram.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSubprogram(CalledSubprogramHolder newSubprogram, NotificationChain msgs) {
CalledSubprogramHolder oldSubprogram = subprogram;
subprogram = newSubprogram;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AadlBaPackage.SUBPROGRAM_CALL_ACTION__SUBPROGRAM, oldSubprogram, newSubprogram);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.osate.ba.aadlba.CalledSubprogramHolder in project osate-plugin by sireum.
the class BAVisitor method caseSubprogramCallAction.
@Override
public Boolean caseSubprogramCallAction(SubprogramCallAction object) {
Name name = null;
List<Feature> features = null;
CalledSubprogramHolder csh = object.getSubprogram();
assert csh.getArrayIndexes().isEmpty() : "has array indexes: " + csh.getArrayIndexes().size();
if (csh instanceof SubprogramSubcomponentHolder) {
SubprogramSubcomponentHolder ssh = (SubprogramSubcomponentHolder) csh;
assert (ssh.getArrayIndexes().isEmpty());
name = toName(ssh.getSubcomponent().getName());
features = ssh.getSubcomponent().getAllFeatures();
} else {
throw new RuntimeException("Currently only supporting subcomponent subprograms");
}
assert features.size() == object.getParameterLabels().size() : "feature size not equal to param labels size: " + features.size() + " vs " + object.getParameterLabels().size();
List<BTSFormalExpPair> params = new ArrayList<>();
for (int index = 0; index < object.getParameterLabels().size(); index++) {
Feature f = features.get(index);
visit(object.getParameterLabels().get(index));
BTSExp ne = pop();
// TODO:
Option<Name> paramName = toSome(toSimpleName(f.getName()));
params.add(BTSFormalExpPair$.MODULE$.apply(paramName, toSome(ne), toNone()));
}
push(BTSSubprogramCallAction$.MODULE$.apply(name, VisitorUtil.toISZ(params)));
return false;
}
Aggregations