use of org.osate.aadl2.instance.ConnectionInstanceEnd in project osate2 by osate.
the class ConnectionInstanceImpl method basicSetSource.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSource(ConnectionInstanceEnd newSource, NotificationChain msgs) {
ConnectionInstanceEnd oldSource = source;
source = newSource;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, InstancePackage.CONNECTION_INSTANCE__SOURCE, oldSource, newSource);
if (msgs == null) {
msgs = notification;
} else {
msgs.add(notification);
}
}
return msgs;
}
use of org.osate.aadl2.instance.ConnectionInstanceEnd in project osate2 by osate.
the class ConnectionReferenceImpl method setSource.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSource(ConnectionInstanceEnd newSource) {
ConnectionInstanceEnd oldSource = source;
source = newSource;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, InstancePackage.CONNECTION_REFERENCE__SOURCE, oldSource, source));
}
}
use of org.osate.aadl2.instance.ConnectionInstanceEnd in project osate2 by osate.
the class ConnectionReferenceImpl method setDestination.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDestination(ConnectionInstanceEnd newDestination) {
ConnectionInstanceEnd oldDestination = destination;
destination = newDestination;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, InstancePackage.CONNECTION_REFERENCE__DESTINATION, oldDestination, destination));
}
}
use of org.osate.aadl2.instance.ConnectionInstanceEnd in project osate2 by osate.
the class InstanceModelUtil method doConnectedByBus.
/**
* returns list of buses connecting to HW components. Can be empty list (if
* same component), or null (no connection).
*
* @param source HW component
* @param destination HW component
* @return list of buses involved in the physical connection
*/
protected static List<ComponentInstance> doConnectedByBus(ComponentInstance srcHW, ComponentInstance dstHW, List<ComponentInstance> visitedBuses) {
if (srcHW == null || dstHW == null || srcHW == dstHW) {
return visitedBuses;
}
for (FeatureInstance fi : srcHW.getFeatureInstances()) {
if (fi.getCategory() == FeatureCategory.BUS_ACCESS) {
for (ConnectionInstance aci : fi.getDstConnectionInstances()) {
ConnectionInstanceEnd src = aci.getSource();
ComponentInstance curBus = src instanceof ComponentInstance ? (ComponentInstance) src : ((FeatureInstance) src).getComponentInstance();
if (!visitedBuses.contains(curBus)) {
if (connectedToBus(dstHW, curBus)) {
List<ComponentInstance> res = new ArrayList<ComponentInstance>();
res.add(curBus);
return res;
} else {
// first check if there is a bus this bus is connected to
visitedBuses.add(curBus);
List<ComponentInstance> res = doConnectedByBus(curBus, dstHW, visitedBuses);
if (res != null) {
res.add(0, curBus);
return res;
} else {
// check for buses that are connected to this bus
for (ConnectionInstance srcaci : curBus.getSrcConnectionInstances()) {
ComponentInstance bi = srcaci.getDestination().getContainingComponentInstance();
if (bi.getCategory() == ComponentCategory.BUS) {
if (connectedToBus(dstHW, bi)) {
res = new BasicEList<ComponentInstance>();
res.add(bi);
return res;
} else {
visitedBuses.add(bi);
res = doConnectedByBus(bi, dstHW, visitedBuses);
if (res != null) {
res.add(0, curBus);
return res;
}
}
}
}
}
}
}
}
}
}
return visitedBuses;
}
use of org.osate.aadl2.instance.ConnectionInstanceEnd in project osate2 by osate.
the class InstanceModelUtil method getRelatedComponentDestination.
/**
* Get the component that is connected at the destination side of the connection.
* @param connectionInstance - the connection to be processed
* @return - the component that is the connection destination (and not its feature)
*/
public static ComponentInstance getRelatedComponentDestination(ConnectionInstance connectionInstance) {
ConnectionInstanceEnd destinationEnd;
ComponentInstance destination = null;
destinationEnd = connectionInstance.getDestination();
if (!(destinationEnd instanceof ComponentInstance)) {
destination = destinationEnd.getContainingComponentInstance();
} else {
destination = (ComponentInstance) destinationEnd;
}
return destination;
}
Aggregations