use of org.osate.aadl2.SubprogramCallSequence in project osate2 by osate.
the class BehavioredImplementationImpl method createOwnedSubprogramCallSequence.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SubprogramCallSequence createOwnedSubprogramCallSequence() {
SubprogramCallSequence newOwnedSubprogramCallSequence = (SubprogramCallSequence) create(Aadl2Package.eINSTANCE.getSubprogramCallSequence());
getOwnedSubprogramCallSequences().add(newOwnedSubprogramCallSequence);
return newOwnedSubprogramCallSequence;
}
use of org.osate.aadl2.SubprogramCallSequence in project osate2 by osate.
the class BehavioredImplementationImpl method getAllSubprogramCallSequences.
public EList<SubprogramCallSequence> getAllSubprogramCallSequences() {
EList<Classifier> ancestors = getSelfPlusAllExtended();
final BasicEList<SubprogramCallSequence> returnlist = new BasicEList<SubprogramCallSequence>();
for (Iterator<Classifier> it = ancestors.iterator(); it.hasNext(); ) {
final BehavioredImplementation current = (BehavioredImplementation) it.next();
returnlist.addAll(current.getOwnedSubprogramCallSequences());
}
return returnlist;
}
use of org.osate.aadl2.SubprogramCallSequence in project osate2 by osate.
the class AgeAadlUtil method getAllSubprogramCallSequences.
public static List<SubprogramCallSequence> getAllSubprogramCallSequences(final BehavioredImplementation bi) {
EList<SubprogramCallSequence> returnList = new BasicEList<SubprogramCallSequence>();
ComponentImplementation tmpCi = bi;
while (tmpCi != null) {
if (tmpCi instanceof BehavioredImplementation) {
final BehavioredImplementation tmpBi = (BehavioredImplementation) tmpCi;
returnList.addAll(tmpBi.getOwnedSubprogramCallSequences());
}
tmpCi = tmpCi.getExtended();
}
return returnList;
}
use of org.osate.aadl2.SubprogramCallSequence in project osate2 by osate.
the class CreateAadlConnectionPaletteCommand method getConnectedElementForBusinessObjectContext.
/**
* Builds a ConnectedElement for the specific business object.
* @param boc
* @param connectionType
* @param disableNesting
* @param limitBoc is an optional business object context which limits the path of the connected element
* @return
*/
private ConnectedElement getConnectedElementForBusinessObjectContext(final BusinessObjectContext boc, final EClass connectionType, final boolean disableNesting, final BusinessObjectContext limitBoc) {
final Object bo = boc.getBusinessObject();
if (!(bo instanceof ConnectionEnd)) {
return null;
}
// Build a list of business objects which make up the path to the connection end.
boolean pathIncludesSubcomponent = false;
final LinkedList<Object> path = new LinkedList<>();
for (BusinessObjectContext tmp = boc; tmp != null && tmp != limitBoc && tmp.getBusinessObject() != null; tmp = tmp.getParent()) {
if (tmp.getBusinessObject() instanceof ComponentImplementation || tmp.getBusinessObject() instanceof SubprogramCallSequence) {
break;
} else if (tmp.getBusinessObject() instanceof Subcomponent) {
if (pathIncludesSubcomponent) {
// If two subcomponents are encountered then the element is nested and is inaccessible.
return null;
}
pathIncludesSubcomponent = true;
}
path.add(0, tmp.getBusinessObject());
}
if (path.size() == 0) {
return null;
}
final Object[] pathObjects = path.toArray();
final Object firstBo = pathObjects[0];
final boolean allowNested = !disableNesting && connectionType == Aadl2Package.eINSTANCE.getFeatureConnection();
// If nesting is not allowed, then the number of objects must be at most 2.
if (!allowNested && pathObjects.length > 2) {
return null;
}
final ConnectedElement ce = AgeAadlUtil.getAadl2Factory().createConnectedElement();
// Add the context
int i = 0;
if (pathObjects.length > 1) {
if (!(firstBo instanceof Context)) {
return null;
}
ce.setContext((Context) firstBo);
i++;
}
// Add the first connection end
if (!(pathObjects[i] instanceof ConnectionEnd)) {
return null;
}
ce.setConnectionEnd((ConnectionEnd) pathObjects[i]);
i++;
// Add other segments
ConnectedElement tmp = ce;
for (; i < pathObjects.length; i++) {
tmp = tmp.createNext();
if (!(pathObjects[i] instanceof ConnectionEnd)) {
return null;
}
tmp.setConnectionEnd((ConnectionEnd) pathObjects[i]);
}
// SubprogramSubcomponent elements are never a valid context
if (ce.getContext() instanceof SubprogramSubcomponent) {
return null;
}
return ce;
}
Aggregations