Commit 7803ddae authored by Simon Barner's avatar Simon Barner
Browse files

Remove transmission unit bandwidth migrator

* Added in #3138
* Remove deprecated field in MM

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

Signed-off-by: Simon Barner's avatarSimon Barner <barner@fortiss.org>
parent 559612aa
timing.ecore 1cb099c3842b342c9f5ede11ed8073b9cd0d6b5d GREEN
timing.ecore 879a30a947087985bd5595e5e229e27aba1ab8e7 YELLOW
......@@ -368,12 +368,6 @@
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Annotation providing bandwidth of a TransmissionUnit (in Mbit/s)"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="bandwidth_MBytesPerSecond"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="@deprecated Speed of TransmissionUnit (in MBytes/s)."/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="bandwidth_MBitS" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Speed of TransmissionUnit (in Mbit/s)."/>
......
......@@ -135,7 +135,6 @@
<nestedGenPackages prefix="AF3TimingAnnotation" basePackage="org.fortiss.af3.timing.model"
disposableProviderFactory="true" ecorePackage="timing.ecore#//annotation">
<genClasses ecoreClass="timing.ecore#//annotation/TransmissionUnitBandwidth">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute timing.ecore#//annotation/TransmissionUnitBandwidth/bandwidth_MBytesPerSecond"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute timing.ecore#//annotation/TransmissionUnitBandwidth/bandwidth_MBitS"/>
</genClasses>
<genClasses ecoreClass="timing.ecore#//annotation/Wcet">
......
......@@ -37,10 +37,4 @@
<modelElementClass modelElementClass="org.fortiss.af3.timing.model.EventChain"/>
</modelElementCompositor>
</extension>
<extension point="org.fortiss.tooling.kernel.migrationProvider">
<migrationProvider migrationProvider="org.fortiss.af3.timing.model.migration.TransmissionUnitBandwidthMigration">
<objectClass objectClass="org.fortiss.af3.project.model.FileProject"/>
</migrationProvider>
</extension>
</plugin>
TransmissionUnitBandwidthMigration.java 06442b5dd924d9992fac91e84da6b5c4b2115646 GREEN
/*-------------------------------------------------------------------------+
| Copyright 2018 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.timing.model.migration;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType;
import java.util.Map;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.xml.type.AnyType;
import org.fortiss.af3.project.model.FileProject;
import org.fortiss.af3.timing.model.annotation.TransmissionUnitBandwidth;
import org.fortiss.tooling.kernel.extension.IMigrationProvider;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
/**
* Migration provider to convert bandwidth specifications from MBytes/s to MBit/s.
*
* @author barner
*/
@SuppressWarnings("deprecation")
public class TransmissionUnitBandwidthMigration implements IMigrationProvider {
/** {@inheritDoc} */
@Override
public boolean needMigration(ITopLevelElement modelElement,
Map<EObject, AnyType> unknownFeatures) {
if(!(modelElement.getRootModelElement() instanceof FileProject)) {
return false;
}
FileProject fileProject = (FileProject)modelElement.getRootModelElement();
return getChildrenWithType(fileProject, TransmissionUnitBandwidth.class).stream()
.anyMatch(bw -> bw.getBandwidth_MBytesPerSecond() != 0.0);
}
/** {@inheritDoc} */
@Override
public void migrate(ITopLevelElement modelElement, Map<EObject, AnyType> unknownFeatures) {
FileProject fileProject = (FileProject)modelElement.getRootModelElement();
for(TransmissionUnitBandwidth bw : getChildrenWithType(fileProject,
TransmissionUnitBandwidth.class)) {
if(bw.getBandwidth_MBytesPerSecond() != 0.0) {
if(bw.getBandwidth_MBitS() == 0.0) {
bw.setBandwidth_MBitS(bw.getBandwidth_MBytesPerSecond() * 8);
}
}
bw.setBandwidth_MBytesPerSecond(0.0);
}
}
}
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