Commit 5e8c466a authored by Alexander Diewald's avatar Alexander Diewald

Merge branch '3980' into 'master'

Hier. Plat.: Do not allow Clocks to be added aside Nodes.

See merge request !309
parents e5608adf 0b3732aa
HierarchicPlatformArchitectureCompositor.java bbd67a9699b73eb051a815aa513f61621e3836d4 GREEN
HierarchicalCompositionRules.java da79b6c828dd13909ec4aba6062ae09865eda86f GREEN
HierarchicPlatformArchitectureCompositor.java fecefdbd64c391f179730ac5aea7e7265ec81fca GREEN
HierarchicalCompositionRules.java 70651bf28c1a455eead6556e7578c81317aa9d5c GREEN
......@@ -15,17 +15,23 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.platform.hierarchic.compose;
import static org.fortiss.tooling.common.util.LambdaUtils.filterByType;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickFirstInstanceOf;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.fortiss.af3.platform.hierarchic.compose.base.IPlatformHierarchicalCompositionRules;
import org.fortiss.af3.platform.hierarchic.compose.base.PlatformArchitectureCompositorBase;
import org.fortiss.af3.platform.hierarchic.model.cluster.Cluster;
import org.fortiss.af3.platform.hierarchic.model.cluster.IClusterDomain;
import org.fortiss.af3.platform.hierarchic.model.electronics.Clock;
import org.fortiss.af3.platform.hierarchic.model.node.OffChipNetworkInterface;
import org.fortiss.af3.platform.hierarchic.model.node.OffChipNetworkPort;
import org.fortiss.af3.platform.model.IArchitectureDomain;
import org.fortiss.af3.platform.model.IPlatformArchitectureElement;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.tooling.base.model.element.IHierarchicElement;
import org.fortiss.tooling.kernel.extension.data.IElementCompositionContext;
......@@ -61,10 +67,20 @@ public class HierarchicPlatformArchitectureCompositor extends PlatformArchitectu
// Clusters and Nodes are used at the top-level.
EList<IHierarchicElement> paChildren = container.getContainedElements();
boolean containsCluster = pickFirstInstanceOf(Cluster.class, paChildren) != null;
boolean containsNonCluster = !containsCluster && !paChildren.isEmpty();
Set<IPlatformArchitectureElement> childElems =
new HashSet<>(filterByType(paChildren, IPlatformArchitectureElement.class));
Set<IPlatformArchitectureElement> clusterElems =
new HashSet<>(filterByType(filterByType(paChildren, IClusterDomain.class),
IPlatformArchitectureElement.class));
childElems.removeAll(clusterElems);
boolean containsNonClusterDomElem = !childElems.isEmpty();
if((containsCluster && !(contained instanceof IClusterDomain)) ||
(containsNonCluster && contained instanceof Cluster)) {
(containsNonClusterDomElem && contained instanceof Cluster)) {
return false;
}
if(contained instanceof Clock) {
return false;
}
......
......@@ -75,6 +75,7 @@ public class HierarchicalCompositionRules extends PlatformHierarchicalCompositio
rval.add(ITileDomain.class);
rval.add(IOffChipNetworkDomain.class);
rval.add(IMemoryDomain.class);
rval.add(IElectronicsDomain.class);
rval.add(IPeripheralsDomain.class);
} else if(hasEqualLevel(domain, ITileDomain.class)) {
// Required for availability of these elements at the tile level (i.e., to drop elements
......@@ -82,6 +83,7 @@ public class HierarchicalCompositionRules extends PlatformHierarchicalCompositio
rval.add(IProcessorDomain.class);
rval.add(IMemoryDomain.class);
rval.add(INocDomain.class);
rval.add(IElectronicsDomain.class);
} else if(hasEqualLevel(domain, IMemoryDomain.class)) {
rval.add(IProcessorDomain.class);
rval.add(ITileDomain.class);
......
BusCompositor.java 26b60c609de15d545abc945cc7c35d487531800c GREEN
ClockCompositor.java 360aea01ec2ae832ab5c69e95b38b38ade3f5f2f GREEN
ClusterCompositor.java 6a2861b896f790c404753844eaa15222518fd59d GREEN
ClusterCompositor.java de1ea49354a09bc3c098c64674bfc4a15dcae81e GREEN
CoreCompositor.java 050798a2f694a04c23595ab7b9dee9756e9a3404 GREEN
MemoryCompositor.java 3064bb9b47a0df16eb85304481716d56273a21b9 GREEN
NetworkInterfaceCompositor.java da20db4c57e17921143fd8ea87635d9f341904b5 GREEN
......
......@@ -24,6 +24,7 @@ import org.fortiss.af3.platform.hierarchic.compose.HierarchicalCompositionRules;
import org.fortiss.af3.platform.hierarchic.compose.base.IPlatformHierarchicalCompositionRules;
import org.fortiss.af3.platform.hierarchic.compose.base.elements.PlatformElementCompositorBase;
import org.fortiss.af3.platform.hierarchic.model.cluster.Cluster;
import org.fortiss.af3.platform.hierarchic.model.electronics.Clock;
import org.fortiss.af3.platform.hierarchic.model.electronics.ClockOut;
import org.fortiss.af3.platform.hierarchic.model.electronics.PowerOut;
import org.fortiss.af3.platform.hierarchic.model.node.Node;
......@@ -63,8 +64,8 @@ public final class ClusterCompositor extends PlatformElementCompositorBase<Clust
public boolean canCompose(Cluster container, EObject contained,
IElementCompositionContext context) {
// Exception to enable addition of OffChipNetworkPort to Cluster
return contained instanceof OffChipNetworkPort ||
super.canCompose(container, contained, context);
return !(contained instanceof Clock) && (contained instanceof OffChipNetworkPort ||
super.canCompose(container, contained, context));
}
/** {@inheritDoc} */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment