Commit 2044fc12 authored by Simon Barner's avatar Simon Barner
Browse files

GREEN (with minor modifications)

Issue-Ref: 3746
Issue-Url: https://af3-developer.fortiss.org/issues/3746

Signed-off-by: Simon Barner's avatarSimon Barner <barner@fortiss.org>
parent 2e2846fd
AF3AllocationFactoryImplCustom.java 36f55f6cc9ab49c09223a7b0c0163157b137aeb3 GREEN
AllocationEntryStaticImpl.java 49e2c1390029f9652e8d891a1ce281f30e941d5b GREEN
AllocationTableCollectionStaticImpl.java d1ebdc08e00373ca5940853c1fb7c1b0a5b19c43 GREEN
AllocationTableStaticImpl.java 374938800d794e34416f5cc15f04cc825e705e5e YELLOW
AllocationTableStaticImpl.java 374938800d794e34416f5cc15f04cc825e705e5e GREEN
ParameterEntryStaticImpl.java 81f62de67eaeac99da628853f31ae13bc6a33cc4 GREEN
ParameterTableStaticImpl.java 92c80d863c44ebabe82fed3ab78ed600156d6faf GREEN
AllocationModelElementFactory.java 9aba183708290c741ebbbe2897bbfcc51ea33fb6 GREEN
AllocationUtils.java d7520a980671e50efc80bb2635b330524e1d82cb YELLOW
AllocationUtils.java 365a1b904d7eaa9d22b723307ae0dd2892a925a2 GREEN
......@@ -579,16 +579,16 @@ public class AllocationUtils {
}
/**
* For a given {@code modelElement} that is an allocation target, this method collects all of
* its transient allocation sources of the given type {@code sourceType}. Therefore, it examines
* other {@link AllocationTable}s until tables pointing to elements of the source type are
* For a given {@code targetElement} this method collects all of its transient allocation
* sources of the given type {@code sourceType}. Therefore, it examines other
* {@link AllocationTable}s until tables pointing to elements of the source type are
* reached. The examination logic is implemented on a per-element basis.
*/
@SuppressWarnings("unchecked")
public static <T extends IModelElement> Collection<T> getAllocationSourcesOf(
AllocationTableCollection atc, IModelElement modelElement, Class<T> sourceType) {
AllocationTable at = getAllocationTableWithTargetElement(atc, modelElement);
Collection<IModelElement> intermediateSrcs = getAllocationSourcesOf(modelElement, at);
public static <T extends IModelElement> Collection<T> getAllocationSourcesTransitive(
AllocationTableCollection atc, IModelElement targetElement, Class<T> sourceType) {
AllocationTable at = getAllocationTableWithTargetElement(atc, targetElement);
Collection<IModelElement> intermediateSrcs = getAllocationSources(targetElement, at);
// Directly return target elements if the current allocation table defines them as its
// target type.
......@@ -600,7 +600,7 @@ public class AllocationUtils {
// Descend to further tables until a table pointing to the target type is reached.
Collection<T> srcElements = new ArrayList<>();
for(IModelElement me : intermediateSrcs) {
srcElements.addAll(getAllocationSourcesOf(atc, me, sourceType));
srcElements.addAll(getAllocationSourcesTransitive(atc, me, sourceType));
}
return srcElements;
}
......@@ -609,7 +609,7 @@ public class AllocationUtils {
* Returns the source {@link IModelElement} that are allocated to the given
* {@code targetElement} in the given {@link AllocationTable}.
*/
public static Collection<IModelElement> getAllocationSourcesOf(IModelElement targetElement,
private static Collection<IModelElement> getAllocationSources(IModelElement targetElement,
AllocationTable at) {
Collection<IModelElement> sources =
at.getSourceElements(targetElement, OneToManyAllocationEntry.class);
......@@ -626,17 +626,16 @@ public class AllocationUtils {
}
/**
* For a given {@code modelElement} that is an allocation source, this method collects all of
* its transient allocation targets of the given type {@code sourceType}. Therefore, it examines
* other {@link AllocationTable}s until tables pointing to elements of the target type are
* reached. The examination logic is implemented on a per-element basis.
* For a given {@code sourceElement}, this method collects all of its transitive allocation
* targets of the given type {@code sourceType}. Therefore, it examines other
* {@link AllocationTable}s until tables pointing to elements of the target type
* are reached. The examination logic is implemented on a per-element basis.
*/
@SuppressWarnings("unchecked")
public static <T extends IModelElement> Collection<T> getAllocationTargetsOf(
AllocationTableCollection atc, IModelElement modelElement, Class<T> targetType) {
AllocationTable at = getAllocationTableWithSourceElement(atc, modelElement);
EList<IModelElement> intermediateTgts =
at.getTargetElements(modelElement, AllocationEntry.class);
public static <T extends IModelElement> Collection<T> getAllocationTargetsTransitive(
AllocationTableCollection atc, IModelElement sourceElement, Class<T> targetType) {
AllocationTable at = getAllocationTableWithTargetElement(atc, sourceElement);
Collection<IModelElement> intermediateTgts = getAllocationTargets(sourceElement, at);
// Directly return target elements if the current allocation table defines them as its
// target type.
......@@ -648,7 +647,7 @@ public class AllocationUtils {
// Descend to further tables until a table pointing to the target type is reached.
Collection<T> tgtElements = new ArrayList<>();
for(IModelElement me : intermediateTgts) {
tgtElements.addAll(getAllocationTargetsOf(atc, me, targetType));
tgtElements.addAll(getAllocationTargetsTransitive(atc, me, targetType));
}
return tgtElements;
}
......@@ -657,7 +656,7 @@ public class AllocationUtils {
* Returns the target {@link IModelElement}s to which the given {@code sourceElement} is mapped
* in the given {@link AllocationTable}.
*/
public static Collection<IModelElement> getAllocationTargetsOf(IModelElement sourceElement,
private static Collection<IModelElement> getAllocationTargets(IModelElement sourceElement,
AllocationTable at) {
Collection<IModelElement> targets =
at.getTargetElements(sourceElement, OneToManyAllocationEntry.class);
......
TypeSizePropertySection.java 54c6c4d36827aecd58fae76caa36c7abfc35d476 YELLOW
TypeSizePropertySection.java 5131a44d2f75e024df45b555c1f7f7ab255e80b6 GREEN
......@@ -37,14 +37,14 @@ import org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase;
*/
public class TypeSizePropertySection extends PropertySectionBase {
/** Specification of boolean sizes for an {@link ExecutionUnit}. */
BooleanSize booleanSize;
/** Architecture-dependent size of Booleans (in bits) for an {@link ExecutionUnit}. */
private BooleanSize booleanSize;
/** Specification of boolean sizes for an {@link ExecutionUnit}. */
IntegerSize integerSize;
/** Architecture-dependent size of Integers (in bits) for an {@link ExecutionUnit}. */
private IntegerSize integerSize;
/** Specification of boolean sizes for an {@link ExecutionUnit}. */
FloatSize floatSize;
/** Architecture-dependent size of Floats (in bits) for an {@link ExecutionUnit}. */
private FloatSize floatSize;
/** Text field for defining the size of booleans. */
private Text booleanSizeText;
......@@ -72,12 +72,10 @@ public class TypeSizePropertySection extends PropertySectionBase {
return;
}
booleanSize =
pickFirstInstanceOf(BooleanSize.class, ((IModelElement)input).getSpecifications());
integerSize =
pickFirstInstanceOf(IntegerSize.class, ((IModelElement)input).getSpecifications());
floatSize =
pickFirstInstanceOf(FloatSize.class, ((IModelElement)input).getSpecifications());
IModelElement element = (IModelElement)input;
booleanSize = pickFirstInstanceOf(BooleanSize.class, element.getSpecifications());
integerSize = pickFirstInstanceOf(IntegerSize.class, element.getSpecifications());
floatSize = pickFirstInstanceOf(FloatSize.class, element.getSpecifications());
}
/** {@inheritDoc} */
......
deployment.ecore 28d5a45bf242f09044f30bf34aee407fc22162db GREEN
platform.ecore d33128d24b3984bf7ca36dff6d1031a9151136f2 YELLOW
platform.ecore 202a4c23ba0c53f29170390ce9a392f5d72139ab GREEN
......@@ -903,20 +903,14 @@
<eOperations name="getDerivedValue" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return TypeSizeStaticImpl.getDerivedValue(this);"/>
<details key="documentation" value="TODO: write documentation (in the model!)"/>
</eAnnotations>
</eOperations>
<eOperations name="getUserAnnotatedValue" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return size;"/>
<details key="documentation" value="TODO: write documentation (in the model!)"/>
</eAnnotations>
</eOperations>
<eOperations name="getDefaultSize" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="TODO: write documentation (in the model!)"/>
</eAnnotations>
</eOperations>
<eOperations name="getDefaultSize" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/>
<eOperations name="getAF3Type" lowerBound="1">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Returns the corresponding AF3 Type that this size annotation represents. Must be implemented by concrete classes!"/>
......@@ -932,16 +926,15 @@
</eAnnotations>
<eParameters name="type" lowerBound="1" eType="ecore:EClass platform:/resource/org.fortiss.af3.project/model/project.ecore#//typesystem/IType"/>
</eOperations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="size" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="TODO: write documentation (in the model!)"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="size" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/>
<eGenericSuperTypes eClassifier="ecore:EClass platform:/resource/org.fortiss.tooling.base/model/base.ecore#//base/DerivedAnnotationBase">
<eTypeArguments eClassifier="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/>
</eGenericSuperTypes>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="BooleanSize" eSuperTypes="#//annotation/TypeSize">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Annotation class for the specification of platform-specific size of Booleans."/>
</eAnnotations>
<eOperations name="getDefaultSize" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return 1;"/>
......@@ -958,6 +951,9 @@
</eOperations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="IntegerSize" eSuperTypes="#//annotation/TypeSize">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Annotation class for the specification of platform-specific size of Integers."/>
</eAnnotations>
<eOperations name="getDefaultSize" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return 32;"/>
......@@ -974,6 +970,9 @@
</eOperations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="FloatSize" eSuperTypes="#//annotation/TypeSize">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Annotation class for the specification of platform-specific size of Floats."/>
</eAnnotations>
<eOperations name="getDefaultSize" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return 32;"/>
......
ArchitectureDomainLabelValueProvider.java 160f770988e9faaa006febb8b959110f23e1bab2 GREEN
BooleanSizeValueProvider.java 15eedf83c033ef5a4ae7f85c0774477c61da4d68 YELLOW
BooleanSizeValueProvider.java 70cd0cd98be962052f32b187d6fd88da6d0afaeb GREEN
FlashSizeValueProvider.java 64e8d4d7847660c4e6e39d3f8e0cbe209103038b GREEN
FloatSizeValueProvider.java 0811374dd3992aff00192a68643b83cdcc0502e3 YELLOW
FloatSizeValueProvider.java 7278a2a9a5bf4bc0dc1ddea7d99cc3e64dbb9daf GREEN
FrequencyValueProvider.java 0a8bdf5439f5b6e68fc4238e001a8967d8cdcd4b GREEN
HardwareCostValueProvider.java 1b0eab4f95285b0a43ef04642d55cc39f49d8da3 GREEN
IntegerSizeValueProvider.java d6d915dd825bc0a2d21c1b702dd8233535c44d98 YELLOW
IntegerSizeValueProvider.java 9feb27c0f4bc4902efb6937ea404edb3f75b480f GREEN
MaxNbMessagesValueProvider.java e044b44c758cb5bb6390b1aa01d6f7d52613a36e GREEN
MemorySizeValueProvider.java 89b49438bbdce20a7e36ff64fc3cbb4e8d9a2d50 GREEN
MessageSizeValueProvider.java cb34ae857796fb61d3ff0381adc6e67de2fa490e YELLOW
MessageSizeValueProvider.java cb34ae857796fb61d3ff0381adc6e67de2fa490e GREEN
PlatformElementTypeLabelValueProvider.java 350c0f91c52baa3ffc375c1e922e4834f2d31d4c GREEN
PowerConsumptionValueProvider.java 3703e15875b63c766969a32c78cad1bd386fb1c8 GREEN
RamSizeValueProvider.java 8b675ece5af567c5d2639959cac8e62c68219d8a GREEN
/*-------------------------------------------------------------------------+
| Copyright 2018 fortiss GmbH |
| Copyright 2019 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
......
/*-------------------------------------------------------------------------+
| Copyright 2018 fortiss GmbH |
| Copyright 2019 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
......
/*-------------------------------------------------------------------------+
| Copyright 2018 fortiss GmbH |
| Copyright 2019 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
......
ComponentToExecutionUnitAllocationEntryStaticImpl.java 4d05cdc8a5f89b314914d7495bc834dcd528e661 GREEN
ComponentToExecutionUnitAllocationTableStaticImpl.java 5a54ab0a5f7ddb6f34efe95d5c75eff0476a94e0 GREEN
InputPortToReceiverAllocationEntryStaticImpl.java d9336ab748c14d65f0f408dfe0c33bc174476a10 GREEN
MemoryAllocationTableStaticImpl.java 995e907bb56a474255d42ebc773c5f3e2b5aafe5 YELLOW
MemoryAllocationTableStaticImpl.java 2d99f28edea05d34631beb35ea16d70c57287cc2 GREEN
OutputPortToTransmitterAllocationEntryStaticImpl.java 51d055719cf24d1c8a3a84d7cf3090e8c36e914d GREEN
PortToTransceiverAllocationEntryStaticImpl.java 35465cfae8b44ff065e3c1893e4bbfb22f7e9858 GREEN
......@@ -15,10 +15,10 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.platform.model.allocation.impl;
import static org.fortiss.af3.allocation.utils.AllocationUtils.getAllocationSourcesOf;
import static org.fortiss.af3.allocation.utils.AllocationUtils.getAllocationSourcesTransitive;
import static org.fortiss.af3.allocation.utils.AllocationUtils.getAllocationTableWithTargetElement;
import static org.fortiss.af3.allocation.utils.AllocationUtils.getAllocationTableWithTargetView;
import static org.fortiss.af3.allocation.utils.AllocationUtils.getAllocationTargetsOf;
import static org.fortiss.af3.allocation.utils.AllocationUtils.getAllocationTargetsTransitive;
import static org.fortiss.af3.platform.utils.PlatformArchitectureUtils.getDataTypeSizeBits;
import static org.fortiss.tooling.common.util.LambdaUtils.getFirst;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.pickInstanceOf;
......@@ -78,7 +78,7 @@ public class MemoryAllocationTableStaticImpl {
// NOTE: While the utility method captures all potential mapping targets, here we assume
// that we only have 1:1 or n:1 mappings.
Collection<ExecutionUnit> tgtExecUnits =
getAllocationTargetsOf(atc, tgtPort.getOwner(), ExecutionUnit.class);
getAllocationTargetsTransitive(atc, tgtPort.getOwner(), ExecutionUnit.class);
IHierarchicElement selectedElement = getFirst(tgtExecUnits).orElse(null);
// If no type sizes were defined use the default specified for the target
......@@ -124,7 +124,7 @@ public class MemoryAllocationTableStaticImpl {
// Note: The AllocationUtil methods are not usable here, since we cannot know all port
// allocation types in this place.
for(Port sPort : getAllocationSourcesOf(portAllocTable.getAllocationTableCollection(), port,
for(Port sPort : getAllocationSourcesTransitive(portAllocTable.getAllocationTableCollection(), port,
Port.class)) {
PortSpecification pSpec = sPort.getPortSpecification();
IType type = pSpec.getType();
......
ArchitectureDomainLabelStaticImpl.java 33092c4a9344c603a0e81f1e9783e0cb75a007c2 GREEN
FlashSizeStaticImpl.java 286e2684a00da2a3d9a1af343debb405eadcf1f7 GREEN
FloatSizeStaticImpl.java 68c5d74c601e4c6d5f70778fc8dcc6d7bccc3baf YELLOW
FloatSizeStaticImpl.java 1865a69a689f466641759611e25791b7dbc1011c GREEN
FrequencyStaticImpl.java e5fb9d36dbc7371f0f6d298a02199fa3c165b3a4 GREEN
MessageSizeStaticImpl.java 7e77fdb3bfdf9b72ba2ed2b9b17a03d64cb32b04 YELLOW
MessageSizeStaticImpl.java 7e77fdb3bfdf9b72ba2ed2b9b17a03d64cb32b04 GREEN
PlatformArchitectureElementTypeLabelStaticImpl.java 195fe25d20fc098ed827f4eaa2318c1cf5f45874 GREEN
RamSizeStaticImpl.java bdc7dbd3ca9cdd184ff3698338f87bbcd466a118 GREEN
TypeSizeStaticImpl.java 80479fa8b20fba642dfba2feb632399cb94f5ccc YELLOW
TypeSizeStaticImpl.java 89beb950d069e1379ae24e871e69603a9e81657e GREEN
......@@ -26,7 +26,7 @@ import org.fortiss.af3.project.model.typesystem.IType;
*/
public class FloatSizeStaticImpl {
/** Staic implementation of {@link FloatSize#getValueOf(IType)}. */
/** Static implementation of {@link FloatSize#getValueOf(IType)}. */
public static Integer getValueOf(FloatSizeImpl floatSizeImpl, IType type) {
Integer floatSize = floatSizeImpl.getValue();
......
......@@ -48,7 +48,7 @@ public class TypeSizeStaticImpl {
return typeSizeImpl.getDefaultSize();
}
// Containers in a (Hierarchical) PlatformArchitecture are always ExecutionUnits and
// Containers in a (hierarchical) PlatformArchitecture are always ExecutionUnits and
// thus IModelElements.
if(parent instanceof IModelElement) {
TypeSize tSize = pickFirstInstanceOf(typeSizeImpl.getClass(),
......
PlatformArchitectureUtils.java 5b0c5bc0757573181ce08790f74472dbd96135c7 YELLOW
PlatformArchitectureUtils.java 4ca255e8e4d82e9dc80637c10f32920898222c51 GREEN
PlatformModelElementFactory.java 63c5751a04d702fb78962e98b316b4f221e55a54 GREEN
ResourceConnection.java f950c531580d4c427067cf83f469657c1bb9ecb1 GREEN
RouteUtils.java 2805209c3c2fd458f620ada41c906f57cffc406e GREEN
......@@ -633,19 +633,21 @@ public class PlatformArchitectureUtils {
}
/**
* Returns the size of a given {@link ITypeDefinition} whose corresponding port is mapped to the
* given {@link ExecutionUnit}. The latter (or one of its parents) defines the type size for the
* {@link ExecutionUnit} and its children by the {@link TypeSize} annotation.
* Returns the size of a given {@link IType} on the given platform element. The type size
* is defined by the platform element or one of its ancestors by means of the
* {@link TypeSize} annotation.
*
* @param type
* {@link ITypeDefinition} whose size shall be identified.
* @param execUnit
* {@link ExecutionUnit} of the target platform that has a {@link TypeSize}
* annotation.
* @return size of the given {@link ITypeDefinition} on the platform.
*/
public static Integer getDataTypeSizeBits(IType type, IModelElement execUnit) {
Collection<TypeSize> tsSpec = pickInstanceOf(TypeSize.class, execUnit.getSpecifications());
* {@link IType} whose size shall be determined.
* @param platformElement
* Platform element that has a {@link TypeSize} annotation (e.g.,
* {@link ExecutionUnit}, {@link PlatformArchitecture}).
* @return platform-specific size of the given {@link IType} on the given {@link ExecutionUnit}.
*/
public static Integer getDataTypeSizeBits(IType type, IModelElement platformElement) {
// Get all specializations of the TypeSize annotation (e.g., int, float, boolean).
Collection<TypeSize> tsSpec =
pickInstanceOf(TypeSize.class, platformElement.getSpecifications());
return getDataTypeSizeBits(type, tsSpec);
}
......@@ -665,6 +667,7 @@ public class PlatformArchitectureUtils {
return getDataTypeSizeBits(((TDefinedType)type).getDef(), tsList);
}
// Get matching TypeSize specialization
Optional<TypeSize> tSize = tsList.stream()
.filter(ts -> ts.getAF3Type().isAssignableFrom(type.getClass())).findFirst();
if(tSize.isPresent()) {
......
AF3TaskActivator.java 49b1624fa6585a46d3a66ec4937ebfa9a67fe9b4 YELLOW
AF3TaskActivator.java 49b1624fa6585a46d3a66ec4937ebfa9a67fe9b4 GREEN
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