Commit 355df3f5 authored by Simon Barner's avatar Simon Barner
Browse files

Adjust eOperations of AllocationTable to handle both IUnidirectional and...

Adjust eOperations of AllocationTable to handle both IUnidirectional and IBidirectional allocations.
refs 2950
parent c7156304
......@@ -45,88 +45,159 @@
</eGenericType>
</eParameters>
</eOperations>
<eOperations name="getOneToOneAllocationEntries">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Returns all allocation entries specializing {@link org.fortiss.af3.allocation.model.OneToOneAllocationEntry}."/>
<details key="body" value="return AllocationTableStaticImpl.getOneToOneAllocationEntries(this);"/>
</eAnnotations>
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EEList">
<eTypeArguments eClassifier="#//OneToOneAllocationEntry"/>
</eGenericType>
</eOperations>
<eOperations name="getOneToManyAllocationEntries">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Returns all allocation entries specializing {@link org.fortiss.af3.allocation.model.OneToManyAllocationEntry}."/>
<details key="body" value="return AllocationTableStaticImpl.getOneToManyAllocationEntries(this);"/>
</eAnnotations>
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EEList">
<eTypeArguments eClassifier="#//OneToManyAllocationEntry"/>
</eGenericType>
</eOperations>
<eOperations name="getManyToOneAllocationEntries">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Returns all allocation entries specializing {@link org.fortiss.af3.allocation.model.ManyToOneAllocationEntry}."/>
<details key="body" value="return AllocationTableStaticImpl.getManyToOneAllocationEntries(this);"/>
</eAnnotations>
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EEList">
<eTypeArguments eClassifier="#//ManyToOneAllocationEntry"/>
</eGenericType>
</eOperations>
<eOperations name="getTargetElement" eType="ecore:EClass platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElement">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Returns the target element to which the given source element is mapped in a {@link org.fortiss.af3.allocation.model.OneToOneAllocationEntry}, or {@code null} in case no such mapping has been defined."/>
<details key="body" value="return AllocationTableStaticImpl.getTargetElement(this, sourceElement);"/>
<details key="body" value="return AllocationTableStaticImpl.getTargetElement(this, sourceElement, type);"/>
</eAnnotations>
<eTypeParameters name="T">
<eBounds eClassifier="#//OneToOneAllocationEntry"/>
<eBounds eClassifier="#//IBidirectional"/>
</eTypeParameters>
<eParameters name="sourceElement" lowerBound="1" eType="ecore:EClass platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElement"/>
<eParameters name="type" lowerBound="1">
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaClass">
<eTypeArguments eTypeParameter="#//AllocationTable/getTargetElement/T"/>
</eGenericType>
</eParameters>
</eOperations>
<eOperations name="getTargetElement" eType="ecore:EClass platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElement">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="&lt;p>Returns the target element to which the given source elements are mapped in a {@link ManyToOneAllocationEntry}, or {@code null} in case no such mapping has been defined.&lt;/p>&#xD;&#xA;&lt;p>&lt;b>Note:&lt;/b> The list of {@code sourceElements} does not have to be complete. I.e., it is sufficient if there is an {@link ManyToOneAllocationEntry} whose source list contains the provided {@code sourceElements}.&lt;/p>"/>
<details key="body" value="return AllocationTableStaticImpl.getTargetElement(this, sourceElements);"/>
<details key="body" value="return AllocationTableStaticImpl.getTargetElement(this, sourceElements, type);"/>
</eAnnotations>
<eTypeParameters name="T">
<eBounds eClassifier="#//ManyToOneAllocationEntry"/>
<eBounds eClassifier="#//IBidirectional"/>
</eTypeParameters>
<eParameters name="sourceElements" lowerBound="1">
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EEList">
<eTypeArguments eClassifier="ecore:EClass platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElement"/>
</eGenericType>
</eParameters>
<eParameters name="type" lowerBound="1">
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaClass">
<eTypeArguments eTypeParameter="#//AllocationTable/getTargetElement.1/T"/>
</eGenericType>
</eParameters>
</eOperations>
<eOperations name="getTargetElements">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Returns the targets element to which the given source element is mapped in a {@link org.fortiss.af3.allocation.model.OneToManyAllocationEntry}, or {@code null} in case no such mapping has been defined."/>
<details key="body" value="return AllocationTableStaticImpl.getTargetElements(this, sourceElement);"/>
<details key="body" value="return AllocationTableStaticImpl.getTargetElements(this, sourceElement, type);"/>
</eAnnotations>
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EEList">
<eTypeArguments eClassifier="ecore:EClass platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElement"/>
</eGenericType>
<eTypeParameters name="T">
<eBounds eClassifier="#//AllocationEntry"/>
</eTypeParameters>
<eParameters name="sourceElement" lowerBound="1" eType="ecore:EClass platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElement"/>
<eParameters name="type" lowerBound="1">
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaClass">
<eTypeArguments eTypeParameter="#//AllocationTable/getTargetElements/T"/>
</eGenericType>
</eParameters>
</eOperations>
<eOperations name="getTargetElements">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Returns the targets element to which the given source element is mapped one or more {@link IUniDirectional} {@link ManyToOneAllocationEntry}s."/>
<details key="body" value="return AllocationTableStaticImpl.getTargetElements(this, sourceElements, type);"/>
</eAnnotations>
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EEList">
<eTypeArguments eClassifier="ecore:EClass platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElement"/>
</eGenericType>
<eTypeParameters name="T">
<eBounds eClassifier="#//ManyToOneAllocationEntry"/>
<eBounds eClassifier="#//IUnidirectional"/>
</eTypeParameters>
<eParameters name="sourceElements" lowerBound="1">
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EEList">
<eTypeArguments eClassifier="ecore:EClass platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElement"/>
</eGenericType>
</eParameters>
<eParameters name="type" lowerBound="1">
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaClass">
<eTypeArguments eTypeParameter="#//AllocationTable/getTargetElements.1/T"/>
</eGenericType>
</eParameters>
</eOperations>
<eOperations name="getSourceElement" eType="ecore:EClass platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElement">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Returns the source element which is mapped to the given target element in a {@link org.fortiss.af3.allocation.OneToOneAllocationEntry}, or {@code null} in case no such mapping has been defined."/>
<details key="body" value="return AllocationTableStaticImpl.getSourceElement(this, targetElement);"/>
<details key="body" value="return AllocationTableStaticImpl.getSourceElement(this, targetElement, type);"/>
</eAnnotations>
<eTypeParameters name="T">
<eBounds eClassifier="#//OneToOneAllocationEntry"/>
<eBounds eClassifier="#//IBidirectional"/>
</eTypeParameters>
<eParameters name="targetElement" lowerBound="1" eType="ecore:EClass platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElement"/>
<eParameters name="type" lowerBound="1">
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaClass">
<eTypeArguments eTypeParameter="#//AllocationTable/getSourceElement/T"/>
</eGenericType>
</eParameters>
</eOperations>
<eOperations name="getSourceElement" eType="ecore:EClass platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElement">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="&lt;p>Returns the source element to which the given target elements are mapped in a {@link OneToManyAllocationEntry}, or {@code null} in case no such mapping has been defined.&lt;/p>&#xD;&#xA;&lt;p>&lt;b>Note:&lt;/b> The list of {@code targetElements} does not have to be complete. I.e., it is sufficient if there is an {@link OneToManyAllocationEntry}, whose target list contains the provided {@code targetElements}.&lt;/p>"/>
<details key="body" value="return AllocationTableStaticImpl.getSourceElement(this, targetElements);"/>
<details key="body" value="return AllocationTableStaticImpl.getSourceElement(this, targetElements, type);"/>
</eAnnotations>
<eTypeParameters name="T">
<eBounds eClassifier="#//OneToManyAllocationEntry"/>
<eBounds eClassifier="#//IBidirectional"/>
</eTypeParameters>
<eParameters name="targetElements" lowerBound="1">
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EEList">
<eTypeArguments eClassifier="ecore:EClass platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElement"/>
</eGenericType>
</eParameters>
<eParameters name="type" lowerBound="1">
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaClass">
<eTypeArguments eTypeParameter="#//AllocationTable/getSourceElement.1/T"/>
</eGenericType>
</eParameters>
</eOperations>
<eOperations name="getSourceElements">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Returns the source elements which are mapped to the given target element in a {@link org.fortiss.af3.allocation.model.ManyToOneAllocationEntry}, or {@code null} in case no such mapping has been defined. The implementation also covers {@link org.fortiss.af3.allocation.model.OneToOneAllocation}s where it returns a list with one element. For {@link org.fortiss.af3.allocation.model.OneToManyAllocation}s, a {@link java.lang.UnsupportedOperationException} is thrown."/>
<details key="body" value="return AllocationTableStaticImpl.getSourceElements(this, targetElement);"/>
<details key="body" value="return AllocationTableStaticImpl.getSourceElements(this, targetElement, type);"/>
</eAnnotations>
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EEList">
<eTypeArguments eClassifier="ecore:EClass platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElement"/>
</eGenericType>
<eTypeParameters name="T">
<eBounds eClassifier="#//AllocationEntry"/>
</eTypeParameters>
<eParameters name="targetElement" lowerBound="1" eType="ecore:EClass platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElement"/>
<eParameters name="type" lowerBound="1">
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaClass">
<eTypeArguments eTypeParameter="#//AllocationTable/getSourceElements/T"/>
</eGenericType>
</eParameters>
</eOperations>
<eOperations name="getSourceElements">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Returns the source elements which are mapped to the given target elements in several {@link org.fortiss.af3.allocation.model.OneToManyAllocationEntry}s, or {@code null} in case no such mapping has been defined."/>
<details key="body" value="return AllocationTableStaticImpl.getSourceElements(this, targetElements, type);"/>
</eAnnotations>
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EEList">
<eTypeArguments eClassifier="ecore:EClass platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElement"/>
</eGenericType>
<eTypeParameters name="T">
<eBounds eClassifier="#//OneToManyAllocationEntry"/>
<eBounds eClassifier="#//IUnidirectional"/>
</eTypeParameters>
<eParameters name="targetElements" lowerBound="1">
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EEList">
<eTypeArguments eClassifier="ecore:EClass platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IModelElement"/>
</eGenericType>
</eParameters>
<eParameters name="type" lowerBound="1">
<eGenericType eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaClass">
<eTypeArguments eTypeParameter="#//AllocationTable/getSourceElements.1/T"/>
</eGenericType>
</eParameters>
</eOperations>
<eStructuralFeatures xsi:type="ecore:EReference" name="sourceView" eType="ecore:EClass platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IHierarchicElement">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
......
......@@ -21,26 +21,45 @@
<genParameters ecoreParameter="allocation.ecore#//AllocationTable/getAllocationEntries.1/type"/>
<genTypeParameters ecoreTypeParameter="allocation.ecore#//AllocationTable/getAllocationEntries.1/T"/>
</genOperations>
<genOperations ecoreOperation="allocation.ecore#//AllocationTable/getOneToOneAllocationEntries"/>
<genOperations ecoreOperation="allocation.ecore#//AllocationTable/getOneToManyAllocationEntries"/>
<genOperations ecoreOperation="allocation.ecore#//AllocationTable/getManyToOneAllocationEntries"/>
<genOperations ecoreOperation="allocation.ecore#//AllocationTable/getTargetElement">
<genParameters ecoreParameter="allocation.ecore#//AllocationTable/getTargetElement/sourceElement"/>
<genParameters ecoreParameter="allocation.ecore#//AllocationTable/getTargetElement/type"/>
<genTypeParameters ecoreTypeParameter="allocation.ecore#//AllocationTable/getTargetElement/T"/>
</genOperations>
<genOperations ecoreOperation="allocation.ecore#//AllocationTable/getTargetElement.1">
<genParameters ecoreParameter="allocation.ecore#//AllocationTable/getTargetElement.1/sourceElements"/>
<genParameters ecoreParameter="allocation.ecore#//AllocationTable/getTargetElement.1/type"/>
<genTypeParameters ecoreTypeParameter="allocation.ecore#//AllocationTable/getTargetElement.1/T"/>
</genOperations>
<genOperations ecoreOperation="allocation.ecore#//AllocationTable/getTargetElements">
<genParameters ecoreParameter="allocation.ecore#//AllocationTable/getTargetElements/sourceElement"/>
<genParameters ecoreParameter="allocation.ecore#//AllocationTable/getTargetElements/type"/>
<genTypeParameters ecoreTypeParameter="allocation.ecore#//AllocationTable/getTargetElements/T"/>
</genOperations>
<genOperations ecoreOperation="allocation.ecore#//AllocationTable/getTargetElements.1">
<genParameters ecoreParameter="allocation.ecore#//AllocationTable/getTargetElements.1/sourceElements"/>
<genParameters ecoreParameter="allocation.ecore#//AllocationTable/getTargetElements.1/type"/>
<genTypeParameters ecoreTypeParameter="allocation.ecore#//AllocationTable/getTargetElements.1/T"/>
</genOperations>
<genOperations ecoreOperation="allocation.ecore#//AllocationTable/getSourceElement">
<genParameters ecoreParameter="allocation.ecore#//AllocationTable/getSourceElement/targetElement"/>
<genParameters ecoreParameter="allocation.ecore#//AllocationTable/getSourceElement/type"/>
<genTypeParameters ecoreTypeParameter="allocation.ecore#//AllocationTable/getSourceElement/T"/>
</genOperations>
<genOperations ecoreOperation="allocation.ecore#//AllocationTable/getSourceElement.1">
<genParameters ecoreParameter="allocation.ecore#//AllocationTable/getSourceElement.1/targetElements"/>
<genParameters ecoreParameter="allocation.ecore#//AllocationTable/getSourceElement.1/type"/>
<genTypeParameters ecoreTypeParameter="allocation.ecore#//AllocationTable/getSourceElement.1/T"/>
</genOperations>
<genOperations ecoreOperation="allocation.ecore#//AllocationTable/getSourceElements">
<genParameters ecoreParameter="allocation.ecore#//AllocationTable/getSourceElements/targetElement"/>
<genParameters ecoreParameter="allocation.ecore#//AllocationTable/getSourceElements/type"/>
<genTypeParameters ecoreTypeParameter="allocation.ecore#//AllocationTable/getSourceElements/T"/>
</genOperations>
<genOperations ecoreOperation="allocation.ecore#//AllocationTable/getSourceElements.1">
<genParameters ecoreParameter="allocation.ecore#//AllocationTable/getSourceElements.1/targetElements"/>
<genParameters ecoreParameter="allocation.ecore#//AllocationTable/getSourceElements.1/type"/>
<genTypeParameters ecoreTypeParameter="allocation.ecore#//AllocationTable/getSourceElements.1/T"/>
</genOperations>
</genClasses>
<genClasses image="false" ecoreClass="allocation.ecore#//AllocationEntry"/>
......
......@@ -30,6 +30,9 @@ import org.fortiss.af3.partition.model.PartitionChannel;
import org.fortiss.af3.partition.model.PartitionInputPort;
import org.fortiss.af3.partition.model.PartitionOutputPort;
import org.fortiss.af3.partition.model.ca2pa.LogicalArchitectureToPartitionArchitectureAllocationTable;
import org.fortiss.af3.partition.model.ca2pa.LogicalComponentToPartitionAllocationEntry;
import org.fortiss.af3.partition.model.ca2pa.LogicalInPortToPartitionInPortAllocationEntry;
import org.fortiss.af3.partition.model.ca2pa.LogicalOutPortToPartitionOutPortAllocationEntry;
/**
* Implementation of static methods for
......@@ -45,13 +48,15 @@ public class LogicalArchitectureToPartitionArchitectureAllocationTableStaticImpl
/** Returns the {@link Partition} to which the given {@link Component} is allocated. */
public static Partition getPartition(
LogicalArchitectureToPartitionArchitectureAllocationTable ca2pa, Component component) {
return (Partition)ca2pa.getTargetElement(asEList(component));
return (Partition)ca2pa.getTargetElement(asEList(component),
LogicalComponentToPartitionAllocationEntry.class);
}
/** Returns the list of {@link Component}s which are allocated to the given {@link Partition}. */
public static EList<Component> getComponents(
LogicalArchitectureToPartitionArchitectureAllocationTable ca2pa, Partition partition) {
return convertList(Component.class, ca2pa.getSourceElements(partition));
return convertList(Component.class, ca2pa.getSourceElements(partition,
LogicalComponentToPartitionAllocationEntry.class));
}
/**
......@@ -59,7 +64,8 @@ public class LogicalArchitectureToPartitionArchitectureAllocationTableStaticImpl
*/
public static PartitionChannel getPartitionChannel(
LogicalArchitectureToPartitionArchitectureAllocationTable ca2pa, Channel channel) {
return (PartitionChannel)ca2pa.getTargetElement(asEList(channel));
return (PartitionChannel)ca2pa.getTargetElement(asEList(channel),
LogicalComponentToPartitionAllocationEntry.class);
}
/**
......@@ -68,7 +74,8 @@ public class LogicalArchitectureToPartitionArchitectureAllocationTableStaticImpl
*/
public static PartitionOutputPort getPartitionOutputPort(
LogicalArchitectureToPartitionArchitectureAllocationTable ca2pa, OutputPort outputPort) {
return (PartitionOutputPort)ca2pa.getTargetElement(asEList(outputPort));
return (PartitionOutputPort)ca2pa.getTargetElement(asEList(outputPort),
LogicalOutPortToPartitionOutPortAllocationEntry.class);
}
/**
......@@ -77,6 +84,7 @@ public class LogicalArchitectureToPartitionArchitectureAllocationTableStaticImpl
*/
public static PartitionInputPort getPartitionInputPort(
LogicalArchitectureToPartitionArchitectureAllocationTable ca2pa, InputPort inputPort) {
return (PartitionInputPort)ca2pa.getTargetElement(asEList(inputPort));
return (PartitionInputPort)ca2pa.getTargetElement(asEList(inputPort),
LogicalInPortToPartitionInPortAllocationEntry.class);
}
}
......@@ -23,6 +23,7 @@ import static org.fortiss.tooling.kernel.utils.EcoreUtils.convertList;
import org.eclipse.emf.common.util.EList;
import org.fortiss.af3.partition.model.Partition;
import org.fortiss.af3.platform.hierarchic.model.pa2phy.PartitionArchitectureToPhysicalArchitectureAllocationTable;
import org.fortiss.af3.platform.hierarchic.model.pa2phy.PartitionToCoreAllocationEntry;
import org.fortiss.af3.platform.hierarchic.model.processor.Core;
/**
......@@ -39,13 +40,14 @@ public class PartitionArchitectureToPhysicalArchitectureAllocationTableStaticImp
/** Returns the {@link Core}s to which the given {@link Partition} is allocated. */
public static EList<Core> getCores(
PartitionArchitectureToPhysicalArchitectureAllocationTable pa2phy, Partition partition) {
return convertList(Core.class, pa2phy.getTargetElements(partition));
return convertList(Core.class,
pa2phy.getTargetElements(partition, PartitionToCoreAllocationEntry.class));
}
/** Returns the {@link Partition}s which are allocated to the given {@link Core}. */
public static EList<Partition> getPartitions(
PartitionArchitectureToPhysicalArchitectureAllocationTable pa2phy, Core core) {
// TODO Currently at most one Partition can be mapped to a Core
return asEList((Partition)pa2phy.getSourceElement(asEList(core)));
return convertList(Partition.class,
pa2phy.getSourceElements(asEList(core), PartitionToCoreAllocationEntry.class));
}
}
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